]> git.donarmstrong.com Git - biopieces.git/commitdiff
add tests for analyze_seq
authormartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Fri, 15 Oct 2010 09:17:51 +0000 (09:17 +0000)
committermartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Fri, 15 Oct 2010 09:17:51 +0000 (09:17 +0000)
git-svn-id: http://biopieces.googlecode.com/svn/trunk@1136 74ccb610-7750-0410-82ae-013aeee3265d

bp_bin/analyze_seq
bp_test/in/analyze_seq.in [new file with mode: 0644]
bp_test/out/analyze_seq.out.1 [new file with mode: 0644]
bp_test/test/test_analyze_seq [new file with mode: 0755]
code_ruby/Maasha/lib/seq.rb

index 81ad0e16aa20393fad2662eb930c950e97d81822..f79d94a92134882b25584e65feccaccfc4be9882 100755 (executable)
@@ -31,6 +31,7 @@
 
 require 'biopieces'
 require 'seq'
+require 'pp'
 
 casts = []
 
@@ -44,18 +45,19 @@ bp.each_record do |record|
     comp = seq.composition
 
     comp.each_pair do |key,val|
-      record["RES_#{key}"] = val
+      record["RES[#{key}]"] = val
     end
 
-    record["HARD_MASK"] = seq.hard_mask
-    record["SOFT_MASK"] = seq.soft_mask
-    record["GC"]        = ((comp["G"] + comp["C"]).to_f / (seq.len - seq.indels).to_f * 100.0).round(2)
+    record["SOFT_MASK%"] = seq.soft_mask
+    record["HARD_MASK%"] = (comp["N"].to_f / (seq.len - seq.indels).to_f * 100.0).round(2)
+    record["GC%"]        = ((comp["G"] + comp["C"]).to_f / (seq.len - seq.indels).to_f * 100.0).round(2)
   end
 
   bp.puts record
 end
 
 
+
 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
 
 
diff --git a/bp_test/in/analyze_seq.in b/bp_test/in/analyze_seq.in
new file mode 100644 (file)
index 0000000..f956b3f
--- /dev/null
@@ -0,0 +1,4 @@
+SEQ_NAME: test1
+SEQ: ATCGNatcgn-._~
+SEQ_LEN: 14
+---
diff --git a/bp_test/out/analyze_seq.out.1 b/bp_test/out/analyze_seq.out.1
new file mode 100644 (file)
index 0000000..8812816
--- /dev/null
@@ -0,0 +1,16 @@
+SEQ_NAME: test1
+SEQ: ATCGNatcgn-._~
+SEQ_LEN: 14
+RES[A]: 2
+RES[T]: 2
+RES[C]: 2
+RES[G]: 2
+RES[N]: 2
+RES[-]: 1
+RES[.]: 1
+RES[_]: 1
+RES[~]: 1
+SOFT_MASK%: 50.0
+HARD_MASK%: 20.0
+GC%: 40.0
+---
diff --git a/bp_test/test/test_analyze_seq b/bp_test/test/test_analyze_seq
new file mode 100755 (executable)
index 0000000..61c5709
--- /dev/null
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+source "$BP_DIR/bp_test/lib/test.sh"
+
+run "$bp -I $in -O $tmp"
+assert_no_diff $tmp $out.1
+clean
index 039c4cec0265ee8c4c711fef2c4d6ef5a49ce72f..a8decdb09d00643a3e38c85d6a22ec1c182cc8ec 100644 (file)
@@ -2,7 +2,7 @@
 DNA     = %w[a t c g]
 RNA     = %w[a u c g]
 PROTEIN = %w[f l s y c w p h q r i m t n k v a d e g]
-INDELS  = %w[.- _ ~]
+INDELS  = %w[. - _ ~]
 
 # Quality scores bases
 SCORE_PHRED    = 33