]> git.donarmstrong.com Git - biopieces.git/blobdiff - bp_bin/pcr_seq
added split_pair_seq biopiece
[biopieces.git] / bp_bin / pcr_seq
index 8700276e16287559ed9fe37f1d33b8c26c382e7a..7e487f8df302c2bcfdb75b10216ef828a51d4f4f 100755 (executable)
@@ -145,8 +145,8 @@ class Pattern
 
     seq      = Seq.new
     seq.seq  = primer
-    seq.type = 'dna'
-    seq.revcomp
+    seq.type = :dna
+    seq.reverse!.complement!
 
     descriptor ? seq.seq + descriptor : seq.seq
   end
@@ -157,18 +157,18 @@ casts << {:long=>'forward',    :short=>'f', :type=>'string', :mandatory=>false,
 casts << {:long=>'forward_rc', :short=>'F', :type=>'string', :mandatory=>false, :default=>nil,  :allowed=>nil, :disallowed=>nil}
 casts << {:long=>'reverse',    :short=>'r', :type=>'string', :mandatory=>false, :default=>nil,  :allowed=>nil, :disallowed=>nil}
 casts << {:long=>'reverse_rc', :short=>'R', :type=>'string', :mandatory=>false, :default=>nil,  :allowed=>nil, :disallowed=>nil}
-casts << {:long=>'max_dist',   :short=>'m', :type=>'uint',   :mandatory=>true, :default=>5000, :allowed=>nil, :disallowed=>"0"}
+casts << {:long=>'max_dist',   :short=>'m', :type=>'uint',   :mandatory=>true,  :default=>5000, :allowed=>nil, :disallowed=>"0"}
 
 options = Biopieces.options_parse(ARGV, casts)
 tmpdir  = Biopieces.mktmpdir
 infile  = File.join(tmpdir, "in.fna")
 
 if options[:forward_rc]
-  options[:forward] = Seq.new("test", options[:forward_rc], 'dna').revcomp.seq
+  options[:forward] = Seq.new("test", options[:forward_rc], :dna).reverse.complement.seq
 end
 
 if options[:reverse_rc]
-  options[:reverse] = Seq.new("test", options[:reverse_rc], 'dna').revcomp.seq
+  options[:reverse] = Seq.new("test", options[:reverse_rc], :dna).reverse.complement.seq
 end
 
 raise ArgumentError, "no adaptor specified" unless options[:forward] or options[:reverse]
@@ -177,7 +177,7 @@ Biopieces.open(options[:stream_in], options[:stream_out]) do |input, output|
     input.each_record do |record|
       output.puts record
 
-      if record.has_key? :SEQ
+      if record[:SEQ]
         entry = Seq.new_bp(record)
         ios.puts entry.to_fasta
       end
@@ -195,8 +195,8 @@ Biopieces.open(options[:stream_in], options[:stream_out]) do |input, output|
         record[:TYPE]     = File.basename(outfile).sub(".fna", "").upcase
         record[:SEQ_NAME].match(/(.+):\[(\d+),(\d+)\]$/)
         record[:SEQ_NAME] = $1
-        record[:PCR_BEG]  = $2
-        record[:PCR_END]  = $3
+        record[:PCR_BEG]  = $2.to_i
+        record[:PCR_END]  = $3.to_i
 
         if record[:PCR_BEG] > record[:PCR_END]
           record[:PCR_BEG], record[:PCR_END] = record[:PCR_END], record[:PCR_BEG]