bio 1.3.0 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. data/COPYING +56 -0
  2. data/COPYING.ja +51 -0
  3. data/ChangeLog +540 -0
  4. data/GPL +340 -0
  5. data/LEGAL +141 -0
  6. data/LGPL +504 -0
  7. data/README.rdoc +4 -2
  8. data/Rakefile +2 -2
  9. data/bioruby.gemspec +17 -29
  10. data/doc/Tutorial.rd +118 -90
  11. data/doc/Tutorial.rd.html +124 -87
  12. data/lib/bio/appl/blast.rb +2 -2
  13. data/lib/bio/appl/blast/format0.rb +1 -1
  14. data/lib/bio/appl/fasta.rb +5 -12
  15. data/lib/bio/appl/fasta/format10.rb +96 -6
  16. data/lib/bio/appl/gcg/msf.rb +11 -14
  17. data/lib/bio/appl/pts1.rb +0 -4
  18. data/lib/bio/appl/sim4/report.rb +50 -17
  19. data/lib/bio/db/biosql/biosql_to_biosequence.rb +10 -0
  20. data/lib/bio/db/biosql/sequence.rb +234 -298
  21. data/lib/bio/db/embl/embl.rb +0 -3
  22. data/lib/bio/db/genbank/common.rb +3 -1
  23. data/lib/bio/io/biosql/ar-biosql.rb +257 -0
  24. data/lib/bio/io/biosql/biosql.rb +39 -0
  25. data/lib/bio/io/biosql/config/database.yml +5 -4
  26. data/lib/bio/io/ncbirest.rb +12 -5
  27. data/lib/bio/io/pubmed.rb +5 -1
  28. data/lib/bio/io/sql.rb +43 -150
  29. data/lib/bio/sequence/compat.rb +5 -1
  30. data/lib/bio/util/restriction_enzyme/range/sequence_range/calculated_cuts.rb +6 -4
  31. data/lib/bio/version.rb +1 -1
  32. data/test/data/gcg/pileup-aa.msf +67 -0
  33. data/test/data/sim4/complement-A4.sim4 +43 -0
  34. data/test/data/sim4/simple-A4.sim4 +25 -0
  35. data/test/data/sim4/simple2-A4.sim4 +25 -0
  36. data/test/functional/bio/io/test_pubmed.rb +129 -0
  37. data/test/unit/bio/appl/bl2seq/test_report.rb +5 -5
  38. data/test/unit/bio/appl/gcg/test_msf.rb +154 -0
  39. data/test/unit/bio/appl/hmmer/test_report.rb +2 -2
  40. data/test/unit/bio/appl/sim4/test_report.rb +869 -0
  41. data/test/unit/bio/appl/test_blast.rb +1 -1
  42. data/test/unit/bio/db/biosql/tc_biosql.rb +110 -0
  43. data/test/unit/bio/db/biosql/ts_suite_biosql.rb +8 -0
  44. data/test/unit/bio/test_feature.rb +18 -17
  45. data/test/unit/bio/test_reference.rb +18 -18
  46. data/test/unit/bio/test_sequence.rb +1 -1
  47. metadata +18 -30
  48. data/lib/bio/io/biosql/biodatabase.rb +0 -64
  49. data/lib/bio/io/biosql/bioentry.rb +0 -29
  50. data/lib/bio/io/biosql/bioentry_dbxref.rb +0 -11
  51. data/lib/bio/io/biosql/bioentry_path.rb +0 -12
  52. data/lib/bio/io/biosql/bioentry_qualifier_value.rb +0 -10
  53. data/lib/bio/io/biosql/bioentry_reference.rb +0 -10
  54. data/lib/bio/io/biosql/bioentry_relationship.rb +0 -10
  55. data/lib/bio/io/biosql/biosequence.rb +0 -11
  56. data/lib/bio/io/biosql/comment.rb +0 -7
  57. data/lib/bio/io/biosql/dbxref.rb +0 -13
  58. data/lib/bio/io/biosql/dbxref_qualifier_value.rb +0 -12
  59. data/lib/bio/io/biosql/location.rb +0 -32
  60. data/lib/bio/io/biosql/location_qualifier_value.rb +0 -11
  61. data/lib/bio/io/biosql/ontology.rb +0 -10
  62. data/lib/bio/io/biosql/reference.rb +0 -9
  63. data/lib/bio/io/biosql/seqfeature.rb +0 -32
  64. data/lib/bio/io/biosql/seqfeature_dbxref.rb +0 -11
  65. data/lib/bio/io/biosql/seqfeature_path.rb +0 -11
  66. data/lib/bio/io/biosql/seqfeature_qualifier_value.rb +0 -20
  67. data/lib/bio/io/biosql/seqfeature_relationship.rb +0 -11
  68. data/lib/bio/io/biosql/taxon.rb +0 -12
  69. data/lib/bio/io/biosql/taxon_name.rb +0 -9
  70. data/lib/bio/io/biosql/term.rb +0 -27
  71. data/lib/bio/io/biosql/term_dbxref.rb +0 -11
  72. data/lib/bio/io/biosql/term_path.rb +0 -12
  73. data/lib/bio/io/biosql/term_relationship.rb +0 -13
  74. data/lib/bio/io/biosql/term_relationship_term.rb +0 -11
  75. data/lib/bio/io/biosql/term_synonym.rb +0 -10
@@ -37,7 +37,11 @@ class Sequence
37
37
 
38
38
  module Common
39
39
 
40
- # *DEPRECIATED* Do not use! Use Bio::Sequence#output instead.
40
+ # <b>Bio::Sequence#to_fasta is DEPRECIATED</b>
41
+ # Do not use Bio::Sequence#to_fasta ! Use Bio::Sequence#output instead.
42
+ # Note that Bio::Sequence::NA#to_fasta, Bio::Sequence::AA#to_fasata,
43
+ # and Bio::Sequence::Generic#to_fasta <b>can still be used</b>,
44
+ # because there are no alternative methods.
41
45
  #
42
46
  # Output the FASTA format string of the sequence. The 1st argument is
43
47
  # used as the comment string. If the 2nd option is given, the output
@@ -5,7 +5,7 @@
5
5
  # Copyright:: Copyright (c) 2005-2007 Midwinter Laboratories, LLC (http://midwinterlabs.com)
6
6
  # License:: The Ruby License
7
7
  #
8
- # $Id: calculated_cuts.rb,v 1.7 2007/07/16 19:28:48 k Exp $
8
+ # $Id:$
9
9
  #
10
10
 
11
11
  require 'bio/util/restriction_enzyme'
@@ -44,9 +44,11 @@ class CalculatedCuts
44
44
 
45
45
  # Set to +true+ if the fragment CalculatedCuts is working on is circular
46
46
  attr_accessor :circular
47
-
48
- # An +Array+ with the primary strand with vertical cuts, the horizontal cuts, and the complementary strand with vertical cuts.
49
- attr_reader :strands_for_display
47
+
48
+ #--
49
+ ## An +Array+ with the primary strand with vertical cuts, the horizontal cuts, and the complementary strand with vertical cuts.
50
+ #attr_reader :strands_for_display
51
+ #++
50
52
 
51
53
  # If +false+ the strands_for_display method needs to be called to update the contents
52
54
  # of @strands_for_display. Becomes out of date whenever add_cuts_from_cut_ranges is called.
@@ -10,7 +10,7 @@
10
10
  module Bio
11
11
 
12
12
  # BioRuby version (Array containing Integer)
13
- BIORUBY_VERSION = [1, 3, 0].extend(Comparable).freeze
13
+ BIORUBY_VERSION = [1, 3, 1].extend(Comparable).freeze
14
14
 
15
15
  # Extra version specifier (String or nil).
16
16
  # Existance of the value indicates pre-release version or modified version.
@@ -0,0 +1,67 @@
1
+ !!AA_MULTIPLE_ALIGNMENT 1.0
2
+ PileUp of: @/home/ngoto/.seqlab-localhost/pileup_24.list
3
+
4
+ Symbol comparison table: GenRunData:blosum62.cmp CompCheck: 1102
5
+
6
+ GapWeight: 8
7
+ GapLengthWeight: 2
8
+
9
+ pileup_24.msf MSF: 282 Type: P April 22, 2009 22:31 Check: 5701 ..
10
+
11
+ Name: xx_3183087 Len: 282 Check: 6631 Weight: 1.00
12
+ Name: xx_3183086 Len: 282 Check: 3789 Weight: 1.00
13
+ Name: xx_192453532 Len: 282 Check: 2081 Weight: 1.00
14
+ Name: xx_72157730 Len: 282 Check: 5946 Weight: 1.00
15
+ Name: xx_210090185 Len: 282 Check: 7419 Weight: 1.00
16
+ Name: xx_45552463 Len: 282 Check: 9835 Weight: 1.00
17
+
18
+ //
19
+
20
+ 1 50
21
+ xx_3183087 ~MAFLGLFSL LVLQSMATGA .TGEDENILF QKEIRHSMGY DSLKNGE.EF
22
+ xx_3183086 ~MYFLGLLSL LVLPSKAFKA .AREDENILF LKEIRHSLGF DSLKNGE.EF
23
+ xx_192453532 MLLLVVLPPL LLLRGCFCQA ISSGEENIIF LQEIRQAVGY SHFREDE.EF
24
+ xx_72157730 ~~~~~~~~MA FSKQQDISGQ DERRGTNLFF ATQIADVFRF NQVDQDQLHG
25
+ xx_210090185 ~~~~~~~~~~ ~~~MRSSTSQ EKDHPENIFF AQQMSRVLRF HKMDASDLHM
26
+ xx_45552463 ~~~~~~~~~~ ~~~MADAAGQ KP..GENIVF ATQLDQGLGL ASSDPEQ...
27
+
28
+ 51 100
29
+ xx_3183087 SNYINKWVEN NTRTFSF.TK DDEVQIPMMY QQGEFYYGEF SDGSNEAGGI
30
+ xx_3183086 TTHINKWVEN NTRTFSF.TK DDEVQIPMMY QQGEFYYGEF SDGSNEAGGI
31
+ xx_192453532 SERINSWVLN NTRTFSF.TR DDGVQTLMMY QQGDFYYGEF SDGTTEAGGV
32
+ xx_72157730 TKSINDWVSK NTTQETFKVL DERVPVSLMI QKGKYALAV. .DNTNDC...
33
+ xx_210090185 RQTINSWVEE RTRLGTFHI. SRDVEVPMMH QQGRFKLAY. .DEDLNC...
34
+ xx_45552463 .ATINNWVEQ LTRPDTFH.L DGEVQVPMMS LKERFRYAD. .LPALDA...
35
+
36
+ 101 150
37
+ xx_3183087 YQVLEIPYEG DEISMMLVLS RQEVPLATLE PLVKAQLVEE WANSVKKQKV
38
+ xx_3183086 YQVLEIPYEG DEISMMIVLS RQEVPLVTLE PLVKASLINE WANSVKKQKV
39
+ xx_192453532 YQVLEMLYEG EDMSMMIVLP RQEVPLASLE PIIKAPLLEE WANNVKRQKV
40
+ xx_72157730 .LVLEMPYQG RNLSLLIALP VKDDGLGQLE TKLSADILQS WDAGLKSRQV
41
+ xx_210090185 .QILEMPYRG KHLSMVVVLP DKMDDLSAIE TSLTPDLLRH WRKSMSEEST
42
+ xx_45552463 .MALELPYKD SDLSMLIVLP NTKTGLPALE EKLRLTTLSQ ITQSLYETKV
43
+
44
+ 151 200
45
+ xx_3183087 EVYLPRFTVE QEIDLKDVLK ALGITEIFIK D.ANLTG... .LSDNKEIFL
46
+ xx_3183086 EVYLPRFTVE QEIDLKDVLK GLGITEVFSR S.ADLTA... .MSDNKELYL
47
+ xx_192453532 EVYLPRFKVE QKIDLRESLQ QLGIRSIFSK D.ADLSAMTA QMTDGQDLFI
48
+ xx_72157730 NVLLPKFKLE AQFQLKEFLQ RMGMSDAFDE DRANFEGISG ...DRE.LHI
49
+ xx_210090185 MVQIPKFKVE QDFLLKEKLA EMGMTDLFSM ADADLSGITG ...SRD.LHV
50
+ xx_45552463 ALKLPRFKAE FQVELSEVFQ KLGMSRMFS. DQAEFGKMLQ ...SPEPLKV
51
+
52
+ 201 250
53
+ xx_3183087 SKAIHKSFLE VNEEGSEAAA VSGMIAISRM AVLYP..... QVIVDHPFFF
54
+ xx_3183086 AKAFHKAFLE VNEEGSEAAA ASGMIAISRM AVLYP..... QVIVDHPFFF
55
+ xx_192453532 GKAVQKAYLE VTEEGAEGAA GSGMIALTRT LVLYP..... QVMADHPFFF
56
+ xx_72157730 SAVIHKAFVD VNEEGSEAAA ATAVVMMRRC APPREPEKPI LFRADHPFIF
57
+ xx_210090185 SHVVHKAFVE VNEEGSEAAA ATAVNMMKRS L...DGE... MFFADHPFLF
58
+ xx_45552463 SAIIHKAFIE VNEEGTEAAA ATGMVMCYAS MLTFEPQ.PV QFHVQHPFNY
59
+
60
+ 251 282
61
+ xx_3183087 LIRNRRTGTI LFMGRVMHPE TMNTSGHDFE EL
62
+ xx_3183086 LVRNRRTGTV LFMGRVMHPE AMNTSGHDFE EL
63
+ xx_192453532 IIRNRKTGSI LFMGRVMNPE LIDPFDNNFD M~
64
+ xx_72157730 MIRHRPTKSV LFMGRMMDPS ~~~~~~~~~~ ~~
65
+ xx_210090185 LIRDNDSNSV LFLGRLVRPE GHTTKDEL~~ ~~
66
+ xx_45552463 YIINKDS.TI LFAGRINKF~ ~~~~~~~~~~ ~~
67
+
@@ -0,0 +1,43 @@
1
+
2
+ seq1 = sample41-1c.fst, 284 bp
3
+ seq2 = sample40-2.fst (genome4), 770 bp
4
+
5
+ >mrna4c
6
+ >genome4
7
+
8
+ (complement)
9
+
10
+ 1-72 (351-424) 89% ->
11
+ 73-142 (563-630) 95% ==
12
+ 213-284 (700-770) 95%
13
+
14
+ 0 . : . : . : . : . :
15
+ 1 TTTTAGCCGGCACGAGATTG AGCGTATGATCACGCGCGCGGCCTCCT C
16
+ ||||||||||||||||||||-||||-||||||||||||||||||||||-|
17
+ 351 TTTTAGCCGGCACGAGATTGCAGCG ATGATCACGCGCGCGGCCTCCTAC
18
+
19
+ 50 . : . : . : . : . :
20
+ 49 AGAGTGATGCATGATACAACTT AT ATATGTACTTAGCTG
21
+ -|||| ||||||||||||||||- |->>>...>>>|||||||||||||-|
22
+ 400 GAGTCATGCATGATACAACTTCTTGGTT...GATATATGTACTTAGC G
23
+
24
+ 100 . : . : . : . : . :
25
+ 88 GCAACCGAGATTTACTTTCGAAGCACTGTGATGAACCCGCGGCCCTTTGA
26
+ ||||||||||||||||||||||| |||||||||||||||||-||||||||
27
+ 577 GCAACCGAGATTTACTTTCGAAGGACTGTGATGAACCCGCG CCCTTTGA
28
+
29
+ 150 .
30
+ 138 GCGCT
31
+ |||||
32
+ 626 GCGCT
33
+
34
+ 0 . : . : . : . : . :
35
+ 213 TATATATGTACTTAGCGG ACACCGAGATTTACTTTCGAAGGACTGTGGA
36
+ ||||||||||||||||||-|-|||||||||||||||||||||||||||-|
37
+ 700 TATATATGTACTTAGCGGCA ACCGAGATTTACTTTCGAAGGACTGTG A
38
+
39
+ 50 . : . :
40
+ 262 TGAACCCGCGCCCTTTGAGCGCT
41
+ |||||||||||||||||||||||
42
+ 748 TGAACCCGCGCCCTTTGAGCGCT
43
+
@@ -0,0 +1,25 @@
1
+
2
+ seq1 = sample10-1.fst, 94 bp
3
+ seq2 = sample10-2.fst (genome1), 599 bp
4
+
5
+ >mrna1
6
+ >genome1
7
+
8
+ 1-40 (145-184) 100% <-
9
+ 41-94 (404-457) 94%
10
+
11
+ 0 . : . : . : . : . :
12
+ 1 TTGTTTCCGTCGCTGGTTATTGTCTAGAACGCAAAAATAG T
13
+ ||||||||||||||||||||||||||||||||||||||||<<<...<<<|
14
+ 145 TTGTTTCCGTCGCTGGTTATTGTCTAGAACGCAAAAATAGCTG...TACT
15
+
16
+ 50 . : . : . : . : . :
17
+ 42 CTACACATCACTAGCGTGGGTGGGCGGAAAGAGCAGCTCGCCACT CAAG
18
+ ||||||||||||||| |||||||||||||-|||||||||||||||-||||
19
+ 405 CTACACATCACTAGCCTGGGTGGGCGGAA GAGCAGCTCGCCACTTCAAG
20
+
21
+ 100
22
+ 91 CTAA
23
+ ||||
24
+ 454 CTAA
25
+
@@ -0,0 +1,25 @@
1
+
2
+ seq1 = sample10-1.fst, 96 bp
3
+ seq2 = sample10-2.fst (genome1), 599 bp
4
+
5
+ >mrna1
6
+ >genome1
7
+
8
+ 1-42 (143-184) 100% <-
9
+ 43-96 (404-457) 94%
10
+
11
+ 0 . : . : . : . : . :
12
+ 1 AGTTGTTTCCGTCGCTGGTTATTGTCTAGAACGCAAAAATAG
13
+ ||||||||||||||||||||||||||||||||||||||||||<<<...<<
14
+ 143 AGTTGTTTCCGTCGCTGGTTATTGTCTAGAACGCAAAAATAGCTG...TA
15
+
16
+ 50 . : . : . : . : . :
17
+ 43 TCTACACATCACTAGCGTGGGTGGGCGGAAAGAGCAGCTCGCCACT CA
18
+ <|||||||||||||||| |||||||||||||-|||||||||||||||-||
19
+ 403 CTCTACACATCACTAGCCTGGGTGGGCGGAA GAGCAGCTCGCCACTTCA
20
+
21
+ 100 .
22
+ 91 AGCTAA
23
+ ||||||
24
+ 452 AGCTAA
25
+
@@ -0,0 +1,129 @@
1
+ #
2
+ # test/functional/bio/io/test_pubmed.rb - Functional test for Bio::PubMed
3
+ #
4
+ # Copyright:: Copyright (C) 2009
5
+ # Naohisa Goto <ng@bioruby.org>
6
+ # License:: The Ruby License
7
+ #
8
+ # $Id:$
9
+ #
10
+
11
+ require 'pathname'
12
+ libpath = Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 4, 'lib')).cleanpath.to_s
13
+ $:.unshift(libpath) unless $:.include?(libpath)
14
+
15
+ require 'bio/io/pubmed'
16
+ require 'bio/db/medline'
17
+ require 'test/unit'
18
+
19
+ module Bio
20
+
21
+ module FuncTestPubmedCommon
22
+
23
+ def test_esearch
24
+ a = @pm.esearch('agile bioinformatics')
25
+ assert_kind_of(Array, a)
26
+ assert_operator(a.size, :>=, 3,
27
+ 'The failure may be caused by changes of NCBI PubMed.')
28
+ a.each do |x|
29
+ assert_kind_of(String, x)
30
+ assert_equal(x.strip, x.to_i.to_s,
31
+ 'PMID is not an integer value. This suggests that NCBI have changed the PMID policy.')
32
+ end
33
+ end
34
+
35
+ def test_esearch_count
36
+ a = @pm.esearch('agile bioinformatics',
37
+ { "rettype"=>"count" })
38
+ assert_kind_of(Integer, a)
39
+ assert_operator(a, :>=, 3,
40
+ 'The failure may be caused by changes of NCBI PubMed.')
41
+ end
42
+
43
+ def test_esearch_retmax_retstart
44
+ a = @pm.esearch('p53', { "retmax" => 10, "retstart" => 20 })
45
+ assert_equal(10, a.size,
46
+ 'The failure may be caused by changes of NCBI PubMed.')
47
+ a.each do |x|
48
+ assert_kind_of(String, x)
49
+ assert_equal(x.strip, x.to_i.to_s,
50
+ 'PMID is not an integer value. This suggests that NCBI have changed the PMID policy.')
51
+ end
52
+
53
+ a1 = @pm.esearch('p53', { "retmax" => 15, "retstart" => 35 })
54
+ a2 = @pm.esearch('p53', { "retmax" => 10, "retstart" => 0 })
55
+ assert_equal(35, (a + a1 + a2).sort.uniq.size,
56
+ 'The failure may be caused by changes of NCBI PubMed.')
57
+
58
+ a3 = @pm.esearch('p53', { "retmax" => 10 })
59
+ assert_equal(a2.sort, a3.sort,
60
+ 'The failure may be caused by changes of NCBI PubMed.')
61
+ end
62
+
63
+ def check_pubmed_entry(pmid, str)
64
+ m = Bio::MEDLINE.new(str)
65
+ assert_equal(pmid.to_s, m.pmid)
66
+ end
67
+ private :check_pubmed_entry
68
+
69
+ def do_efetch_single(pmid)
70
+ a = @pm.efetch(pmid)
71
+ assert_kind_of(Array, a)
72
+ assert_equal(1, a.size)
73
+ check_pubmed_entry(pmid, a[0])
74
+ end
75
+ private :do_efetch_single
76
+
77
+ def test_efetch
78
+ do_efetch_single(12368254)
79
+ end
80
+
81
+ def test_efetch_str
82
+ do_efetch_single("16734914")
83
+ end
84
+
85
+ def test_efetch_multiple
86
+ arg = [ 12368254, 18689808, 19304878 ]
87
+ a = @pm.efetch(arg)
88
+ assert_kind_of(Array, a)
89
+ assert_equal(3, a.size)
90
+ a.each do |str|
91
+ check_pubmed_entry(arg.shift, str)
92
+ end
93
+ end
94
+
95
+ def test_efetch_single_xml
96
+ arg = 12368254
97
+ str = @pm.efetch(arg, { "retmode" => 'xml' })
98
+ assert_kind_of(String, str)
99
+ assert(str.index(/\<PubmedArticleSet\>/))
100
+ end
101
+
102
+ def test_efetch_multiple_xml
103
+ arg = [ "16734914", 16381885, "10592173" ]
104
+ str = @pm.efetch(arg, { "retmode" => 'xml' })
105
+ assert_kind_of(String, str)
106
+ assert(str.index(/\<PubmedArticleSet\>/))
107
+ end
108
+
109
+ end #module FuncTestPubmedCommon
110
+
111
+ class FuncTestPubmed < Test::Unit::TestCase
112
+
113
+ include FuncTestPubmedCommon
114
+
115
+ def setup
116
+ @pm = Bio::PubMed.new
117
+ end
118
+ end #class FuncTestPubmed
119
+
120
+ class FuncTestPubmedClassMethod < Test::Unit::TestCase
121
+
122
+ include FuncTestPubmedCommon
123
+
124
+ def setup
125
+ @pm = Bio::PubMed
126
+ end
127
+ end #class FuncTestPubmedClassMethod
128
+
129
+ end
@@ -6,7 +6,7 @@
6
6
  # Mitsuteru C. Nakao <n@bioruby.org>
7
7
  # License:: The Ruby License
8
8
  #
9
- # $Id: test_report.rb,v 1.3 2007/04/05 23:35:43 trevor Exp $
9
+ # $Id:$
10
10
  #
11
11
 
12
12
  require 'pathname'
@@ -70,11 +70,11 @@ module Bio
70
70
  'db']
71
71
 
72
72
  methods.each do |x|
73
- assert_nil(@empty.methods.include?(x))
73
+ assert_equal(false, @empty.methods.include?(x), "undefined? : #{x}")
74
74
  end
75
75
 
76
76
  methods.each do |x|
77
- assert_nil(@blastp.methods.include?(x))
77
+ assert_equal(false, @blastp.methods.include?(x), "undefined? : #{x}")
78
78
  end
79
79
  end
80
80
 
@@ -91,7 +91,7 @@ module Bio
91
91
  end
92
92
 
93
93
  # TestIteration < Test::Unit::TestCase
94
- def test_undefed_methods
94
+ def test_undefed_methods_for_iteration
95
95
  methods = ['message',
96
96
  'pattern_in_database',
97
97
  'pattern',
@@ -103,7 +103,7 @@ module Bio
103
103
  'converged?']
104
104
 
105
105
  methods.each do |x|
106
- assert_equal(false, @empty.iterations.first.methods.include?(x), "undifined? : #{x}")
106
+ assert_equal(false, @empty.iterations.first.methods.include?(x), "undefined? : #{x}")
107
107
  end
108
108
 
109
109
  methods.each do |x|
@@ -0,0 +1,154 @@
1
+ #
2
+ # = test/unit/bio/appl/gcg/test_msf.rb - Unit test for Bio::GCG::Msf
3
+ #
4
+ # Copyright:: Copyright (C) 2009 Naohisa Goto <ng@bioruby.org>
5
+ # License:: The Ruby License
6
+ #
7
+ # $Id:$
8
+ #
9
+
10
+ require 'pathname'
11
+ libpath = Pathname.new(File.join(File.join(File.dirname(__FILE__), ['..'] * 5, 'lib'))).cleanpath.to_s
12
+ $:.unshift(libpath) unless $:.include?(libpath)
13
+
14
+ require 'test/unit'
15
+ require 'bio/sequence'
16
+ require 'bio/alignment'
17
+ require 'bio/appl/gcg/seq'
18
+ require 'bio/appl/gcg/msf'
19
+
20
+ module Bio
21
+
22
+ module TestGCGMsfData
23
+
24
+ bioruby_root = Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 5)).cleanpath.to_s
25
+
26
+ Filename_PileupAA = Pathname.new(File.join(bioruby_root, 'test', 'data', 'gcg', 'pileup-aa.msf')).cleanpath.to_s
27
+
28
+ PileupAA = File.read(Filename_PileupAA).freeze
29
+
30
+ mfst = <<__END_OF_MFST__
31
+ >xx_3183087
32
+ ~MAFLGLFSLLVLQSMATGA.TGEDENILFQKEIRHSMGYDSLKNGE.EF
33
+ SNYINKWVENNTRTFSF.TKDDEVQIPMMYQQGEFYYGEFSDGSNEAGGI
34
+ YQVLEIPYEGDEISMMLVLSRQEVPLATLEPLVKAQLVEEWANSVKKQKV
35
+ EVYLPRFTVEQEIDLKDVLKALGITEIFIKD.ANLTG....LSDNKEIFL
36
+ SKAIHKSFLEVNEEGSEAAAVSGMIAISRMAVLYP.....QVIVDHPFFF
37
+ LIRNRRTGTILFMGRVMHPETMNTSGHDFEEL
38
+ >xx_3183086
39
+ ~MYFLGLLSLLVLPSKAFKA.AREDENILFLKEIRHSLGFDSLKNGE.EF
40
+ TTHINKWVENNTRTFSF.TKDDEVQIPMMYQQGEFYYGEFSDGSNEAGGI
41
+ YQVLEIPYEGDEISMMIVLSRQEVPLVTLEPLVKASLINEWANSVKKQKV
42
+ EVYLPRFTVEQEIDLKDVLKGLGITEVFSRS.ADLTA....MSDNKELYL
43
+ AKAFHKAFLEVNEEGSEAAAASGMIAISRMAVLYP.....QVIVDHPFFF
44
+ LVRNRRTGTVLFMGRVMHPEAMNTSGHDFEEL
45
+ >xx_192453532
46
+ MLLLVVLPPLLLLRGCFCQAISSGEENIIFLQEIRQAVGYSHFREDE.EF
47
+ SERINSWVLNNTRTFSF.TRDDGVQTLMMYQQGDFYYGEFSDGTTEAGGV
48
+ YQVLEMLYEGEDMSMMIVLPRQEVPLASLEPIIKAPLLEEWANNVKRQKV
49
+ EVYLPRFKVEQKIDLRESLQQLGIRSIFSKD.ADLSAMTAQMTDGQDLFI
50
+ GKAVQKAYLEVTEEGAEGAAGSGMIALTRTLVLYP.....QVMADHPFFF
51
+ IIRNRKTGSILFMGRVMNPELIDPFDNNFDM~
52
+ >xx_72157730
53
+ ~~~~~~~~MAFSKQQDISGQDERRGTNLFFATQIADVFRFNQVDQDQLHG
54
+ TKSINDWVSKNTTQETFKVLDERVPVSLMIQKGKYALAV..DNTNDC...
55
+ .LVLEMPYQGRNLSLLIALPVKDDGLGQLETKLSADILQSWDAGLKSRQV
56
+ NVLLPKFKLEAQFQLKEFLQRMGMSDAFDEDRANFEGISG...DRE.LHI
57
+ SAVIHKAFVDVNEEGSEAAAATAVVMMRRCAPPREPEKPILFRADHPFIF
58
+ MIRHRPTKSVLFMGRMMDPS~~~~~~~~~~~~
59
+ >xx_210090185
60
+ ~~~~~~~~~~~~~MRSSTSQEKDHPENIFFAQQMSRVLRFHKMDASDLHM
61
+ RQTINSWVEERTRLGTFHI.SRDVEVPMMHQQGRFKLAY..DEDLNC...
62
+ .QILEMPYRGKHLSMVVVLPDKMDDLSAIETSLTPDLLRHWRKSMSEEST
63
+ MVQIPKFKVEQDFLLKEKLAEMGMTDLFSMADADLSGITG...SRD.LHV
64
+ SHVVHKAFVEVNEEGSEAAAATAVNMMKRSL...DGE...MFFADHPFLF
65
+ LIRDNDSNSVLFLGRLVRPEGHTTKDEL~~~~
66
+ >xx_45552463
67
+ ~~~~~~~~~~~~~MADAAGQKP..GENIVFATQLDQGLGLASSDPEQ...
68
+ .ATINNWVEQLTRPDTFH.LDGEVQVPMMSLKERFRYAD..LPALDA...
69
+ .MALELPYKDSDLSMLIVLPNTKTGLPALEEKLRLTTLSQITQSLYETKV
70
+ ALKLPRFKAEFQVELSEVFQKLGMSRMFS.DQAEFGKMLQ...SPEPLKV
71
+ SAIIHKAFIEVNEEGTEAAAATGMVMCYASMLTFEPQ.PVQFHVQHPFNY
72
+ YIINKDS.TILFAGRINKF~~~~~~~~~~~~~
73
+ __END_OF_MFST__
74
+
75
+ seqs = mfst.split(/^\>.*/).collect { |x| x.gsub(/\s+/, '').freeze }
76
+ seqs.shift # removes the first empty string
77
+ names = mfst.scan(/^\>.*/).collect { |x| x.sub(/\A\>/, '').freeze }
78
+
79
+ PileupAA_seqs = seqs.freeze
80
+ PileupAA_names = names.freeze
81
+
82
+ end #module TestGCGMsfData
83
+
84
+ class TestGCGMsf < Test::Unit::TestCase
85
+
86
+ def setup
87
+ @paa = Bio::GCG::Msf.new(TestGCGMsfData::PileupAA)
88
+ end
89
+
90
+ def test_alignment
91
+ seqs = TestGCGMsfData::PileupAA_seqs.dup
92
+ names = TestGCGMsfData::PileupAA_names
93
+
94
+ aln = nil
95
+ assert_nothing_raised { aln = @paa.alignment }
96
+ assert_equal(names, aln.keys)
97
+ aln.each do |s|
98
+ assert_equal(seqs.shift, s)
99
+ end
100
+ assert(seqs.empty?)
101
+ end
102
+
103
+ def test_checksum
104
+ assert_equal(5701, @paa.checksum)
105
+ end
106
+
107
+ def test_date
108
+ assert_equal('April 22, 2009 22:31', @paa.date)
109
+ end
110
+
111
+ def test_description
112
+ assert_equal("PileUp of: @/home/ngoto/.seqlab-localhost/pileup_24.list\n\n Symbol comparison table: GenRunData:blosum62.cmp CompCheck: 1102\n\n GapWeight: 8\n GapLengthWeight: 2 \n\n", @paa.description)
113
+ end
114
+
115
+ def test_entry_id
116
+ assert_equal('pileup_24.msf', @paa.entry_id)
117
+ end
118
+
119
+ def test_heading
120
+ assert_equal('!!AA_MULTIPLE_ALIGNMENT 1.0', @paa.heading)
121
+ end
122
+
123
+ def test_length
124
+ assert_equal(282, @paa.length)
125
+ end
126
+
127
+ def test_seq_type
128
+ assert_equal('P', @paa.seq_type)
129
+ end
130
+
131
+ def test_compcheck
132
+ assert_equal(1102, @paa.compcheck)
133
+ end
134
+
135
+ def test_gap_length_weight
136
+ assert_equal("2", @paa.gap_length_weight)
137
+ end
138
+
139
+ def test_gap_weight
140
+ assert_equal("8", @paa.gap_weight)
141
+ end
142
+
143
+ def test_symbol_comparison_table
144
+ assert_equal('GenRunData:blosum62.cmp', @paa.symbol_comparison_table)
145
+ end
146
+
147
+ def test_validate_checksum
148
+ assert_equal(true, @paa.validate_checksum)
149
+ end
150
+
151
+ end #class TestGCGMsf_PileupAA
152
+
153
+ end #module Bio
154
+