]> git.donarmstrong.com Git - biopieces.git/blobdiff - bp_bin/blast_seq_pair
added split_pair_seq biopiece
[biopieces.git] / bp_bin / blast_seq_pair
index b6529fb4017a6c5d873747a7a26f8ab2560b0c1b..d612a6cdc06b7c3ead49bdae36945b5ae3f01e66 100755 (executable)
@@ -121,14 +121,14 @@ class Blast
   def program_choose(type1, type2)
     program = ""
 
-    if type1 == 'protein'
-      if type2 == 'protein'
+    if type1 == :protein
+      if type2 == :protein
         program = 'blastp'
       else
         program = 'tblastn'
       end
     else
-      if type2 == 'protein'
+      if type2 == :protein
         program = 'blastx'
       else
         program = 'blastn'
@@ -151,7 +151,6 @@ casts << {:long=>'no_gaps',   :short=>'G', :type=>'flag',   :mandatory=>false, :
 options = Biopieces.options_parse(ARGV, casts)
 
 tmpdir  = Biopieces.mktmpdir
-tmpdir  = "Tmp"
 infile1 = File.join(tmpdir, "in1.fna")
 infile2 = File.join(tmpdir, "in2.fna")
 outfile = File.join(tmpdir, "blast.out")
@@ -165,10 +164,12 @@ Biopieces.open(options[:stream_in], options[:stream_out]) do |input, output|
   input.each_record do |record|
     output.puts record
 
-    if record.has_key? :SEQ_NAME and record.has_key? :SEQ
+    if record[:SEQ_NAME] and record[:SEQ]
+      seq = Seq.new_bp(record)
+
       unless got1
         Fasta.open(infile1, mode="w") do |fasta_io|
-          fasta_io.puts record
+          fasta_io.puts seq.to_fasta
         end
 
         got1  = true
@@ -178,7 +179,7 @@ Biopieces.open(options[:stream_in], options[:stream_out]) do |input, output|
 
       unless got2
         Fasta.open(infile2, mode="w") do |fasta_io|
-          fasta_io.puts record
+          fasta_io.puts seq.to_fasta
         end
 
         got2  = true