mspire 0.1.7 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. data/Rakefile +41 -14
  2. data/bin/bioworks2excel.rb +1 -1
  3. data/bin/bioworks_to_pepxml.rb +46 -59
  4. data/bin/fasta_shaker.rb +1 -1
  5. data/bin/filter.rb +6 -0
  6. data/bin/find_aa_freq.rb +23 -0
  7. data/bin/id_precision.rb +3 -2
  8. data/bin/mzxml_to_lmat.rb +2 -1
  9. data/bin/pepproph_filter.rb +1 -1
  10. data/bin/precision.rb +1 -1
  11. data/bin/protein_summary.rb +2 -451
  12. data/bin/raw_to_mzXML.rb +55 -0
  13. data/bin/srf_group.rb +26 -0
  14. data/changelog.txt +7 -0
  15. data/lib/align.rb +3 -3
  16. data/lib/fasta.rb +6 -1
  17. data/lib/gi.rb +9 -4
  18. data/lib/roc.rb +2 -0
  19. data/lib/sample_enzyme.rb +2 -1
  20. data/lib/spec/mzxml/parser.rb +2 -43
  21. data/lib/spec/mzxml.rb +65 -2
  22. data/lib/spec_id/aa_freqs.rb +10 -7
  23. data/lib/spec_id/bioworks.rb +67 -87
  24. data/lib/spec_id/filter.rb +794 -0
  25. data/lib/spec_id/precision.rb +29 -36
  26. data/lib/spec_id/proph.rb +5 -3
  27. data/lib/spec_id/protein_summary.rb +459 -0
  28. data/lib/spec_id/sequest.rb +323 -271
  29. data/lib/spec_id/srf.rb +189 -135
  30. data/lib/spec_id.rb +276 -227
  31. data/lib/spec_id_xml.rb +101 -0
  32. data/lib/toppred.rb +18 -0
  33. data/script/degenerate_peptides.rb +47 -0
  34. data/script/filter-peps.rb +5 -1
  35. data/test/tc_align.rb +1 -1
  36. data/test/tc_bioworks.rb +25 -22
  37. data/test/tc_bioworks_to_pepxml.rb +37 -4
  38. data/test/tc_fasta.rb +3 -1
  39. data/test/tc_fasta_shaker.rb +8 -6
  40. data/test/tc_filter.rb +203 -0
  41. data/test/tc_gi.rb +6 -9
  42. data/test/tc_id_precision.rb +31 -0
  43. data/test/tc_mzxml.rb +8 -6
  44. data/test/tc_peptide_parent_times.rb +2 -1
  45. data/test/tc_precision.rb +1 -1
  46. data/test/tc_proph.rb +5 -5
  47. data/test/tc_protein_summary.rb +36 -13
  48. data/test/tc_sequest.rb +78 -33
  49. data/test/tc_spec_id.rb +128 -6
  50. data/test/tc_srf.rb +84 -38
  51. metadata +67 -62
  52. data/bin/fasta_cat.rb +0 -39
  53. data/bin/fasta_cat_mod.rb +0 -59
  54. data/bin/fasta_mod.rb +0 -57
  55. data/bin/filter_spec_id.rb +0 -365
  56. data/bin/raw2mzXML.rb +0 -21
  57. data/script/gen_database_searching.rb +0 -258
@@ -0,0 +1,101 @@
1
+
2
+ # I would prefer to call this SpecID::XML, but I keep getting an error:
3
+ # /home/john/Proteomics/msprot/lib/spec_id/bioworks.rb:412: warning: toplevel
4
+ # constant XML referenced by SpecID::XML' This works around that for now.
5
+ # Any major xml elements should return a newline at the end for simple
6
+ # concatenation into a file
7
+ module SpecIDXML
8
+
9
+ Special_chrs_hash = {
10
+ '"' => '"',
11
+ '&' => '&',
12
+ "'" => ''',
13
+ '<' => '&lt;',
14
+ '>' => '&gt;',
15
+ }
16
+
17
+ # substitutes special xml chars
18
+ def escape_special_chars(string)
19
+ string.split('').map do |char|
20
+ if Special_chrs_hash.key? char ; Special_chrs_hash[char]
21
+ # if x = Special_chrs_hash[char] ; x # <-- that's slightly slower
22
+ else ; char end
23
+ end.join
24
+ end
25
+
26
+ $DEPTH = 0
27
+
28
+ def tabs
29
+ # this is ugly
30
+ string = ""
31
+ $DEPTH.times { string << "\t" }
32
+ string
33
+ end
34
+
35
+
36
+ def param_xml(symbol)
37
+ tabs + '<parameter name="' + "#{symbol}" + '" value="' + "#{send(symbol)}" + '"/>'
38
+ end
39
+
40
+ def params_xml(*symbol_list)
41
+ symbol_list.collect { |sy|
42
+ param_xml(sy)
43
+ }.join("\n") + "\n"
44
+ end
45
+
46
+ def short_element_xml(element, att_list)
47
+ "#{tabs}<#{element} #{attrs_xml(att_list)}/>\n"
48
+ end
49
+
50
+ def short_element_xml_and_att_string(element, att_string)
51
+ "#{tabs}<#{element} #{att_string}/>\n"
52
+ end
53
+
54
+ # requires that obj have attribute '@xml_element_name'
55
+ # displays all *instance_variables* (does not call methods!)
56
+ def short_element_xml_from_instance_vars(element_name)
57
+ string = instance_variables.map{|v| "#{v[1..-1]}=\"#{instance_variable_get(v)}\"" }.join(' ')
58
+ "#{tabs}<#{element_name} #{string}/>\n"
59
+ end
60
+
61
+ # takes an element as a symbol and returns the
62
+ def element_xml_no_atts(element)
63
+ start = "#{tabs}<#{element}>\n"
64
+ $DEPTH += 1
65
+ if block_given? ; middle = yield else ; middle = '' end
66
+ $DEPTH -= 1
67
+ start + middle + "#{tabs}</#{element}>\n"
68
+ end
69
+
70
+ # takes an element as a symbol and returns the
71
+ def element_xml(element, att_list)
72
+
73
+ start = "#{tabs}<#{element} #{attrs_xml(att_list)}>\n"
74
+ $DEPTH += 1
75
+ if block_given? ; middle = yield else ; middle = '' end
76
+ $DEPTH -= 1
77
+ start + middle + "#{tabs}</#{element}>\n"
78
+ end
79
+
80
+ # element as symbol and att_string as attributes
81
+ # takes a block of whatever
82
+ def element_xml_and_att_string(element, att_string)
83
+ start = "#{tabs}<#{element} #{att_string}>\n"
84
+ $DEPTH += 1
85
+ if block_given? ; middle = yield else ; middle = '' end
86
+ $DEPTH -= 1
87
+ start + middle + "#{tabs}</#{element}>\n"
88
+ end
89
+
90
+ def attr_xml(symbol)
91
+ "#{symbol}=\"#{send(symbol)}\""
92
+ end
93
+
94
+ def attrs_xml(list_of_symbols)
95
+ list_of_symbols.collect {|sy|
96
+ attr_xml(sy)
97
+ }.join(" ")
98
+ end
99
+
100
+ end
101
+
data/lib/toppred.rb ADDED
@@ -0,0 +1,18 @@
1
+
2
+ # reader for the http://bioweb.pasteur.fr/seqanal/interfaces/toppred.html
3
+ # output
4
+ class TopPred
5
+
6
+ attr_accessor :hmmmm
7
+
8
+ def initialize(toppred_out_file=nil)
9
+ if toppred_out_file
10
+ from_file(toppred_out_file)
11
+ end
12
+ end
13
+
14
+ def from_file(toppred_out_file)
15
+ end
16
+
17
+ end
18
+
@@ -0,0 +1,47 @@
1
+ #!/usr/bin/ruby -w
2
+
3
+ require 'fasta'
4
+ require 'sample_enzyme'
5
+
6
+ if ARGV.size < 3
7
+ puts "usage: #{File.basename(__FILE__)} min_peptide_length missed_cleavages <file>.fasta ..."
8
+ puts " returns <file>.min_pep_length_<#>.missed_cleavages_<#>.degenerate_peptides.csv"
9
+ abort
10
+ end
11
+
12
+
13
+
14
+ min_peptide_length = ARGV.shift.to_i
15
+ missed_cleavages = ARGV.shift.to_i
16
+
17
+ ARGV.each do |file|
18
+ hash = {}
19
+
20
+ if file !~ /\.fasta/
21
+ abort "must be a fasta file with extension fasta"
22
+ end
23
+ new_filename = file.sub(/\.fasta$/, '')
24
+ new_filename << ".min_pep_length_#{min_peptide_length}.missed_cleavages_#{missed_cleavages}.degenerate_peptides.csv"
25
+ peptides = []
26
+ Fasta.new.read_file(file).prots.each do |prot|
27
+
28
+
29
+ SampleEnzyme.tryptic(prot.aaseq, missed_cleavages).each do |aaseq|
30
+ if aaseq.size >= min_peptide_length
31
+ hash[aaseq] ||= []
32
+ hash[aaseq].push( prot.header.sub(/^>/,'') )
33
+ end
34
+ end
35
+ #fh.puts( prot.header.split(/\s+/).first.sub(/^>/,'') + "\t" + SampleEnzyme.tryptic(prot.aaseq, missed_cleavages).join(" ") )
36
+ end
37
+
38
+ File.open(new_filename, "w") do |fh|
39
+ hash.keys.sort_by {|pep| hash[pep].size }.reverse.each do |pep|
40
+ fh.puts( [pep, *(hash[pep])].join("\t") )
41
+ end
42
+ end
43
+ end
44
+
45
+
46
+
47
+
@@ -123,14 +123,18 @@ puts csv_headers.join(DELIMITER)
123
123
  files.each_with_index do |file,i|
124
124
 
125
125
  obj = SpecID.new(file)
126
+ obj.peps = obj.pep_prots
127
+
128
+
126
129
  obj.peps.each do |pep|
127
130
  pep.charge = pep.charge.to_i
128
131
  pep.xcorr = pep.xcorr.to_f
129
132
  pep.deltacn = pep.deltacn.to_f
130
133
  end
134
+
131
135
 
132
136
  re_prefix = /^#{Regexp.escape(prefixes[i])}/
133
- prc = proc {|it| it.prot.reference =~ re_prefix }
137
+ prc = proc {|it| it.prots.first.reference =~ re_prefix }
134
138
  #(match, nomatch) = obj.classify(:peps, prc)
135
139
  (fp, tp) = obj.classify(:peps, prc)
136
140
 
data/test/tc_align.rb CHANGED
@@ -64,7 +64,7 @@ class AlignTest < Test::Unit::TestCase
64
64
  expx2 = [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,1,2,3,4,5,6,7,8,9]
65
65
  expy2 = [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,1,2,3,4,5,6,7,8,9]
66
66
 
67
- pcls = SpecID::Proph::Pep
67
+ pcls = Proph::Pep
68
68
  scls = Spec::Scan
69
69
 
70
70
  pep_groups = [x,y].collect do |arr|
data/test/tc_bioworks.rb CHANGED
@@ -19,33 +19,34 @@ class BioworksTest < Test::Unit::TestCase
19
19
  end
20
20
 
21
21
  def test_bioworks_pep
22
- hash = {:sequence => 0, :mass => 1, :deltamass => 2, :charge => 3, :xcorr => 4, :deltacn => 5, :sp => 6, :rsp => 7, :ions => 8, :count => 9, :tic => 10, :prot => 11, :base_name => 12, :first_scan => 13, :last_scan => 14, :peptide_probability => 15, :file => 16, :_num_prots => 17, :_first_prot => 18}
23
- pep = SpecID::Bioworks::Pep.new(hash)
22
+ hash = {:sequence => 0, :mass => 1, :deltamass => 2, :charge => 3, :xcorr => 4, :deltacn => 5, :sp => 6, :rsp => 7, :ions => 8, :count => 9, :tic => 10, :prots => 11, :base_name => 12, :first_scan => 13, :last_scan => 14, :peptide_probability => 15, :file => 16, :_num_prots => 17, :_first_prot => 18}
23
+ pep = Bioworks::Pep.new(hash)
24
24
  hash.each do |k,v|
25
25
  assert_equal(v, pep.send(k))
26
26
  end
27
27
  end
28
28
 
29
+
29
30
  # NEED TO DEBUG THIS PROB!
30
31
  def test_xml_parsing
31
- obj = SpecID::Bioworks.new(@tf_bioworks_xml_really_small)
32
+ obj = Bioworks.new(@tf_bioworks_xml_really_small)
32
33
  assert_equal(19, obj.prots.size)
33
- #obj = SpecID::Bioworks.new(@tf_bioworks_xml_small)
34
+ #obj = Bioworks.new(@tf_bioworks_xml_small)
34
35
  #assert_equal(106, obj.prots.size)
35
36
  end
36
37
 
37
38
  def Xtest_xml_parsing_speed
38
39
  if File.exist? @tfiles_l
39
- #puts Benchmark.bm {|b|
40
- obj = SpecID::Bioworks.new(@tf_bioworks_xml)
41
- #}
40
+ #puts Benchmark.bm {|b|
41
+ obj = Bioworks.new(@tf_bioworks_xml)
42
+ #}
42
43
  else
43
44
  assert_nil( puts("--SKIPPING TEST-- (missing dir: #{@tfiles_l})") )
44
45
  end
45
46
  end
46
47
 
47
48
  def test_xml_parsing_bioworks_single
48
- obj = SpecID::Bioworks.new(@tf_bioworks_single_xml_small)
49
+ obj = Bioworks.new(@tf_bioworks_single_xml_small)
49
50
  gfn = '5prot_mix_michrom_20fmol_200pmol'
50
51
  origfilename = '5prot_mix_michrom_20fmol_200pmol.RAW'
51
52
  origfilepath = 'C:\Xcalibur\sequest'
@@ -61,17 +62,17 @@ class BioworksTest < Test::Unit::TestCase
61
62
 
62
63
  def test_to_excel
63
64
  tmpfile = @tfiles + "tf_bioworks_to_excel.tmp"
64
- bio = SpecID::Bioworks.new(@tf_bioworks_to_excel)
65
+ bio = Bioworks.new(@tf_bioworks_to_excel)
65
66
  bio.to_excel tmpfile
66
67
  assert( File.exist?(tmpfile) )
67
68
  exp = _arr_of_arrs(@tf_bioworks_to_excel_actual)
68
69
  act = _arr_of_arrs(tmpfile)
69
70
  exp.each_index do |i|
70
71
  break if i == 23 ## this is where the ordering becomes arbitrary between guys with the same scans, but different filenames
71
- _assert_equal_pieces(exp[i], act[i], exp[i][0] =~ /\d/)
72
+ _assert_equal_pieces(exp[i], act[i], exp[i][0] =~ /\d/)
72
73
  end
73
-
74
- File.unlink tmpfile
74
+
75
+ #File.unlink tmpfile
75
76
  end
76
77
 
77
78
  # prot is boolean if this is a protein line!
@@ -85,13 +86,15 @@ class BioworksTest < Test::Unit::TestCase
85
86
  elsif i == 6 && !prot
86
87
  assert_in_delta(exp[i].to_f, act[i].to_f, 0.01)
87
88
  elsif i == 9 && prot
89
+ ## NEED TO GET THESE BACK (for consistency):
88
90
  assert_match(exp[i].split(" ")[0], act[i].split(" ")[0])
89
91
  else
92
+ ## NEED TO GET THESE BACK (for consistency):
90
93
  assert_equal(exp[i], act[i], "#{i} index")
91
94
  end
92
95
  end
93
96
  end
94
-
97
+
95
98
 
96
99
  # takes a bioworks excel (in txt format) and outputs an arr of arrs
97
100
  def _arr_of_arrs(file)
@@ -105,34 +108,34 @@ class BioworksTest < Test::Unit::TestCase
105
108
  cnt = 0
106
109
  answer = [%w(2 PEPTIDE), %w(3 PEPTIDE), %w(3 PEPY), %w(2 PEPY)]
107
110
  exp_peps = answer.collect! do |arr|
108
- pep = SpecID::Bioworks::Pep.new
111
+ pep = Bioworks::Pep.new
109
112
  pep.charge = arr[0]
110
113
  pep.sequence = arr[1]
111
114
  pep
112
115
  end
113
116
  exp_prots = [[0,2],[1,4,5],[3],[6]].collect do |arr|
114
117
  arr.collect do |num|
115
- prot = SpecID::Bioworks::Prot.new
118
+ prot = Bioworks::Prot.new
116
119
  prot.reference = "#{num}"
117
120
  prot
118
121
  end
119
122
  end
120
123
  exp_peps = exp_peps.zip(exp_prots)
121
124
  exp_peps.collect! do |both|
122
- both[0].prot = both[1]
125
+ both[0].prots = [both[1]]
123
126
  both[0]
124
127
  end
125
-
128
+
126
129
  peptides = [%w(2 PEPTIDE), %w(3 PEPTIDE), %w(2 PEPTIDE), %w(3 PEPY), %w(3 PEPTIDE), %w(3 PEPTIDE), %w(2 PEPY)].collect do |arr|
127
- pep = SpecID::Bioworks::Pep.new
130
+ pep = Bioworks::Pep.new
128
131
  pep.charge = arr[0]
129
132
  pep.sequence = arr[1]
130
- pep.prot = SpecID::Bioworks::Prot.new
131
- pep.prot.reference = "#{cnt}"
133
+ pep.prots = [Bioworks::Prot.new]
134
+ pep.prots.first.reference = "#{cnt}"
132
135
  cnt += 1
133
136
  pep
134
137
  end
135
- peptides, proteins = SpecID::Bioworks.new._uniq_peps_by_sequence_charge(peptides)
138
+ peptides, proteins = Bioworks.new._uniq_peps_by_sequence_charge(peptides)
136
139
  assert_equal(peptides.size, proteins.size)
137
140
  exp_peps.each_with_index do |pep, i|
138
141
  assert_equal(pep.charge, peptides[i].charge)
@@ -147,7 +150,7 @@ class BioworksTest < Test::Unit::TestCase
147
150
  end
148
151
 
149
152
  def test_extract_file_info
150
- pep = SpecID::Bioworks::Pep.new
153
+ pep = Bioworks::Pep.new
151
154
  testing = ['005a, 1131', '005b, 1131 - 1133', '1131', '1131 - 1133']
152
155
  answers = [%w(005a 1131 1131), %w(005b 1131 1133), [nil, '1131', '1131'], [nil, '1131', '1133']]
153
156
  testing.zip(answers) do |ar|
@@ -3,6 +3,22 @@ require 'test/unit'
3
3
  require File.dirname(File.expand_path(__FILE__)) + '/load_bin_path'
4
4
  require 'fileutils'
5
5
 
6
+ tmp = $VERBOSE
7
+ $VERBOSE = 5
8
+
9
+ $XML_SANITY_LINES = ['<sample_enzyme name="trypsin">', '<specificity cut="KR" no_cut="P" sense="C"/>', '<parameter name="diff_search_options" value="0.000000 S 0.000000 C 0.000000 M 0.000000 X 0.000000 T 0.000000 Y"/>']
10
+
11
+ $XML_SANITY_MATCHES = [/<spectrum_query spectrum="0\d0.\d+.\d+.[123]" start_scan="\d+" end_scan="\d+" precursor_neutral_mass="[\d\.]+" assumed_charge="[123]" index="\d+">/,
12
+ / <search_hit hit_rank="\d" peptide="[\w\-\.]+" peptide_prev_aa="." peptide_next_aa="." protein=".*" num_tot_proteins="\d+" num_matched_ions="\d+" tot_num_ions="\d+" calc_neutral_pep_mass="[\d\.]+" massdiff="[\+\-][\d\.]+" num_tol_term="\d" num_missed_cleavages="\d" is_rejected="[01]">/,
13
+ /<search_score name="xcorr" value="[\d\.]+"\/>/,
14
+ /<search_score name="deltacn" value="[\d\.]+"\/>/,
15
+ /<search_score name="deltacnstar" value="[01]"\/>/,
16
+ /<search_score name="spscore" value="[\d\.]+"\/>/,
17
+ /<search_score name="sprank" value="\d+"\/>/,
18
+ ]
19
+
20
+
21
+
6
22
 
7
23
  class BioworksToPepXMLTest < Test::Unit::TestCase
8
24
 
@@ -13,7 +29,7 @@ class BioworksToPepXMLTest < Test::Unit::TestCase
13
29
  @tf_mzxml_path = @tfiles_l + "yeast_gly_mzXML"
14
30
  @tf_bioworks_xml = @tfiles + "bioworks_small.xml"
15
31
  @tf_params = @tfiles + "bioworks32.params"
16
- @no_delete = false
32
+ @no_delete = true
17
33
  @out_path = @tfiles + 'pepxml/'
18
34
  @cmd = "ruby -I#{File.join(File.dirname(__FILE__), "..", "lib")} -S bioworks_to_pepxml.rb "
19
35
  end
@@ -23,8 +39,9 @@ class BioworksToPepXMLTest < Test::Unit::TestCase
23
39
  end
24
40
 
25
41
  def _basic(cmd, prc)
26
- puts "Performing: #{cmd}"
27
- puts `#{cmd}`
42
+ puts "Performing: #{cmd}" if $VERBOSE
43
+ reply = `#{cmd}`
44
+ puts reply if $VERBOSE
28
45
  %w(000 020).each do |file|
29
46
  ffile = @out_path + file + ".xml"
30
47
  prc.call(ffile)
@@ -33,11 +50,25 @@ class BioworksToPepXMLTest < Test::Unit::TestCase
33
50
 
34
51
  def test_basic
35
52
  if File.exist? @tfiles_l
36
- cmd = "#{@cmd} -p #{@tf_params} -o #{@out_path} #{@tf_bioworks_xml} -m #{@tf_mzxml_path} -d /work/special/path"
53
+ cmd = "#{@cmd} -p #{@tf_params} -o #{@out_path} #{@tf_bioworks_xml} -m #{@tf_mzxml_path} -d /work/special/path --copy_mzxml"
54
+ ## FILES EXIST:
37
55
  prc = proc {|file|
38
56
  assert(File.exist?(file), "#{file} exists")
57
+ beginning = IO.readlines(file)[0,50].join("\n")
58
+ $XML_SANITY_LINES.each do |line|
59
+ assert(beginning.include?(line), "xml includes line: #{line}")
60
+ end
61
+ $XML_SANITY_MATCHES.each do |match|
62
+ assert_match(match, beginning, "matches")
63
+ end
39
64
  }
40
65
  _basic(cmd, prc)
66
+ ## COPY MZXML:
67
+ %w(000 020).each do |file|
68
+ mzxml_file = File.join(@out_path, "#{file}.mzXML")
69
+ assert(File.exist?( mzxml_file ), "file: #{mzxml_file} exists")
70
+ end
71
+ ## CLEANUP:
41
72
  unless @no_delete then FileUtils.rm_rf(@out_path) end
42
73
  else
43
74
  assert_nil( puts("--SKIPPING TEST-- (missing dir: #{@tfiles_l})") )
@@ -60,3 +91,5 @@ class BioworksToPepXMLTest < Test::Unit::TestCase
60
91
  end
61
92
  end
62
93
  end
94
+
95
+ $VERBOSE = tmp
data/test/tc_fasta.rb CHANGED
@@ -26,7 +26,6 @@ class FastaTest < Test::Unit::TestCase
26
26
  @inv_ext = Fasta::INV_FILE_POSTFIX
27
27
 
28
28
  @tfiles = File.dirname(__FILE__) + '/tfiles/'
29
- @tmpfile = @tfiles + "tmp.tmp"
30
29
  @base_cmd = "ruby -I #{File.join(File.dirname(__FILE__), "..", "lib")} -S "
31
30
  @fasta_mod_cmd = @base_cmd + "fasta_mod.rb "
32
31
  @fasta_cat_mod_cmd = @base_cmd + "fasta_cat_mod.rb "
@@ -41,6 +40,7 @@ class FastaTest < Test::Unit::TestCase
41
40
 
42
41
  def test_read_file
43
42
  obj = Fasta.new.read_file(@sf)
43
+ @tmpfile = @tfiles + "tmp.tmp"
44
44
  obj.write_file(@tmpfile)
45
45
  assert_not_equal_file_content(@tmpfile, @sf)
46
46
  obj2 = Fasta.new.read_file(@tmpfile)
@@ -74,6 +74,7 @@ class FastaTest < Test::Unit::TestCase
74
74
  assert('f1__f2.ext1', Fasta.cat_filenames(['f1.ext1', 'f2.ext2'], '__'))
75
75
  end
76
76
 
77
+ =begin
77
78
  def test_mod
78
79
  ## Testing shuffle:
79
80
  `#{@fasta_mod_cmd + 'shuffle ' + @sf}`
@@ -105,6 +106,7 @@ class FastaTest < Test::Unit::TestCase
105
106
  assert_equal(ob1.prots.size, IO.read(@sf_invert).scan(/>_HELLO_/).size)
106
107
  File.unlink(@sf_invert)
107
108
  end
109
+ =end
108
110
 
109
111
  def test_gi
110
112
  gis = ['>gi|7427923|pir||PHRBG glycogen phosphorylase (EC 2.4.1.1), muscle - rabbit', '>sp|lollygag|helloyou', '>only has one bar | and thats it', 'notme|me|nome', '>lots|an|lots|of|bars|heehee']
@@ -1,6 +1,7 @@
1
1
 
2
2
  require 'test/unit'
3
3
  require 'fasta'
4
+ require File.dirname(__FILE__) + '/load_bin_path.rb'
4
5
 
5
6
  Filestring = ">gi|P1
6
7
  AMKRGAN
@@ -55,13 +56,13 @@ class TestBasic < Test::Unit::TestCase
55
56
  File.unlink @f if File.exist? @f
56
57
  end
57
58
 
58
- def test_reverse
59
+ def Xtest_reverse
59
60
  cmd = @cmd + "reverse #{@tmpfile} -o #{@f}"
60
61
  system cmd
61
62
  assert_equal(Rev, fastap(@f).to_s)
62
63
  end
63
64
 
64
- def test_reverse_tryptic
65
+ def Xtest_reverse_tryptic
65
66
  cmd = @cmd + "reverse #{@tmpfile} -o #{@f} --tryptic_peptides"
66
67
  system cmd
67
68
  assert_equal(RevTryptic, fastap(@f).to_s)
@@ -69,6 +70,7 @@ class TestBasic < Test::Unit::TestCase
69
70
 
70
71
  def test_shuff_tryptic
71
72
  cmd = @cmd + "shuffle #{@tmpfile} -o #{@f} --tryptic_peptides"
73
+
72
74
  system cmd
73
75
  lns = fastap(@f).to_s.split("\n")
74
76
  assert_equal('KR', lns[1][2..3])
@@ -77,7 +79,7 @@ class TestBasic < Test::Unit::TestCase
77
79
  assert_not_equal('CRGATKKTAGRPMEK', lns[3], "sequence is randomised from original [remote chance of failure] rerun to make sure")
78
80
  end
79
81
 
80
- def test_shuffle
82
+ def Xtest_shuffle
81
83
  cmd = @cmd + "shuffle #{@tmpfile} -o #{@f}"
82
84
  system cmd
83
85
  clines = strlns(Filestring)
@@ -89,7 +91,7 @@ class TestBasic < Test::Unit::TestCase
89
91
  assert_not_equal('CRGATKKTAGRPMEK', lns[3], "sequence is randomised from original [remote chance of failure] rerun to make sure")
90
92
  end
91
93
 
92
- def test_cat
94
+ def Xtest_cat
93
95
  cmd = @cmd + "reverse #{@tmpfile} -c -o #{@f}"
94
96
  `#{cmd}` ## suppress warning
95
97
  lns = fastalns(@f)
@@ -97,7 +99,7 @@ class TestBasic < Test::Unit::TestCase
97
99
  assert_equal(strlns(Rev), lns[6..-1], "second part equal")
98
100
  end
99
101
 
100
- def test_fraction
102
+ def Xtest_fraction
101
103
  cmd = @cmd + "reverse #{@tmpfile} -f 2.6 -o #{@f}"
102
104
  `#{cmd}`
103
105
  assert_equal(8, fastap(@f).size)
@@ -118,7 +120,7 @@ class TestBasic < Test::Unit::TestCase
118
120
  #cmd = @cmd + "reverse #{@tmpfile} -c -f 2.0 -o #{@f}"
119
121
  end
120
122
 
121
- def test_prefix
123
+ def Xtest_prefix
122
124
  cmd = @cmd + "reverse #{@tmpfile} -p SILLY_ -o #{@f}"
123
125
  `#{cmd}`
124
126
  fp = fastap(@f)