]> git.donarmstrong.com Git - biopieces.git/commitdiff
fixed cat_seq
authormartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Mon, 6 Jun 2011 15:21:33 +0000 (15:21 +0000)
committermartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Mon, 6 Jun 2011 15:21:33 +0000 (15:21 +0000)
git-svn-id: http://biopieces.googlecode.com/svn/trunk@1462 74ccb610-7750-0410-82ae-013aeee3265d

bp_bin/cat_seq
bp_test/out/cat_seq.out.1
bp_test/out/cat_seq.out.2 [new file with mode: 0644]
bp_test/out/cat_seq.out.3 [new file with mode: 0644]
bp_test/test/test_cat_seq

index 060b7d567d0b81eaa881ec52032592a968c7e02e..88e9d24fa7e566c1edb01d4844731cf6ebca1699 100755 (executable)
 
 require 'maasha/biopieces'
 
-options = Biopieces.options_parse(ARGV)
+casts = []
+casts << {:long=>'seq_name',  :short=>'s', :type=>'string', :mandatory=>true,  :default=>"cat_seq", :allowed=>nil, :disallowed=>nil}
+casts << {:long=>'no_stream', :short=>'x', :type=>'flag',   :mandatory=>false, :default=>nil,       :allowed=>nil, :disallowed=>nil}
+
+options = Biopieces.options_parse(ARGV, casts)
 
 seq = ""
 
 Biopieces.open(options[:stream_in], options[:stream_out]) do |input, output|
   input.each_record do |record|
     seq << record[:SEQ] if record.has_key? :SEQ
-    output.puts record
+    output.puts record unless options[:no_stream]
   end
 
   new_record            = {}
+  new_record[:SEQ_NAME] = options[:seq_name]
   new_record[:SEQ]      = seq
   new_record[:SEQ_LEN]  = seq.length
   new_record[:REC_TYPE] = "CAT"
index 45481e886f21b35014fdda50892349f7337b5596..b616ca73cc32fea10e643f71654d9f825ab4ed4e 100644 (file)
@@ -10,6 +10,7 @@ SEQ_NAME: test3
 SEQ: TACGATGCTAGCNATCY
 SEQ_LEN: 17
 ---
+SEQ_NAME: cat_seq
 SEQ: TACGATGCTAGCNATCYGACNACTGACTGACNTACGATGCTAGCNATCYGACNACTGTACGATGCTAGCNATCY
 SEQ_LEN: 74
 REC_TYPE: CAT
diff --git a/bp_test/out/cat_seq.out.2 b/bp_test/out/cat_seq.out.2
new file mode 100644 (file)
index 0000000..36b89c6
--- /dev/null
@@ -0,0 +1,5 @@
+SEQ_NAME: cat_seq
+SEQ: TACGATGCTAGCNATCYGACNACTGACTGACNTACGATGCTAGCNATCYGACNACTGTACGATGCTAGCNATCY
+SEQ_LEN: 74
+REC_TYPE: CAT
+---
diff --git a/bp_test/out/cat_seq.out.3 b/bp_test/out/cat_seq.out.3
new file mode 100644 (file)
index 0000000..56f5610
--- /dev/null
@@ -0,0 +1,17 @@
+SEQ_NAME: test1
+SEQ: TACGATGCTAGCNATCYGACNACTGACTGACN
+SEQ_LEN: 32
+---
+SEQ_NAME: test2
+SEQ: TACGATGCTAGCNATCYGACNACTG
+SEQ_LEN: 25
+---
+SEQ_NAME: test3
+SEQ: TACGATGCTAGCNATCY
+SEQ_LEN: 17
+---
+SEQ_NAME: Foobar
+SEQ: TACGATGCTAGCNATCYGACNACTGACTGACNTACGATGCTAGCNATCYGACNACTGTACGATGCTAGCNATCY
+SEQ_LEN: 74
+REC_TYPE: CAT
+---
index 61c570925c960531a3e4b24eb994deff0d49ef25..a5084344ab3f124660869a7ae5a39641a9fd9cbe 100755 (executable)
@@ -5,3 +5,11 @@ source "$BP_DIR/bp_test/lib/test.sh"
 run "$bp -I $in -O $tmp"
 assert_no_diff $tmp $out.1
 clean
+
+run "$bp -I $in -x -O $tmp"
+assert_no_diff $tmp $out.2
+clean
+
+run "$bp -I $in -s Foobar -O $tmp"
+assert_no_diff $tmp $out.3
+clean