]> git.donarmstrong.com Git - biopieces.git/commitdiff
updated pcr_seq and added tests
authormartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Fri, 4 Jan 2013 10:23:15 +0000 (10:23 +0000)
committermartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Fri, 4 Jan 2013 10:23:15 +0000 (10:23 +0000)
git-svn-id: http://biopieces.googlecode.com/svn/trunk@2054 74ccb610-7750-0410-82ae-013aeee3265d

bp_bin/pcr_seq
bp_test/in/pcr_seq.in [new file with mode: 0644]
bp_test/out/pcr_seq.out.1 [new file with mode: 0644]
bp_test/out/pcr_seq.out.2 [new file with mode: 0644]
bp_test/out/pcr_seq.out.3 [new file with mode: 0644]
bp_test/out/pcr_seq.out.4 [new file with mode: 0644]
bp_test/out/pcr_seq.out.5 [new file with mode: 0644]
bp_test/test/test_pcr_seq [new file with mode: 0755]

index f54577373e75f7f32f24752c3a54ff31eaedafa8..8700276e16287559ed9fe37f1d33b8c26c382e7a 100755 (executable)
@@ -51,6 +51,7 @@ class Pcr
 
       command =  "scan_for_matches"
       # command << " -c"
+      command << " -o 1"
       command << " #{pat_file}"
       command << " < #{@infile}"
       command << " > #{outfile}"
@@ -152,14 +153,25 @@ class Pattern
 end
 
 casts = []
-casts << {:long=>'forward',  :short=>'f', :type=>'string', :mandatory=>true, :default=>nil,  :allowed=>nil, :disallowed=>nil}
-casts << {:long=>'reverse',  :short=>'r', :type=>'string', :mandatory=>true, :default=>nil,  :allowed=>nil, :disallowed=>nil}
-casts << {:long=>'max_dist', :short=>'m', :type=>'uint',   :mandatory=>true, :default=>5000, :allowed=>nil, :disallowed=>"0"}
+casts << {:long=>'forward',    :short=>'f', :type=>'string', :mandatory=>false, :default=>nil,  :allowed=>nil, :disallowed=>nil}
+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"}
 
 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
+end
+
+if options[:reverse_rc]
+  options[:reverse] = Seq.new("test", options[:reverse_rc], 'dna').revcomp.seq
+end
+
+raise ArgumentError, "no adaptor specified" unless options[:forward] or options[:reverse]
 Biopieces.open(options[:stream_in], options[:stream_out]) do |input, output|
   Fasta.open(infile, mode="w") do |ios|
     input.each_record do |record|
diff --git a/bp_test/in/pcr_seq.in b/bp_test/in/pcr_seq.in
new file mode 100644 (file)
index 0000000..7dbdf89
--- /dev/null
@@ -0,0 +1,16 @@
+SEQ_NAME: forward_reverse
+SEQ: tgCGATCGAGCTactagctagctatcatcgatctgAGTCAGTCATct
+SEQ_LEN: 47
+---
+SEQ_NAME: forward_RCforward
+SEQ: tgCGATCGAGCTactagctagctatcatcgatctgAGCTCGATCGct
+SEQ_LEN: 47
+---
+SEQ_NAME: RCreverse_reverse
+SEQ: tgATGACTGACTactagctagctatcatcgatctgAGTCAGTCATct
+SEQ_LEN: 47
+---
+SEQ_NAME: RCreverse_RCforward
+SEQ: tgATGACTGACTactagctagctatcatcgatctgAGCTCGATCGct
+SEQ_LEN: 47
+---
diff --git a/bp_test/out/pcr_seq.out.1 b/bp_test/out/pcr_seq.out.1
new file mode 100644 (file)
index 0000000..263bc98
--- /dev/null
@@ -0,0 +1,52 @@
+SEQ_NAME: forward_reverse
+SEQ: tgCGATCGAGCTactagctagctatcatcgatctgAGTCAGTCATct
+SEQ_LEN: 47
+---
+SEQ_NAME: forward_RCforward
+SEQ: tgCGATCGAGCTactagctagctatcatcgatctgAGCTCGATCGct
+SEQ_LEN: 47
+---
+SEQ_NAME: RCreverse_reverse
+SEQ: tgATGACTGACTactagctagctatcatcgatctgAGTCAGTCATct
+SEQ_LEN: 47
+---
+SEQ_NAME: RCreverse_RCforward
+SEQ: tgATGACTGACTactagctagctatcatcgatctgAGCTCGATCGct
+SEQ_LEN: 47
+---
+SEQ_NAME: forward_reverse
+SEQ: CGATCGAGCTactagctagctatcatcgatctgAGTCAGTCAT
+SEQ_LEN: 43
+REC_TYPE: PCR
+STRAND: +
+TYPE: FORWARD_REVERSE
+PCR_BEG: 3
+PCR_END: 45
+---
+SEQ_NAME: forward_RCforward
+SEQ: CGATCGAGCTactagctagctatcatcgatctgAGCTCGATCG
+SEQ_LEN: 43
+REC_TYPE: PCR
+STRAND: +
+TYPE: FORWARD_FORWARD
+PCR_BEG: 3
+PCR_END: 45
+---
+SEQ_NAME: RCreverse_reverse
+SEQ: ATGACTGACTactagctagctatcatcgatctgAGTCAGTCAT
+SEQ_LEN: 43
+REC_TYPE: PCR
+STRAND: +
+TYPE: REVERSE_REVERSE
+PCR_BEG: 3
+PCR_END: 45
+---
+SEQ_NAME: RCreverse_RCforward
+SEQ: ATGACTGACTactagctagctatcatcgatctgAGCTCGATCG
+SEQ_LEN: 43
+REC_TYPE: PCR
+STRAND: +
+TYPE: REVERSE_FORWARD
+PCR_BEG: 3
+PCR_END: 45
+---
diff --git a/bp_test/out/pcr_seq.out.2 b/bp_test/out/pcr_seq.out.2
new file mode 100644 (file)
index 0000000..7dbdf89
--- /dev/null
@@ -0,0 +1,16 @@
+SEQ_NAME: forward_reverse
+SEQ: tgCGATCGAGCTactagctagctatcatcgatctgAGTCAGTCATct
+SEQ_LEN: 47
+---
+SEQ_NAME: forward_RCforward
+SEQ: tgCGATCGAGCTactagctagctatcatcgatctgAGCTCGATCGct
+SEQ_LEN: 47
+---
+SEQ_NAME: RCreverse_reverse
+SEQ: tgATGACTGACTactagctagctatcatcgatctgAGTCAGTCATct
+SEQ_LEN: 47
+---
+SEQ_NAME: RCreverse_RCforward
+SEQ: tgATGACTGACTactagctagctatcatcgatctgAGCTCGATCGct
+SEQ_LEN: 47
+---
diff --git a/bp_test/out/pcr_seq.out.3 b/bp_test/out/pcr_seq.out.3
new file mode 100644 (file)
index 0000000..ca89353
--- /dev/null
@@ -0,0 +1,25 @@
+SEQ_NAME: forward_reverse
+SEQ: tgCGATCGAGCTactagctagctatcatcgatctgAGTCAGTCATct
+SEQ_LEN: 47
+---
+SEQ_NAME: forward_RCforward
+SEQ: tgCGATCGAGCTactagctagctatcatcgatctgAGCTCGATCGct
+SEQ_LEN: 47
+---
+SEQ_NAME: RCreverse_reverse
+SEQ: tgATGACTGACTactagctagctatcatcgatctgAGTCAGTCATct
+SEQ_LEN: 47
+---
+SEQ_NAME: RCreverse_RCforward
+SEQ: tgATGACTGACTactagctagctatcatcgatctgAGCTCGATCGct
+SEQ_LEN: 47
+---
+SEQ_NAME: RCreverse_reverse
+SEQ: ATGACTGACTactagctagctatcatcgatctgAGTCAGTCAT
+SEQ_LEN: 43
+REC_TYPE: PCR
+STRAND: +
+TYPE: REVERSE_REVERSE
+PCR_BEG: 3
+PCR_END: 45
+---
diff --git a/bp_test/out/pcr_seq.out.4 b/bp_test/out/pcr_seq.out.4
new file mode 100644 (file)
index 0000000..9cc0964
--- /dev/null
@@ -0,0 +1,25 @@
+SEQ_NAME: forward_reverse
+SEQ: tgCGATCGAGCTactagctagctatcatcgatctgAGTCAGTCATct
+SEQ_LEN: 47
+---
+SEQ_NAME: forward_RCforward
+SEQ: tgCGATCGAGCTactagctagctatcatcgatctgAGCTCGATCGct
+SEQ_LEN: 47
+---
+SEQ_NAME: RCreverse_reverse
+SEQ: tgATGACTGACTactagctagctatcatcgatctgAGTCAGTCATct
+SEQ_LEN: 47
+---
+SEQ_NAME: RCreverse_RCforward
+SEQ: tgATGACTGACTactagctagctatcatcgatctgAGCTCGATCGct
+SEQ_LEN: 47
+---
+SEQ_NAME: forward_RCforward
+SEQ: CGATCGAGCTactagctagctatcatcgatctgAGCTCGATCG
+SEQ_LEN: 43
+REC_TYPE: PCR
+STRAND: +
+TYPE: FORWARD_FORWARD
+PCR_BEG: 3
+PCR_END: 45
+---
diff --git a/bp_test/out/pcr_seq.out.5 b/bp_test/out/pcr_seq.out.5
new file mode 100644 (file)
index 0000000..7dbdf89
--- /dev/null
@@ -0,0 +1,16 @@
+SEQ_NAME: forward_reverse
+SEQ: tgCGATCGAGCTactagctagctatcatcgatctgAGTCAGTCATct
+SEQ_LEN: 47
+---
+SEQ_NAME: forward_RCforward
+SEQ: tgCGATCGAGCTactagctagctatcatcgatctgAGCTCGATCGct
+SEQ_LEN: 47
+---
+SEQ_NAME: RCreverse_reverse
+SEQ: tgATGACTGACTactagctagctatcatcgatctgAGTCAGTCATct
+SEQ_LEN: 47
+---
+SEQ_NAME: RCreverse_RCforward
+SEQ: tgATGACTGACTactagctagctatcatcgatctgAGCTCGATCGct
+SEQ_LEN: 47
+---
diff --git a/bp_test/test/test_pcr_seq b/bp_test/test/test_pcr_seq
new file mode 100755 (executable)
index 0000000..c04bfe2
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+source "$BP_DIR/bp_test/lib/test.sh"
+
+run "$bp -f CGATCGAGCT -r AGTCAGTCAT -I $in -O $tmp"
+assert_no_diff $tmp $out.1
+clean
+
+run "$bp -f CGATCGAGCT -r AGTCAGTCAT -m 1 -I $in -O $tmp"
+assert_no_diff $tmp $out.2
+clean
+
+run "$bp -F CGATCGAGCT -r AGTCAGTCAT -I $in -O $tmp"
+assert_no_diff $tmp $out.3
+clean
+
+run "$bp -f CGATCGAGCT -R AGTCAGTCAT -I $in -O $tmp"
+assert_no_diff $tmp $out.4
+clean
+
+run "$bp -F CGATCGAGCT -R AGTCAGTCAT -I $in -O $tmp"
+assert_no_diff $tmp $out.5
+clean