# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> GLOBALS <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-my ( $script, $TMP_DIR );
+my ( $script, $BP_TMP );
$script = &Maasha::Common::get_scriptname();
-$TMP_DIR = &Maasha::Common::get_tmpdir();
+$BP_TMP = &Maasha::Common::get_tmpdir();
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> LOG <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
my ( $options, $in, $out );
- &script_list_biotools( $ENV{ 'INST_DIR'} . "/biotools/usage/" ) if $script eq "list_biotools";
+ &script_list_biopieces( $ENV{ 'INST_DIR'} . "/biopieces/usage/" ) if $script eq "list_biopieces";
- &script_print_usage( $ENV{ 'INST_DIR'} . "/biotools/usage/$script" ) if -t STDIN and not @ARGV;
+ &script_print_usage( $ENV{ 'INST_DIR'} . "/biopieces/usage/$script" ) if -t STDIN and not @ARGV;
$options = &get_options( $script );
}
-sub script_list_biotools
+sub script_list_biopieces
{
# Martin A. Hansen, January 2008.
- # Prints the description from the usage for each of the biotools.
+ # Prints the description from the usage for each of the biopieces.
my ( $path, # full path to usage directory
) = @_;
$end = $beg + $options->{ "len" };
}
- $align = &Maasha::UCSC::maf_extract( $TMP_DIR, $options->{ "genome" }, $maf_track, $options->{ "chr" }, $beg, $end, $options->{ "strand" } );
+ $align = &Maasha::UCSC::maf_extract( $BP_TMP, $options->{ "genome" }, $maf_track, $options->{ "chr" }, $beg, $end, $options->{ "strand" } );
foreach $entry ( @{ $align } )
{
{
if ( $record->{ "REC_TYPE" } eq "BED" )
{
- $align = &Maasha::UCSC::maf_extract( $TMP_DIR, $options->{ "genome" }, $maf_track, $record->{ "CHR" }, $record->{ "CHR_BEG" }, $record->{ "CHR_END" }, $record->{ "STRAND" } );
+ $align = &Maasha::UCSC::maf_extract( $BP_TMP, $options->{ "genome" }, $maf_track, $record->{ "CHR" }, $record->{ "CHR_BEG" }, $record->{ "CHR_END" }, $record->{ "STRAND" } );
}
elsif ( $record->{ "REC_TYPE" } eq "PSL" )
{
- $align = &Maasha::UCSC::maf_extract( $TMP_DIR, $options->{ "genome" }, $maf_track, $record->{ "S_ID" }, $record->{ "S_BEG" }, $record->{ "S_END" }, $record->{ "STRAND" } );
+ $align = &Maasha::UCSC::maf_extract( $BP_TMP, $options->{ "genome" }, $maf_track, $record->{ "S_ID" }, $record->{ "S_BEG" }, $record->{ "S_END" }, $record->{ "STRAND" } );
}
elsif ( $record->{ "REC_TYPE" } eq "BLAST" )
{
- $align = &Maasha::UCSC::maf_extract( $TMP_DIR, $options->{ "genome" }, $maf_track, $record->{ "S_ID" }, $record->{ "S_BEG" }, $record->{ "S_END" }, $record->{ "STRAND" } );
+ $align = &Maasha::UCSC::maf_extract( $BP_TMP, $options->{ "genome" }, $maf_track, $record->{ "S_ID" }, $record->{ "S_BEG" }, $record->{ "S_END" }, $record->{ "STRAND" } );
}
foreach $entry ( @{ $align } )
push @args, "-m $options->{ 'max_hits' }" if $options->{ 'max_hits' };
push @args, "-n $options->{ 'max_misses' }" if $options->{ 'max_hits' };
- $seq_file = "$TMP_DIR/patscan.seq";
- $pat_file = "$TMP_DIR/patscan.pat";
- $out_file = "$TMP_DIR/patscan.out";
+ $seq_file = "$BP_TMP/patscan.seq";
+ $pat_file = "$BP_TMP/patscan.pat";
+ $out_file = "$BP_TMP/patscan.out";
$fh_out = &Maasha::Common::write_open( $seq_file );
$options->{ "database" } = &Maasha::Config::genome_blast( $options->{ 'genome' } ) if $options->{ 'genome' };
- $tmp_in = "$TMP_DIR/blast_query.seq";
- $tmp_out = "$TMP_DIR/blast.result";
+ $tmp_in = "$BP_TMP/blast_query.seq";
+ $tmp_out = "$BP_TMP/blast.result";
$fh_out = &Maasha::Common::write_open( $tmp_in );
$blat_args .= " -stepSize=$options->{ 'step_size' }";
$blat_args .= " -ooc=" . &Maasha::Config::genome_blat_ooc( $options->{ "genome" }, 11 ) if $options->{ 'ooc' };
- $query_file = "$TMP_DIR/blat.seq";
+ $query_file = "$BP_TMP/blat.seq";
$fh_out = &Maasha::Common::write_open( $query_file );
$blat_args .= " -t=dnax" if $type eq "protein";
$blat_args .= " -q=$type";
- $result_file = "$TMP_DIR/blat.psl";
+ $result_file = "$BP_TMP/blat.psl";
&Maasha::Common::run( "blat", "$genome_file $query_file $blat_args $result_file > /dev/null 2>&1" );
if ( @entries == 1 )
{
- $results = &Maasha::Match::match_mummer( [ $entries[ 0 ] ], [ $entries[ 0 ] ], $options, $TMP_DIR );
+ $results = &Maasha::Match::match_mummer( [ $entries[ 0 ] ], [ $entries[ 0 ] ], $options, $BP_TMP );
map { &put_record( $_, $out ) } @{ $results };
}
elsif ( @entries == 2 )
{
- $results = &Maasha::Match::match_mummer( [ $entries[ 0 ] ], [ $entries[ 1 ] ], $options, $TMP_DIR );
+ $results = &Maasha::Match::match_mummer( [ $entries[ 0 ] ], [ $entries[ 1 ] ], $options, $BP_TMP );
map { &put_record( $_, $out ) } @{ $results };
}
&put_record( $record, $out );
}
- $result_file = &Maasha::Match::match_vmatch( $TMP_DIR, \@records, \@index_files, $options );
+ $result_file = &Maasha::Match::match_vmatch( $BP_TMP, \@records, \@index_files, $options );
undef @records;
$mask = 1 if not $options->{ "no_mask" };
- $tmp_file = "$TMP_DIR/write_2bit.fna";
+ $tmp_file = "$BP_TMP/write_2bit.fna";
$fh_tmp = &Maasha::Common::write_open( $tmp_file );
$fh_out = &write_stream( $options->{ "data_out" } );
$AoA = &Maasha::Matrix::matrix_flip( $AoA );
- $plot = &Maasha::Plot::lineplot_simple( $AoA, $options, $TMP_DIR );
+ $plot = &Maasha::Plot::lineplot_simple( $AoA, $options, $BP_TMP );
$fh = &write_stream( $options->{ "data_out" } );
$options->{ "num" } ||= 10;
- $tmp_file = "$TMP_DIR/random_records.tmp";
+ $tmp_file = "$BP_TMP/random_records.tmp";
$fh_out = &Maasha::Common::write_open( $tmp_file );
my ( $num, $record, %count_hash, @records, $tmp_file, $fh_out, $fh_in, $cache );
- $tmp_file = "$TMP_DIR/count_cache.tmp";
+ $tmp_file = "$BP_TMP/count_cache.tmp";
$fh_out = &Maasha::Common::write_open( $tmp_file );
$options->{ "xlabel" } ||= $data[ 0 ]->{ "Q_ID" };
$options->{ "ylabel" } ||= $data[ 0 ]->{ "S_ID" };
- $result = &Maasha::Plot::dotplot_matches( \@data, $options, $TMP_DIR );
+ $result = &Maasha::Plot::dotplot_matches( \@data, $options, $BP_TMP );
$fh = &write_stream( $options->{ "data_out" } );
$options->{ "color" } ||= join( ",", int( rand( 255 ) ), int( rand( 255 ) ), int( rand( 255 ) ) );
$options->{ "chunk_size" } ||= 10_000_000_000; # Due to 32-bit UCSC compilation really large tables cannot be loaded in one go.
- $file = "$TMP_DIR/ucsc_upload.tmp";
+ $file = "$BP_TMP/ucsc_upload.tmp";
$append = 0;
$record->{ "CHR_BEG" } = $record->{ "S_BEG" } if not defined $record->{ "CHR_BEG" };
$record->{ "CHR_END" } = $record->{ "S_END" } if not defined $record->{ "CHR_END" };
- $fh_hash{ $record->{ "CHR" } } = &Maasha::Common::write_open( "$TMP_DIR/$record->{ 'CHR' }" ) if not exists $fh_hash{ $record->{ "CHR" } };
+ $fh_hash{ $record->{ "CHR" } } = &Maasha::Common::write_open( "$BP_TMP/$record->{ 'CHR' }" ) if not exists $fh_hash{ $record->{ "CHR" } };
$fh_out = $fh_hash{ $record->{ "CHR" } };
foreach $chr ( sort keys %fh_hash )
{
- &Maasha::Common::run( "bedSort", "$TMP_DIR/$chr $TMP_DIR/$chr" );
+ &Maasha::Common::run( "bedSort", "$BP_TMP/$chr $BP_TMP/$chr" );
- $fh_in = &Maasha::Common::read_open( "$TMP_DIR/$chr" );
+ $fh_in = &Maasha::Common::read_open( "$BP_TMP/$chr" );
undef $block;
&Maasha::UCSC::fixedstep_put_entry( $chr, $beg_block, $block, $fh_out );
- unlink "$TMP_DIR/$chr";
+ unlink "$BP_TMP/$chr";
}
close $fh_out;
$wig_file = "$options->{ 'table' }.wig";
$wib_file = "$options->{ 'table' }.wib";
- $wib_dir = "$ENV{ 'DATA_DIR' }/genomes/$options->{ 'database' }/wib";
+ $wib_dir = "$ENV{ 'BP_DATA' }/genomes/$options->{ 'database' }/wib";
&Maasha::Common::dir_create_if_not_exists( $wib_dir );
# &Maasha::Common::run( "wigEncode", "$file $wig_file $wib_file > /dev/null 2>&1" );
- `cd $TMP_DIR && wigEncode $file $wig_file $wib_file > /dev/null 2>&1`;
- &Maasha::Common::run( "mv", "$TMP_DIR/$wib_file $wib_dir" );
+ `cd $BP_TMP && wigEncode $file $wig_file $wib_file > /dev/null 2>&1`;
+ &Maasha::Common::run( "mv", "$BP_TMP/$wib_file $wib_dir" );
unlink $file;
close $fh_out;
if ( $format eq "BED" ) {
- &Maasha::UCSC::bed_upload_to_ucsc( $TMP_DIR, $file, $options, $append );
+ &Maasha::UCSC::bed_upload_to_ucsc( $BP_TMP, $file, $options, $append );
} elsif ( $format eq "PSL" ) {
&Maasha::UCSC::psl_upload_to_ucsc( $file, $options, $append );
}
{
$type = "bed $columns";
- &Maasha::UCSC::bed_upload_to_ucsc( $TMP_DIR, $file, $options, $append );
+ &Maasha::UCSC::bed_upload_to_ucsc( $BP_TMP, $file, $options, $append );
}
elsif ( $format eq "BED_SS" )
{
$type = "sec_struct";
- &Maasha::UCSC::bed_upload_to_ucsc( $TMP_DIR, $file, $options, $append );
+ &Maasha::UCSC::bed_upload_to_ucsc( $BP_TMP, $file, $options, $append );
}
elsif ( $format eq "PSL" )
{
{
$type = "wig 0";
- &Maasha::UCSC::wiggle_upload_to_ucsc( $TMP_DIR, $wib_dir, $file, $options );
+ &Maasha::UCSC::wiggle_upload_to_ucsc( $BP_TMP, $wib_dir, $file, $options );
}
unlink $file;
sleep 1;
- if ( -d $TMP_DIR )
+ if ( -d $BP_TMP )
{
if ( $sig =~ /MAASHA_ERROR/ ) {
print STDERR "\nProgram '$script' had an error" . " - Please wait for temporary data to be removed\n";
}
# This is a really bad solution, potentially, anyone can include this module and set
- # the TMP_DIR to point at any dir and thus take out the machine !!!
+ # the BP_TMP to point at any dir and thus take out the machine !!!
- &Maasha::Common::dir_remove( $TMP_DIR );
+ &Maasha::Common::dir_remove( $BP_TMP );
}
exit( 0 );
END
{
# This is a really bad solution, potentially, anyone can include this module and set
- # the TMP_DIR to point at any dir and thus take out the machine !!!
+ # the BP_TMP to point at any dir and thus take out the machine !!!
- &Maasha::Common::dir_remove( $TMP_DIR );
+ &Maasha::Common::dir_remove( $BP_TMP );
}
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> GLOBALS <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-my ( $HOME, $PATH, $DATA_DIR, $TMP_DIR, $INST_DIR );
+my ( $HOME, $PATH, $BP_DATA, $BP_TMP, $BP_DIR );
$HOME = $ENV{ "HOME" };
$PATH = $ENV{ "PATH" };
-$DATA_DIR = $ENV{ "DATA_DIR" };
-$TMP_DIR = $ENV{ "TMP_DIR" };
-$INST_DIR = $ENV{ "INST_DIR" };
+$BP_DIR = $ENV{ "BP_DIR" };
+$BP_DATA = $ENV{ "BP_DATA" };
+$BP_TMP = $ENV{ "BP_TMP" };
warn qq(WARNING: HOME not set in env\n) if not defined $HOME;
warn qq(WARNING: PATH not set in env\n) if not defined $PATH;
-warn qq(WARNING: DATA_DIR not set in env\n) if not defined $DATA_DIR;
-warn qq(WARNING: TMP_DIR not set in env\n) if not defined $TMP_DIR;
-warn qq(WARNING: INST_DIR not set in env\n) if not defined $INST_DIR;
+warn qq(WARNING: BP_DIR not set in env\n) if not defined $BP_DIR;
+warn qq(WARNING: BP_DATA not set in env\n) if not defined $BP_DATA;
+warn qq(WARNING: BP_TMP not set in env\n) if not defined $BP_TMP;
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
# Returns string.
- my $genome_file = "$DATA_DIR/genomes/$genome/$genome.fna";
+ my $genome_file = "$BP_DATA/genomes/$genome/$genome.fna";
if ( not -f $genome_file ) {
&Maasha::Common::error( qq(Genome file "$genome_file" for genome "$genome" not found) );
# Returns string.
- my $index = "$DATA_DIR/genomes/$genome/$genome.fna.index";
+ my $index = "$BP_DATA/genomes/$genome/$genome.fna.index";
if ( not -f $index ) {
&Maasha::Common::error( qq(Index file "$index" for genome -> $genome not found) );
# Returns string.
- my $file = "$DATA_DIR/genomes/$genome/blast/$genome.fna";
+ my $file = "$BP_DATA/genomes/$genome/blast/$genome.fna";
return $file;
}
# Returns string.
- my $ooc_file = "$DATA_DIR/genomes/$genome/blat/$tile_size.ooc";
+ my $ooc_file = "$BP_DATA/genomes/$genome/blat/$tile_size.ooc";
&Maasha::Common::error( qq(ooc file "$ooc_file" not found for genome -> $genome) ) if not -f $ooc_file;
@chrs = &chromosomes( $genome );
- map { $_ = "$DATA_DIR/genomes/$genome/vmatch/$_" } @chrs;
+ map { $_ = "$BP_DATA/genomes/$genome/vmatch/$_" } @chrs;
# needs robustness check
# Returns a string.
- my $file = "$DATA_DIR/genomes/$genome/phastcons/$genome.pp";
+ my $file = "$BP_DATA/genomes/$genome/phastcons/$genome.pp";
return $file;
}
# Returns a string.
- my $file = "$DATA_DIR/genomes/$genome/phastcons/$genome.pp.index";
+ my $file = "$BP_DATA/genomes/$genome/phastcons/$genome.pp.index";
return $file;
}
my ( %genome_hash, $fh, $line, @genomes, $org );
- $fh = &Maasha::Common::read_open( "$INST_DIR/conf/genomes.conf" );
+ $fh = &Maasha::Common::read_open( "$BP_DIR/conf/genomes.conf" );
while ( $line = <$fh> )
{
my ( $fh_in, $line, $org, $chr, %genome_hash, @chrs );
- $fh_in = &Maasha::Common::read_open( "$INST_DIR/conf/genomes.conf" );
+ $fh_in = &Maasha::Common::read_open( "$BP_DIR/bp_conf/genomes.conf" );
while ( $line = <$fh_in> )
{