[Bioperl-l] Inhereting environmental variables

Jason Stajich jason@cgt.mc.duke.edu
Fri, 6 Dec 2002 13:44:16 -0500 (EST)


This is because when the module is read in, the variable value is set, so
at startup during 'use' the DATADIR variable is set, another reason not to
rely on env variables but to do things explicitly I guess.

I would do this instead of resetting the env variable:

$Bio::Tools::Run::StandAloneBlast::DATADIR = '/localcopy';

Alternatively - you can always specify the full path to the db when you
blast as well.

-j
On Fri, 6 Dec 2002, Andy Nunberg wrote:

> Hi,
> I am running a script(pipeline.pl)with my own subroutine(blast_and_parse)
> which calls StandAloneBlast.pm.  If I change the environmental variable
> BLASTDB in the script, StandAloneBlast does not see the change.  Is this a
> perl or bioperl issue??
> Andy
>
> pipeline.pl
> #!/usr/bin/perl -w
> use strict;
> use Pipeline;
> if ( -d "local copy"){
> 	$ENV{'BLASTDB'}='/localcopy';
> }else{
> 	$ENV{'BLASTDB'}='/sharedcopy';
> }
> ....
> blast_and_parse(fasta_file);
> ....
>
> Pipeline.pm
> blast_and_parse {
> .....
> warn "blast db' s are in $ENV{'BLASTDB'}....\n";##this is show the changes
> made in the script
> $blast_report=$factory->blastall($seq);
> ....
> }
>
> StandAloneBlast will throw an exception showing the $BLASTDB set in
> .bash_profile or whatever it is set to in the shell rather than what it is
> set in the script(because the .bash_profile setting now has no databases in
> it).
>
> *******************************************************************
> Andy Nunberg, Ph.D
> Computational Biologist
> Orion Genomics, LLC
> (314) 615-6989
> http://www.oriongenomics.com
>
> 
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l@bioperl.org
> http://bioperl.org/mailman/listinfo/bioperl-l
>

--
Jason Stajich
Duke University
jason at cgt.mc.duke.edu