Permalink
Browse files

add another test, accept mismatches argument in ipcress runner

  • Loading branch information...
1 parent dbe2afb commit 80ce136db19a483b24fe05fc6c2208dccbc053a0 Ben J. Woodcroft committed Jun 26, 2012
Showing with 61 additions and 2 deletions.
  1. +8 −2 lib/bio/appl/ipcress.rb
  2. +44 −0 test/data/Ipcress/Methanocella_conradii_16s_2_sequences.fa
  3. +9 −0 test/test_bio-ipcress.rb
View
@@ -70,6 +70,7 @@ def self.parse(ipcress_output_string)
# ** :min_distance: the minimum length of product to be amplified (default 100)
# ** :max_distance: the maxmimum length of product to be amplified (default 1000)
# ** :ipcress_path: path the ipcress executable (default 'ipcress')
+ # ** :mismatches: number of mismatches allowable (-m parameter to ipcress binary, default 0)
#
# Return an array of parsed Result objects
def self.run(primer_set, fasta_file, options={})
@@ -85,9 +86,14 @@ def self.run(primer_set, fasta_file, options={})
command = [
options[:ipcress_path],
- tempfile.path,
- fasta_file,
]
+ if options[:mismatches]
+ command.push '-m'
+ command.push options[:mismatches].to_s
+ end
+ command.push tempfile.path
+ command.push fasta_file
+
Bio::Command.call_command_open3(command) do |stdin, stdout, stderr|
out = stdout.read
raise stderr.read if out == '' #if there is a problem running ipcress e.g. the fasta file isn't found
@@ -0,0 +1,44 @@
+>gi|335929284|gb|JN048683.1| Methanocella conradii HZ254 16S ribosomal RNA gene, partial sequence
+GGTCACTGCTATCGGTGTCCGATTAAGCCATGCGAGTCGTGAGGGGTGAGCCCTCGGCGTACTGCTCAGT
+AACACGTGGACAATCTGCCCAAAAGTCCGGGATAACCCCGGGAAACTGGGGATAATACCGGATAGGCCAC
+CAATTGCTGGAATGGCCTGGTGGTTGAAACGAGAGGCTTTTGGATGGGTCTGCGGCGGATTAGGTTGACG
+CCGGTGTAACGTACCGGCGTGCCTGTAATCCGTACGGGTTGTGGGAGCAAGAGCCCGGAGATGGATTCTG
+AGACACGAATCCAGGCCCTACGGGGCGCAGCAGGCGCGAAAACTCTACAATGCAGGCAATCTGCGATAGG
+GGGACATCGAGTG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G
+TCAGTATGCCCCGAATATCCCGGGCTACACGCGGGCTACAATGGACAGGACAATGGGTAACAACACCGAG
+AGGTGAAGTTAATCTCTTAAACCTGTCCCTAGTTCGGATTGAGGGCTGAAACCCGCCCTCATGAAGATGG
+AATCCGTAGTAATCGCATTTCAAAACAGTGCGGTGAATACGTCCCTGCTCCTTGCACACACCGCCCGTCA
+AACCACCCGAGCGGGGCGTGAATAAGGACTCTTTTCCTTGAAGAGCTCGAATTCACGTTCTGTAAGGGGG
+GTTAAGTCGTAACAAGGTAGCC
View
@@ -165,5 +165,14 @@ class TestBioIpcress < Test::Unit::TestCase
Bio::Ipcress.run(Bio::Ipcress::PrimerSet.new('GGTCACTGCTA','GGCTACCTTGTTACGACTTAAC'), 'notafasta_file_fo_so.fa')
end
end
+
+ should "run with multiple hits" do
+ primer_set = Bio::Ipcress::PrimerSet.new('GGTCACTGCTA','GGCTACCTTGTTACGACTTAAC') #the first and last bits of the Methanocella_conradii_16s.fa
+ results = Bio::Ipcress.run(primer_set, File.join(DATA_DIR, 'Methanocella_conradii_16s_2_sequences.fa'), {:min_distance => 2, :max_distance => 10000})
+ assert_equal 2, results.length
+ assert_equal 'ID1', results[0].experiment_name
+ assert_equal 'gi|335929284|gb|JN048683.1|:filter(unmasked) Methanocella conradii HZ254 16S ribosomal RNA gene, partial sequence', results[0].target
+ assert_equal '2nd:filter(unmasked)', results[1].target
+ end
end

0 comments on commit 80ce136

Please sign in to comment.