annotate GalaxyPath.pm @ 2:80e19490ec6a draft

Uploaded
author sarahinraauzeville
date Tue, 12 Dec 2017 10:08:56 -0500
parents 1a0416feb74b
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
1a0416feb74b Uploaded
sarahinraauzeville
parents:
diff changeset
1 package GalaxyPath;
1a0416feb74b Uploaded
sarahinraauzeville
parents:
diff changeset
2
1a0416feb74b Uploaded
sarahinraauzeville
parents:
diff changeset
3 use parent 'Config::IniFiles';
1a0416feb74b Uploaded
sarahinraauzeville
parents:
diff changeset
4
1a0416feb74b Uploaded
sarahinraauzeville
parents:
diff changeset
5 sub _convert_path{
1a0416feb74b Uploaded
sarahinraauzeville
parents:
diff changeset
6 my ($path)=@_;
1a0416feb74b Uploaded
sarahinraauzeville
parents:
diff changeset
7 return $path if ($path=~/^\//);
1a0416feb74b Uploaded
sarahinraauzeville
parents:
diff changeset
8 return "$ENV{'MY_GALAXY_DIR'}/galaxy/$path";
1a0416feb74b Uploaded
sarahinraauzeville
parents:
diff changeset
9 }
1a0416feb74b Uploaded
sarahinraauzeville
parents:
diff changeset
10
1a0416feb74b Uploaded
sarahinraauzeville
parents:
diff changeset
11 sub my_path{
1a0416feb74b Uploaded
sarahinraauzeville
parents:
diff changeset
12 my $self = shift;
1a0416feb74b Uploaded
sarahinraauzeville
parents:
diff changeset
13 my ($section,$item)=@_;
1a0416feb74b Uploaded
sarahinraauzeville
parents:
diff changeset
14 defined $ENV{'MY_GALAXY_DIR'} || die 'no MY_GALAXY_DIR environment variable defined';
1a0416feb74b Uploaded
sarahinraauzeville
parents:
diff changeset
15 -e $ENV{'MY_GALAXY_DIR'} || die "$ENV{'MY_GALAXY_DIR'} path not found";
1a0416feb74b Uploaded
sarahinraauzeville
parents:
diff changeset
16 return join(',',map{_convert_path($_)}split/,/,$self->val($section,$item));
1a0416feb74b Uploaded
sarahinraauzeville
parents:
diff changeset
17 }
1a0416feb74b Uploaded
sarahinraauzeville
parents:
diff changeset
18
1a0416feb74b Uploaded
sarahinraauzeville
parents:
diff changeset
19 1;