]> git.donarmstrong.com Git - biopieces.git/commitdiff
added option for database search to blat_seq
authormartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Thu, 11 Feb 2010 16:35:57 +0000 (16:35 +0000)
committermartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Thu, 11 Feb 2010 16:35:57 +0000 (16:35 +0000)
git-svn-id: http://biopieces.googlecode.com/svn/trunk@875 74ccb610-7750-0410-82ae-013aeee3265d

bp_bin/blat_seq

index 220e7b3d61de86afb7878e70b815c966c0e20568..073cfd89d0ae8bb92bfaf767949452d88b507a8b 100755 (executable)
@@ -38,27 +38,35 @@ use Maasha::UCSC::PSL;
 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
 
 
-my ( $options, $in, $out, $record, $blat_args, $genome_file, $query_file, $fh_in, $fh_out,
+my ( $options, $in, $out, $record, $blat_args, $subject_file, $query_file, $fh_in, $fh_out,
      $tmp_dir, $type, $result_file, $entry );
 
 $options = Maasha::Biopieces::parse_options(
     [
-        { long => 'genome',       short => 'g', type => 'genome', mandatory => 'yes', default => undef,  allowed => undef, disallowed => undef },
-        { long => 'fast_map',     short => 'f', type => 'flag',   mandatory => 'no',  default => undef,  allowed => undef, disallowed => undef },
-        { long => 'occ',          short => 'c', type => 'flag',   mandatory => 'no',  default => undef,  allowed => undef, disallowed => undef },
-        { long => 'intron_max',   short => 'i', type => 'uint',   mandatory => 'no',  default => 750000, allowed => undef, disallowed => undef },
-        { long => 'tile_size',    short => 't', type => 'uint',   mandatory => 'no',  default => 11,     allowed => undef, disallowed => 0 },
-        { long => 'step_size',    short => 's', type => 'uint',   mandatory => 'no',  default => 11,     allowed => undef, disallowed => 0 },
-        { long => 'min_identity', short => 'm', type => 'uint',   mandatory => 'no',  default => 90,     allowed => undef, disallowed => 0 },
-        { long => 'min_score',    short => 'M', type => 'uint',   mandatory => 'no',  default => 0,      allowed => undef, disallowed => undef },
-        { long => 'one_off',      short => 'o', type => 'uint',   mandatory => 'no',  default => 0,      allowed => undef, disallowed => undef },
+        { long => 'database',     short => 'd', type => 'file',   mandatory => 'no', default => undef,  allowed => undef, disallowed => undef },
+        { long => 'genome',       short => 'g', type => 'genome', mandatory => 'no', default => undef,  allowed => undef, disallowed => undef },
+        { long => 'fast_map',     short => 'f', type => 'flag',   mandatory => 'no', default => undef,  allowed => undef, disallowed => undef },
+        { long => 'occ',          short => 'c', type => 'flag',   mandatory => 'no', default => undef,  allowed => undef, disallowed => undef },
+        { long => 'intron_max',   short => 'i', type => 'uint',   mandatory => 'no', default => 750000, allowed => undef, disallowed => undef },
+        { long => 'tile_size',    short => 't', type => 'uint',   mandatory => 'no', default => 11,     allowed => undef, disallowed => 0 },
+        { long => 'step_size',    short => 's', type => 'uint',   mandatory => 'no', default => 11,     allowed => undef, disallowed => 0 },
+        { long => 'min_identity', short => 'm', type => 'uint',   mandatory => 'no', default => 90,     allowed => undef, disallowed => 0 },
+        { long => 'min_score',    short => 'M', type => 'uint',   mandatory => 'no', default => 0,      allowed => undef, disallowed => undef },
+        { long => 'one_off',      short => 'o', type => 'uint',   mandatory => 'no', default => 0,      allowed => undef, disallowed => undef },
     ]   
 );
 
+Maasha::Common::error( qq(both --database and --genome specified) ) if     $options->{ "genome" } and     $options->{ "database" };
+Maasha::Common::error( qq(no --database or --genome specified) )    if not $options->{ "genome" } and not $options->{ "database" };
+
 $in  = Maasha::Biopieces::read_stream( $options->{ "stream_in" } );
 $out = Maasha::Biopieces::write_stream( $options->{ "stream_out" } );
 
-$genome_file = "$ENV{ 'BP_DATA' }/genomes/$options->{ 'genome' }/fasta/$options->{ 'genome' }.fna";
+if ( $options->{ 'database' } ) {
+    $subject_file = $options->{ 'database' };
+} else {
+    $subject_file = "$ENV{ 'BP_DATA' }/genomes/$options->{ 'genome' }/fasta/$options->{ 'genome' }.fna";
+}
 
 $blat_args .= " -tileSize=$options->{ 'tile_size' }";
 $blat_args .= " -oneOff=$options->{ 'one_off' }";
@@ -93,9 +101,9 @@ $blat_args .= " -q=$type";
 $result_file = "$tmp_dir/blat.psl";
 
 if ( $options->{ 'verbose' } ) {
-    Maasha::Common::run( "blat", "$genome_file $query_file $blat_args $result_file" );
+    Maasha::Common::run( "blat", "$subject_file $query_file $blat_args $result_file" );
 } else {
-    Maasha::Common::run( "blat", "$genome_file $query_file $blat_args $result_file > /dev/null 2>&1" );
+    Maasha::Common::run( "blat", "$subject_file $query_file $blat_args $result_file > /dev/null 2>&1" );
 }
 
 unlink $query_file;