]> git.donarmstrong.com Git - biopieces.git/commitdiff
added assemble_pairs2
authormartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Tue, 12 Mar 2013 18:13:17 +0000 (18:13 +0000)
committermartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Tue, 12 Mar 2013 18:13:17 +0000 (18:13 +0000)
git-svn-id: http://biopieces.googlecode.com/svn/trunk@2134 74ccb610-7750-0410-82ae-013aeee3265d

bp_bin/assemble_pairs2 [new file with mode: 0755]

diff --git a/bp_bin/assemble_pairs2 b/bp_bin/assemble_pairs2
new file mode 100755 (executable)
index 0000000..bd3c7fa
--- /dev/null
@@ -0,0 +1,80 @@
+#!/usr/bin/env ruby
+
+# Copyright (C) 2007-2013 Martin A. Hansen.
+
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+# http://www.gnu.org/copyleft/gpl.html
+
+# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+
+# This program is part of the Biopieces framework (www.biopieces.org).
+
+# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> DESCRIPTION <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+
+# Assemble ordered overlapping pair-end sequences in the stream.
+
+# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+
+#require 'profile'
+require 'maasha/biopieces'
+require 'maasha/seq'
+require 'maasha/seq/assemble'
+require 'pp'
+
+casts = []
+casts << {:long=>'mismatches',  :short=>'m', :type=>'uint', :mandatory=>false, :default=>10,  :allowed=>nil, :disallowed=>nil}
+casts << {:long=>'overlap_min', :short=>'o', :type=>'uint', :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>"0"}
+casts << {:long=>'overlap_max', :short=>'p', :type=>'uint', :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>"0"}
+
+options = Biopieces.options_parse(ARGV, casts)
+
+entry1 = nil
+entry2 = nil
+
+Biopieces.open(options[:stream_in], options[:stream_out]) do |input, output|
+  input.each_record do |record|
+    if record[:SEQ_NAME] and record[:SEQ] and record[:SCORES]
+      if entry1.nil?
+        entry1 = Seq.new_bp(record)
+      elsif entry2.nil?
+        entry2 = Seq.new_bp(record)
+        entry2.type = :dna
+        entry2.reverse!.complement!
+      end
+
+      if entry1 and entry2
+        merged = Assemble.pair(
+          entry1,
+          entry2,
+          mismatches_max:options[:mismatches],
+          overlap_min:options[:overlap_min],
+          overlap_max:options[:overlap_max]
+        )
+
+        output.puts merged.to_bp if merged
+
+        entry1 = nil
+        entry2 = nil
+      end
+    end
+  end
+end
+
+
+# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+
+
+__END__