sanger-pathogens/vr-codebase — pull request #116 by CraigPorter (2012-07-10 09:52:25+00:00)
Title: Sample hierarchy

I tried deleting samples from one of our tracking databases and found that vrtracking_tools wasn't returning the directory path to the samples that I expected. I found that the program wasn't using the DATA_HIERARCHY environment variable. Our directory structure is, "genus:species-subspecies:TRACKING:projectssid:sample:technology:library:lane".

The solution that I came up with was to add a general function for finding the hierarchy path to a Project, Sample, Library or Lane to the VRTrack module.

There are two commits:

The change to VRTrack.pm adding a function heirarchy_path_of_object() based on heirarchy_path_of_lane() and setting heirarchy_path_of_lane() to call the new function. I've also added a set of unit tests for the new function.

The change to vrtracking_tools to use the heirarchy_path_of_object().

Note:
The POD documentation states that hierarchy_path_of_lane() returns undef if a hierarchy cannot be built so hierarchy_path_of_object() is set to return undef if a hierarchy cannot be built for any reason. For instance, if species is part of the hierarchy and species data isn't available then the function will return undef.