]> git.donarmstrong.com Git - biopieces.git/blobdiff - bp_bin/get_genome_phastcons
refactoring of assemble_pairs
[biopieces.git] / bp_bin / get_genome_phastcons
index 337c019851984f79c9c6a5b35f57b68b7ad59402..4e348b8daa309f5c82c87d7dcb99df8f4bc08a3e 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env perl -w
+#!/usr/bin/env perl
 
 # Copyright (C) 2007-2009 Martin A. Hansen.
 
 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
 
 
+use warnings;
 use strict;
 use Maasha::Biopieces;
 use Maasha::Filesys;
-use Maasha::UCSC;
+use Maasha::UCSC::Wiggle;
 
 
 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
@@ -54,7 +55,7 @@ $out = Maasha::Biopieces::write_stream( $options->{ "stream_out" } );
 $phastcons_file  = "$ENV{ 'BP_DATA' }/genomes/$options->{ 'genome' }/phastcons/$options->{ 'genome' }.pp";
 $phastcons_index = "$ENV{ 'BP_DATA' }/genomes/$options->{ 'genome' }/phastcons/$options->{ 'genome' }.pp.index";
 
-$index           = Maasha::UCSC::fixedstep_index_retrieve( $phastcons_index );
+$index           = Maasha::UCSC::Wiggle::fixedstep_index_retrieve( $phastcons_index );
 $fh_phastcons    = Maasha::Filesys::file_read_open( $phastcons_file );
 
 if ( defined $options->{ "chr" } and defined $options->{ "beg" } and ( defined $options->{ "end" } or defined $options->{ "len" } ) )
@@ -66,7 +67,7 @@ if ( defined $options->{ "chr" } and defined $options->{ "beg" } and ( defined $
         $options->{ "end" } = $options->{ "beg" } + $options->{ "len" } - 1;
     }
 
-    $scores = Maasha::UCSC::fixedstep_index_lookup( $index, $fh_phastcons, $options->{ "chr" }, $options->{ "beg" }, $options->{ "end" }, $options->{ "flank" } );
+    $scores = Maasha::UCSC::Wiggle::fixedstep_index_lookup( $index, $fh_phastcons, $options->{ "chr" }, $options->{ "beg" }, $options->{ "end" }, $options->{ "flank" } );
 
     $record->{ "CHR" }       = $options->{ "chr" };
     $record->{ "CHR_BEG" }   = $options->{ "beg" } - $options->{ "flank" };
@@ -82,15 +83,15 @@ while ( $record = Maasha::Biopieces::get_record( $in ) )
 {
     if ( $record->{ "REC_TYPE" } eq "BED" )
     {
-        $scores = Maasha::UCSC::fixedstep_index_lookup( $index, $fh_phastcons, $record->{ "CHR" }, $record->{ "CHR_BEG" }, $record->{ "CHR_END" }, $options->{ "flank" } );
+        $scores = Maasha::UCSC::Wiggle::fixedstep_index_lookup( $index, $fh_phastcons, $record->{ "CHR" }, $record->{ "CHR_BEG" }, $record->{ "CHR_END" }, $options->{ "flank" } );
     }
     elsif ( $record->{ "REC_TYPE" } eq "PSL" )
     {
-        $scores = Maasha::UCSC::fixedstep_index_lookup( $index, $fh_phastcons, $record->{ "S_ID" }, $record->{ "S_BEG" }, $record->{ "S_END" }, $options->{ "flank" } );
+        $scores = Maasha::UCSC::Wiggle::fixedstep_index_lookup( $index, $fh_phastcons, $record->{ "S_ID" }, $record->{ "S_BEG" }, $record->{ "S_END" }, $options->{ "flank" } );
     }
     elsif ( $record->{ "REC_TYPE" } eq "BLAST" )
     {
-        $scores = Maasha::UCSC::fixedstep_index_lookup( $index, $fh_phastcons, $record->{ "S_ID" }, $record->{ "S_BEG" }, $record->{ "S_END" }, $options->{ "flank" } );
+        $scores = Maasha::UCSC::Wiggle::fixedstep_index_lookup( $index, $fh_phastcons, $record->{ "S_ID" }, $record->{ "S_BEG" }, $record->{ "S_END" }, $options->{ "flank" } );
     }
 
     $record->{ "PHASTCONS" } = join ",", @{ $scores } if @{ $scores };
@@ -101,26 +102,22 @@ while ( $record = Maasha::Biopieces::get_record( $in ) )
 
 close $fh_phastcons if $fh_phastcons;                                                                                                                                          
 
+Maasha::Biopieces::close_stream( $in );
+Maasha::Biopieces::close_stream( $out );
+
 
 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
 
 
 BEGIN
 {
-    $run_time_beg = Maasha::Biopieces::run_time();
-
-    Maasha::Biopieces::log_biopiece();
+    Maasha::Biopieces::status_set();
 }
 
 
 END
 {
-    Maasha::Biopieces::close_stream( $in );
-    Maasha::Biopieces::close_stream( $out );
-
-    $run_time_end = Maasha::Biopieces::run_time();
-
-    Maasha::Biopieces::run_time_print( $run_time_beg, $run_time_end, $options );
+    Maasha::Biopieces::status_log();
 }
 
 
@@ -128,4 +125,3 @@ END
 
 
 __END__
-