bio 1.2.1 → 1.3.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.
- data/ChangeLog +3421 -0
- data/KNOWN_ISSUES.rdoc +88 -0
- data/README.rdoc +252 -0
- data/README_DEV.rdoc +285 -0
- data/Rakefile +143 -0
- data/bin/bioruby +0 -0
- data/bin/br_biofetch.rb +0 -0
- data/bin/br_bioflat.rb +12 -1
- data/bin/br_biogetseq.rb +0 -0
- data/bin/br_pmfetch.rb +4 -3
- data/bioruby.gemspec +477 -0
- data/bioruby.gemspec.erb +117 -0
- data/doc/Changes-0.7.rd +7 -0
- data/doc/Changes-1.3.rdoc +239 -0
- data/doc/Tutorial.rd +296 -184
- data/doc/Tutorial.rd.html +1031 -0
- data/doc/Tutorial.rd.ja +111 -45
- data/doc/Tutorial.rd.ja.html +2225 -0
- data/doc/bioruby.css +281 -0
- data/extconf.rb +2 -0
- data/lib/bio.rb +29 -4
- data/lib/bio/appl/blast.rb +306 -121
- data/lib/bio/appl/blast/ddbj.rb +142 -0
- data/lib/bio/appl/blast/format0.rb +35 -25
- data/lib/bio/appl/blast/format8.rb +2 -2
- data/lib/bio/appl/blast/genomenet.rb +263 -0
- data/lib/bio/appl/blast/ncbioptions.rb +220 -0
- data/lib/bio/appl/blast/remote.rb +106 -0
- data/lib/bio/appl/blast/report.rb +260 -9
- data/lib/bio/appl/blast/rexml.rb +12 -5
- data/lib/bio/appl/blast/rpsblast.rb +277 -0
- data/lib/bio/appl/blast/wublast.rb +133 -12
- data/lib/bio/appl/blast/xmlparser.rb +35 -18
- data/lib/bio/appl/blat/report.rb +46 -5
- data/lib/bio/appl/emboss.rb +62 -13
- data/lib/bio/appl/fasta.rb +9 -11
- data/lib/bio/appl/genscan/report.rb +3 -3
- data/lib/bio/appl/hmmer.rb +1 -1
- data/lib/bio/appl/hmmer/report.rb +10 -10
- data/lib/bio/appl/paml/baseml.rb +95 -0
- data/lib/bio/appl/paml/baseml/report.rb +32 -0
- data/lib/bio/appl/paml/codeml.rb +242 -0
- data/lib/bio/appl/paml/codeml/rates.rb +67 -0
- data/lib/bio/appl/paml/codeml/report.rb +67 -0
- data/lib/bio/appl/paml/common.rb +348 -0
- data/lib/bio/appl/paml/common_report.rb +38 -0
- data/lib/bio/appl/paml/yn00.rb +103 -0
- data/lib/bio/appl/paml/yn00/report.rb +32 -0
- data/lib/bio/appl/psort.rb +2 -2
- data/lib/bio/appl/pts1.rb +5 -5
- data/lib/bio/appl/tmhmm/report.rb +10 -1
- data/lib/bio/command.rb +297 -41
- data/lib/bio/compat/features.rb +157 -0
- data/lib/bio/compat/references.rb +128 -0
- data/lib/bio/db/biosql/biosql_to_biosequence.rb +67 -0
- data/lib/bio/db/biosql/sequence.rb +508 -0
- data/lib/bio/db/embl/common.rb +28 -12
- data/lib/bio/db/embl/embl.rb +107 -9
- data/lib/bio/db/embl/embl_to_biosequence.rb +85 -0
- data/lib/bio/db/embl/format_embl.rb +190 -0
- data/lib/bio/db/embl/sptr.rb +15 -16
- data/lib/bio/db/fantom.rb +6 -8
- data/lib/bio/db/fasta.rb +10 -507
- data/lib/bio/db/fasta/defline.rb +532 -0
- data/lib/bio/db/fasta/fasta_to_biosequence.rb +63 -0
- data/lib/bio/db/fasta/format_fasta.rb +97 -0
- data/lib/bio/db/genbank/common.rb +25 -8
- data/lib/bio/db/genbank/format_genbank.rb +187 -0
- data/lib/bio/db/genbank/genbank.rb +36 -1
- data/lib/bio/db/genbank/genbank_to_biosequence.rb +86 -0
- data/lib/bio/db/gff.rb +1791 -119
- data/lib/bio/db/kegg/glycan.rb +2 -6
- data/lib/bio/db/lasergene.rb +3 -3
- data/lib/bio/db/medline.rb +4 -1
- data/lib/bio/db/newick.rb +10 -10
- data/lib/bio/db/pdb/chain.rb +6 -2
- data/lib/bio/db/pdb/pdb.rb +12 -3
- data/lib/bio/db/rebase.rb +7 -8
- data/lib/bio/db/soft.rb +3 -3
- data/lib/bio/feature.rb +1 -88
- data/lib/bio/io/biosql/biodatabase.rb +64 -0
- data/lib/bio/io/biosql/bioentry.rb +29 -0
- data/lib/bio/io/biosql/bioentry_dbxref.rb +11 -0
- data/lib/bio/io/biosql/bioentry_path.rb +12 -0
- data/lib/bio/io/biosql/bioentry_qualifier_value.rb +10 -0
- data/lib/bio/io/biosql/bioentry_reference.rb +10 -0
- data/lib/bio/io/biosql/bioentry_relationship.rb +10 -0
- data/lib/bio/io/biosql/biosequence.rb +11 -0
- data/lib/bio/io/biosql/comment.rb +7 -0
- data/lib/bio/io/biosql/config/database.yml +20 -0
- data/lib/bio/io/biosql/dbxref.rb +13 -0
- data/lib/bio/io/biosql/dbxref_qualifier_value.rb +12 -0
- data/lib/bio/io/biosql/location.rb +32 -0
- data/lib/bio/io/biosql/location_qualifier_value.rb +11 -0
- data/lib/bio/io/biosql/ontology.rb +10 -0
- data/lib/bio/io/biosql/reference.rb +9 -0
- data/lib/bio/io/biosql/seqfeature.rb +32 -0
- data/lib/bio/io/biosql/seqfeature_dbxref.rb +11 -0
- data/lib/bio/io/biosql/seqfeature_path.rb +11 -0
- data/lib/bio/io/biosql/seqfeature_qualifier_value.rb +20 -0
- data/lib/bio/io/biosql/seqfeature_relationship.rb +11 -0
- data/lib/bio/io/biosql/taxon.rb +12 -0
- data/lib/bio/io/biosql/taxon_name.rb +9 -0
- data/lib/bio/io/biosql/term.rb +27 -0
- data/lib/bio/io/biosql/term_dbxref.rb +11 -0
- data/lib/bio/io/biosql/term_path.rb +12 -0
- data/lib/bio/io/biosql/term_relationship.rb +13 -0
- data/lib/bio/io/biosql/term_relationship_term.rb +11 -0
- data/lib/bio/io/biosql/term_synonym.rb +10 -0
- data/lib/bio/io/das.rb +7 -7
- data/lib/bio/io/ddbjxml.rb +57 -0
- data/lib/bio/io/ensembl.rb +2 -2
- data/lib/bio/io/fetch.rb +28 -14
- data/lib/bio/io/flatfile.rb +17 -853
- data/lib/bio/io/flatfile/autodetection.rb +545 -0
- data/lib/bio/io/flatfile/buffer.rb +237 -0
- data/lib/bio/io/flatfile/index.rb +17 -7
- data/lib/bio/io/flatfile/indexer.rb +30 -12
- data/lib/bio/io/flatfile/splitter.rb +297 -0
- data/lib/bio/io/hinv.rb +442 -0
- data/lib/bio/io/keggapi.rb +2 -2
- data/lib/bio/io/ncbirest.rb +733 -0
- data/lib/bio/io/pubmed.rb +34 -80
- data/lib/bio/io/registry.rb +2 -2
- data/lib/bio/io/sql.rb +178 -357
- data/lib/bio/io/togows.rb +458 -0
- data/lib/bio/location.rb +106 -11
- data/lib/bio/pathway.rb +120 -14
- data/lib/bio/reference.rb +115 -101
- data/lib/bio/sequence.rb +164 -183
- data/lib/bio/sequence/adapter.rb +108 -0
- data/lib/bio/sequence/common.rb +22 -45
- data/lib/bio/sequence/compat.rb +2 -2
- data/lib/bio/sequence/dblink.rb +54 -0
- data/lib/bio/sequence/format.rb +254 -77
- data/lib/bio/sequence/format_raw.rb +23 -0
- data/lib/bio/shell.rb +3 -1
- data/lib/bio/shell/core.rb +2 -2
- data/lib/bio/shell/plugin/entry.rb +33 -4
- data/lib/bio/shell/plugin/ncbirest.rb +64 -0
- data/lib/bio/shell/plugin/togows.rb +40 -0
- data/lib/bio/shell/rails/vendor/plugins/{generators → bioruby/generators}/bioruby/bioruby_generator.rb +0 -0
- data/lib/bio/shell/rails/vendor/plugins/{generators → bioruby/generators}/bioruby/templates/_classes.rhtml +0 -0
- data/lib/bio/shell/rails/vendor/plugins/{generators → bioruby/generators}/bioruby/templates/_log.rhtml +0 -0
- data/lib/bio/shell/rails/vendor/plugins/{generators → bioruby/generators}/bioruby/templates/_methods.rhtml +0 -0
- data/lib/bio/shell/rails/vendor/plugins/{generators → bioruby/generators}/bioruby/templates/_modules.rhtml +0 -0
- data/lib/bio/shell/rails/vendor/plugins/{generators → bioruby/generators}/bioruby/templates/_variables.rhtml +0 -0
- data/lib/bio/shell/rails/vendor/plugins/{generators → bioruby/generators}/bioruby/templates/bioruby-bg.gif +0 -0
- data/lib/bio/shell/rails/vendor/plugins/{generators → bioruby/generators}/bioruby/templates/bioruby-gem.png +0 -0
- data/lib/bio/shell/rails/vendor/plugins/{generators → bioruby/generators}/bioruby/templates/bioruby-link.gif +0 -0
- data/lib/bio/shell/rails/vendor/plugins/{generators → bioruby/generators}/bioruby/templates/bioruby.css +0 -0
- data/lib/bio/shell/rails/vendor/plugins/{generators → bioruby/generators}/bioruby/templates/bioruby.rhtml +0 -0
- data/lib/bio/shell/rails/vendor/plugins/{generators → bioruby/generators}/bioruby/templates/bioruby_controller.rb +0 -0
- data/lib/bio/shell/rails/vendor/plugins/{generators → bioruby/generators}/bioruby/templates/bioruby_helper.rb +0 -0
- data/lib/bio/shell/rails/vendor/plugins/{generators → bioruby/generators}/bioruby/templates/commands.rhtml +0 -0
- data/lib/bio/shell/rails/vendor/plugins/{generators → bioruby/generators}/bioruby/templates/history.rhtml +0 -0
- data/lib/bio/shell/rails/vendor/plugins/{generators → bioruby/generators}/bioruby/templates/index.rhtml +0 -0
- data/lib/bio/shell/rails/vendor/plugins/{generators → bioruby/generators}/bioruby/templates/spinner.gif +0 -0
- data/lib/bio/tree.rb +4 -2
- data/lib/bio/util/color_scheme.rb +2 -2
- data/lib/bio/util/contingency_table.rb +2 -2
- data/lib/bio/util/restriction_enzyme.rb +2 -2
- data/lib/bio/util/restriction_enzyme/single_strand.rb +6 -5
- data/lib/bio/version.rb +25 -0
- data/rdoc.zsh +8 -0
- data/sample/any2fasta.rb +0 -0
- data/sample/biofetch.rb +0 -0
- data/sample/dbget +0 -0
- data/sample/demo_sequence.rb +158 -0
- data/sample/enzymes.rb +0 -0
- data/sample/fasta2tab.rb +0 -0
- data/sample/fastagrep.rb +72 -0
- data/sample/fastasort.rb +54 -0
- data/sample/fsplit.rb +0 -0
- data/sample/gb2fasta.rb +2 -3
- data/sample/gb2tab.rb +0 -0
- data/sample/gbtab2mysql.rb +0 -0
- data/sample/genes2nuc.rb +0 -0
- data/sample/genes2pep.rb +0 -0
- data/sample/genes2tab.rb +0 -0
- data/sample/genome2rb.rb +0 -0
- data/sample/genome2tab.rb +0 -0
- data/sample/goslim.rb +0 -0
- data/sample/gt2fasta.rb +0 -0
- data/sample/na2aa.rb +34 -0
- data/sample/pmfetch.rb +0 -0
- data/sample/pmsearch.rb +0 -0
- data/sample/ssearch2tab.rb +0 -0
- data/sample/tfastx2tab.rb +0 -0
- data/sample/vs-genes.rb +0 -0
- data/setup.rb +1596 -0
- data/test/data/blast/blastp-multi.m7 +188 -0
- data/test/data/command/echoarg2.bat +1 -0
- data/test/data/paml/codeml/control_file.txt +30 -0
- data/test/data/paml/codeml/output.txt +78 -0
- data/test/data/paml/codeml/rates +217 -0
- data/test/data/rpsblast/misc.rpsblast +193 -0
- data/test/data/soft/GDS100_partial.soft +0 -0
- data/test/data/soft/GSE3457_family_partial.soft +0 -0
- data/test/functional/bio/appl/test_pts1.rb +115 -0
- data/test/functional/bio/io/test_ensembl.rb +123 -80
- data/test/functional/bio/io/test_togows.rb +267 -0
- data/test/functional/bio/sequence/test_output_embl.rb +51 -0
- data/test/functional/bio/test_command.rb +301 -0
- data/test/runner.rb +17 -1
- data/test/unit/bio/appl/blast/test_ncbioptions.rb +112 -0
- data/test/unit/bio/appl/blast/test_report.rb +753 -35
- data/test/unit/bio/appl/blast/test_rpsblast.rb +398 -0
- data/test/unit/bio/appl/paml/codeml/test_rates.rb +45 -0
- data/test/unit/bio/appl/paml/codeml/test_report.rb +45 -0
- data/test/unit/bio/appl/paml/test_codeml.rb +174 -0
- data/test/unit/bio/appl/test_blast.rb +135 -4
- data/test/unit/bio/appl/test_fasta.rb +2 -2
- data/test/unit/bio/appl/test_pts1.rb +1 -64
- data/test/unit/bio/db/embl/test_common.rb +15 -15
- data/test/unit/bio/db/embl/test_embl.rb +4 -4
- data/test/unit/bio/db/embl/test_embl_rel89.rb +5 -5
- data/test/unit/bio/db/embl/test_embl_to_bioseq.rb +203 -0
- data/test/unit/bio/db/embl/test_sptr.rb +38 -1
- data/test/unit/bio/db/pdb/test_pdb.rb +2 -2
- data/test/unit/bio/db/test_gff.rb +1151 -25
- data/test/unit/bio/db/test_medline.rb +127 -0
- data/test/unit/bio/db/test_nexus.rb +5 -1
- data/test/unit/bio/db/test_prosite.rb +4 -4
- data/test/unit/bio/io/flatfile/test_autodetection.rb +375 -0
- data/test/unit/bio/io/flatfile/test_buffer.rb +251 -0
- data/test/unit/bio/io/flatfile/test_splitter.rb +369 -0
- data/test/unit/bio/io/test_ddbjxml.rb +8 -3
- data/test/unit/bio/io/test_fastacmd.rb +5 -5
- data/test/unit/bio/io/test_flatfile.rb +357 -106
- data/test/unit/bio/io/test_soapwsdl.rb +2 -2
- data/test/unit/bio/io/test_togows.rb +161 -0
- data/test/unit/bio/sequence/test_common.rb +210 -11
- data/test/unit/bio/sequence/test_compat.rb +3 -3
- data/test/unit/bio/sequence/test_dblink.rb +58 -0
- data/test/unit/bio/sequence/test_na.rb +2 -2
- data/test/unit/bio/test_command.rb +111 -50
- data/test/unit/bio/test_feature.rb +29 -1
- data/test/unit/bio/test_location.rb +566 -6
- data/test/unit/bio/test_pathway.rb +91 -65
- data/test/unit/bio/test_reference.rb +67 -13
- data/test/unit/bio/util/restriction_enzyme/analysis/test_calculated_cuts.rb +3 -3
- data/test/unit/bio/util/restriction_enzyme/analysis/test_cut_ranges.rb +3 -3
- data/test/unit/bio/util/restriction_enzyme/analysis/test_sequence_range.rb +3 -3
- data/test/unit/bio/util/restriction_enzyme/double_stranded/test_aligned_strands.rb +4 -3
- data/test/unit/bio/util/restriction_enzyme/double_stranded/test_cut_location_pair.rb +3 -3
- data/test/unit/bio/util/restriction_enzyme/double_stranded/test_cut_location_pair_in_enzyme_notation.rb +3 -3
- data/test/unit/bio/util/restriction_enzyme/double_stranded/test_cut_locations.rb +3 -3
- data/test/unit/bio/util/restriction_enzyme/double_stranded/test_cut_locations_in_enzyme_notation.rb +3 -3
- data/test/unit/bio/util/restriction_enzyme/single_strand/test_cut_locations_in_enzyme_notation.rb +3 -3
- data/test/unit/bio/util/restriction_enzyme/test_analysis.rb +3 -3
- data/test/unit/bio/util/restriction_enzyme/test_cut_symbol.rb +4 -4
- data/test/unit/bio/util/restriction_enzyme/test_double_stranded.rb +3 -3
- data/test/unit/bio/util/restriction_enzyme/test_single_strand.rb +3 -3
- data/test/unit/bio/util/restriction_enzyme/test_single_strand_complement.rb +3 -3
- data/test/unit/bio/util/restriction_enzyme/test_string_formatting.rb +3 -3
- data/test/unit/bio/util/test_restriction_enzyme.rb +3 -3
- metadata +202 -167
- data/test/unit/bio/appl/blast/test_xmlparser.rb +0 -388
|
@@ -0,0 +1,398 @@
|
|
|
1
|
+
#
|
|
2
|
+
# test/unit/bio/appl/blast/test_rpsblast.rb - Unit test for Bio::Blast::RPSBlast::Report
|
|
3
|
+
#
|
|
4
|
+
# Copyright:: Copyright (C) 2008
|
|
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.join(File.dirname(__FILE__), ['..'] * 5, 'lib'))).cleanpath.to_s
|
|
13
|
+
$:.unshift(libpath) unless $:.include?(libpath)
|
|
14
|
+
|
|
15
|
+
require 'test/unit'
|
|
16
|
+
require 'digest/sha1'
|
|
17
|
+
require 'bio/io/flatfile'
|
|
18
|
+
require 'bio/appl/blast/rpsblast'
|
|
19
|
+
|
|
20
|
+
module Bio
|
|
21
|
+
module TestRPSBlast
|
|
22
|
+
bioruby_root = Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 5)).cleanpath.to_s
|
|
23
|
+
TestFileName = Pathname.new(File.join(bioruby_root, 'test', 'data', 'rpsblast', 'misc.rpsblast')).cleanpath.to_s
|
|
24
|
+
|
|
25
|
+
class TestRPSBlastSplitter < Test::Unit::TestCase
|
|
26
|
+
def setup
|
|
27
|
+
@io = File.open(TestFileName)
|
|
28
|
+
@bstream = Bio::FlatFile::BufferedInputStream.new(@io, TestFileName)
|
|
29
|
+
@klass = Bio::Blast::RPSBlast::Report
|
|
30
|
+
@splitter = Bio::Blast::RPSBlast::RPSBlastSplitter.new(@klass, @bstream)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def teardown
|
|
34
|
+
@io.close
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def test_skip_leader
|
|
38
|
+
assert_equal(nil, @splitter.skip_leader)
|
|
39
|
+
assert_equal(0, @bstream.pos)
|
|
40
|
+
# force to push back white spaces
|
|
41
|
+
@bstream.ungets(" \n\n \t\t \n")
|
|
42
|
+
assert_equal(nil, @splitter.skip_leader)
|
|
43
|
+
assert_equal("RPS-BLAST 2.2.18 [Mar-02-2008]\n", @bstream.gets)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def test_rewind
|
|
47
|
+
assert_nothing_raised { @splitter.rewind }
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def test_get_entry
|
|
51
|
+
assert(raw = @splitter.get_entry)
|
|
52
|
+
assert_equal(4388, raw.size)
|
|
53
|
+
assert_equal('12201ff286b16f8578e2a3b0778c721438ac8278',
|
|
54
|
+
Digest::SHA1.hexdigest(raw))
|
|
55
|
+
|
|
56
|
+
assert(raw = @splitter.get_entry)
|
|
57
|
+
assert_equal(245, raw.size)
|
|
58
|
+
assert_equal('f5fb1ac1aa62ba65a68c5c7c8240c0a9fc047a46',
|
|
59
|
+
Digest::SHA1.hexdigest(raw))
|
|
60
|
+
|
|
61
|
+
assert(raw = @splitter.get_entry)
|
|
62
|
+
assert_equal(3144, raw.size)
|
|
63
|
+
assert_equal('db0ff4bf9901186758b2a0d6e94734a53733631f',
|
|
64
|
+
Digest::SHA1.hexdigest(raw))
|
|
65
|
+
|
|
66
|
+
assert_nil(@splitter.get_entry)
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def test_entry_pos
|
|
70
|
+
@splitter.entry_pos_flag = true
|
|
71
|
+
@splitter.get_entry
|
|
72
|
+
assert_equal(0, @splitter.entry_start_pos)
|
|
73
|
+
assert_equal(4388, @splitter.entry_ended_pos)
|
|
74
|
+
|
|
75
|
+
@splitter.get_entry
|
|
76
|
+
assert_equal(4388, @splitter.entry_start_pos)
|
|
77
|
+
assert_equal(4461, @splitter.entry_ended_pos)
|
|
78
|
+
|
|
79
|
+
@splitter.get_entry
|
|
80
|
+
assert_equal(4461, @splitter.entry_start_pos)
|
|
81
|
+
assert_equal(7433, @splitter.entry_ended_pos)
|
|
82
|
+
end
|
|
83
|
+
end #class TestRPSBlastSplitter
|
|
84
|
+
|
|
85
|
+
class TestRPSBlastReport < Test::Unit::TestCase
|
|
86
|
+
def setup
|
|
87
|
+
@flatfile = Bio::FlatFile.open(Bio::Blast::RPSBlast::Report,
|
|
88
|
+
TestFileName)
|
|
89
|
+
@obj = @flatfile.next_entry
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
def teardown
|
|
93
|
+
@flatfile.close
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
def test_program
|
|
97
|
+
assert_equal('RPS-BLAST', @obj.program)
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
def test_version
|
|
101
|
+
exp = 'RPS-BLAST 2.2.18 [Mar-02-2008]'
|
|
102
|
+
assert_equal(exp, @obj.version)
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
def test_version_number
|
|
106
|
+
assert_equal('2.2.18', @obj.version_number)
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
def test_version_date
|
|
110
|
+
assert_equal('Mar-02-2008', @obj.version_date)
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
def test_db
|
|
114
|
+
assert_equal('Pfam.v.22.0', @obj.db)
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
def test_query_def
|
|
118
|
+
ary =
|
|
119
|
+
[
|
|
120
|
+
'TestSequence mixture of globin and rhodopsin (computationally randomly concatenated)',
|
|
121
|
+
'randomseq3',
|
|
122
|
+
'gi|6013469|gb|AAD49229.2|AF159462_1 EHEC factor for adherence [Escherichia coli]'
|
|
123
|
+
]
|
|
124
|
+
@flatfile.rewind
|
|
125
|
+
@flatfile.each do |rep|
|
|
126
|
+
assert_equal(ary.shift, rep.query_def)
|
|
127
|
+
end
|
|
128
|
+
assert(ary.empty?)
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
def test_query_len
|
|
132
|
+
ary = [ 495, 1087, 3223 ]
|
|
133
|
+
@flatfile.rewind
|
|
134
|
+
@flatfile.each do |rep|
|
|
135
|
+
assert_equal(ary.shift, rep.query_len)
|
|
136
|
+
end
|
|
137
|
+
assert(ary.empty?)
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
def test_hits_size
|
|
141
|
+
ary = [ 3, 0, 2 ]
|
|
142
|
+
@flatfile.rewind
|
|
143
|
+
@flatfile.each do |rep|
|
|
144
|
+
assert_equal(ary.shift, rep.hits.size)
|
|
145
|
+
end
|
|
146
|
+
assert(ary.empty?)
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
def test_iterations_size
|
|
150
|
+
ary = [ 1, 1, 1 ]
|
|
151
|
+
@flatfile.rewind
|
|
152
|
+
@flatfile.each do |rep|
|
|
153
|
+
assert_equal(ary.shift, rep.iterations.size)
|
|
154
|
+
end
|
|
155
|
+
assert(ary.empty?)
|
|
156
|
+
end
|
|
157
|
+
end #class TestRPSBlastReport
|
|
158
|
+
|
|
159
|
+
class TestRPSBlastReportHit < Test::Unit::TestCase
|
|
160
|
+
def setup
|
|
161
|
+
flatfile = Bio::FlatFile.open(Bio::Blast::RPSBlast::Report,
|
|
162
|
+
TestFileName)
|
|
163
|
+
@hits = flatfile.next_entry.hits
|
|
164
|
+
flatfile.close
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
def test_hsps_size
|
|
168
|
+
ary = [ 1, 2, 1 ]
|
|
169
|
+
@hits.each do |h|
|
|
170
|
+
assert_equal(ary.shift, h.hsps.size)
|
|
171
|
+
end
|
|
172
|
+
assert(ary.empty?)
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
def test_len
|
|
176
|
+
assert_equal(110, @hits[0].len)
|
|
177
|
+
assert_equal(258, @hits[1].len)
|
|
178
|
+
assert_equal(336, @hits[2].len)
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
def test_target_len
|
|
182
|
+
assert_equal(110, @hits[0].target_len)
|
|
183
|
+
assert_equal(258, @hits[1].target_len)
|
|
184
|
+
assert_equal(336, @hits[2].target_len)
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
def test_target_def
|
|
188
|
+
assert_equal('gnl|CDD|84466 pfam00042, Globin, Globin..',
|
|
189
|
+
@hits[0].target_def)
|
|
190
|
+
assert_equal("gnl|CDD|84429 pfam00001, 7tm_1, 7 transmembrane receptor (rhodopsin family). This" \
|
|
191
|
+
" family contains, amongst other G-protein-coupled" \
|
|
192
|
+
" receptors (GCPRs), members of the opsin family, which" \
|
|
193
|
+
" have been considered to be typical members of the" \
|
|
194
|
+
" rhodopsin superfamily. They share several motifs, mainly" \
|
|
195
|
+
" the seven transmembrane helices, GCPRs of the rhodopsin" \
|
|
196
|
+
" superfamily. All opsins bind a chromophore, such as" \
|
|
197
|
+
" 11-cis-retinal. The function of most opsins other than" \
|
|
198
|
+
" the photoisomerases is split into two steps: light" \
|
|
199
|
+
" absorption and G-protein activation. Photoisomerases, on" \
|
|
200
|
+
" the other hand, are not coupled to G-proteins - they are" \
|
|
201
|
+
" thought to generate and supply the chromophore that is" \
|
|
202
|
+
" used by visual opsins..",
|
|
203
|
+
@hits[1].target_def)
|
|
204
|
+
assert_equal("gnl|CDD|87195 pfam06976, DUF1300, Protein of unknown function (DUF1300). This" \
|
|
205
|
+
" family represents a conserved region approximately 80" \
|
|
206
|
+
" residues long within a number of proteins of unknown" \
|
|
207
|
+
" function that seem to be specific to C. elegans. Some" \
|
|
208
|
+
" family members contain more than one copy of this" \
|
|
209
|
+
" region..",
|
|
210
|
+
@hits[2].target_def)
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
def test_definition
|
|
214
|
+
assert_equal('gnl|CDD|84466 pfam00042, Globin, Globin..',
|
|
215
|
+
@hits[0].definition)
|
|
216
|
+
assert_equal("gnl|CDD|84429 pfam00001, 7tm_1, 7 transmembrane receptor (rhodopsin family). This" \
|
|
217
|
+
" family contains, amongst other G-protein-coupled" \
|
|
218
|
+
" receptors (GCPRs), members of the opsin family, which" \
|
|
219
|
+
" have been considered to be typical members of the" \
|
|
220
|
+
" rhodopsin superfamily. They share several motifs, mainly" \
|
|
221
|
+
" the seven transmembrane helices, GCPRs of the rhodopsin" \
|
|
222
|
+
" superfamily. All opsins bind a chromophore, such as" \
|
|
223
|
+
" 11-cis-retinal. The function of most opsins other than" \
|
|
224
|
+
" the photoisomerases is split into two steps: light" \
|
|
225
|
+
" absorption and G-protein activation. Photoisomerases, on" \
|
|
226
|
+
" the other hand, are not coupled to G-proteins - they are" \
|
|
227
|
+
" thought to generate and supply the chromophore that is" \
|
|
228
|
+
" used by visual opsins..",
|
|
229
|
+
@hits[1].definition)
|
|
230
|
+
assert_equal("gnl|CDD|87195 pfam06976, DUF1300, Protein of unknown function (DUF1300). This" \
|
|
231
|
+
" family represents a conserved region approximately 80" \
|
|
232
|
+
" residues long within a number of proteins of unknown" \
|
|
233
|
+
" function that seem to be specific to C. elegans. Some" \
|
|
234
|
+
" family members contain more than one copy of this" \
|
|
235
|
+
" region..",
|
|
236
|
+
@hits[2].definition)
|
|
237
|
+
end
|
|
238
|
+
|
|
239
|
+
def test_evalue
|
|
240
|
+
assert_equal(2.0e-25, @hits[0].evalue)
|
|
241
|
+
assert_equal(2.0e-19, @hits[1].evalue)
|
|
242
|
+
assert_equal(0.003, @hits[2].evalue)
|
|
243
|
+
end
|
|
244
|
+
|
|
245
|
+
def test_bit_score
|
|
246
|
+
assert_equal(110.0, @hits[0].bit_score)
|
|
247
|
+
assert_equal(90.8, @hits[1].bit_score)
|
|
248
|
+
assert_equal(37.1, @hits[2].bit_score)
|
|
249
|
+
end
|
|
250
|
+
|
|
251
|
+
def test_identity
|
|
252
|
+
assert_equal(50, @hits[0].identity)
|
|
253
|
+
assert_equal(37, @hits[1].identity)
|
|
254
|
+
assert_equal(32, @hits[2].identity)
|
|
255
|
+
end
|
|
256
|
+
|
|
257
|
+
def test_overlap
|
|
258
|
+
assert_equal(110, @hits[0].overlap)
|
|
259
|
+
assert_equal(162, @hits[1].overlap)
|
|
260
|
+
assert_equal(145, @hits[2].overlap)
|
|
261
|
+
end
|
|
262
|
+
|
|
263
|
+
def test_query_seq
|
|
264
|
+
assert_equal("EKQLITGLWGKV--NVAECGAEALARLLIVYPWTQRFFASFGNLSSPTAILGNPMVRAHGKKVLTSFGDAVKNLDN---IKNTFSQLSELHCDKLHVDPENFRLLGDILI", @hits[0].query_seq)
|
|
265
|
+
assert_equal("HAIMGVAFTWVMALACAAPPLAGWSRY-IPEGLQCSCGIDYYTLKPEVNNESFVIYMFVVHFTIPMIIIFFCYGQLVFTV----KEAAAQQQESATTQKAEKEVTRMVIIMVIAFLICWVPYASVAFY--IFTHQGSNFGPIFMTIPAFFAKSAAIYNPVIY", @hits[1].query_seq)
|
|
266
|
+
assert_equal("IDYYTLKPEVNNESFVIYMFV--VHFT-IPMIIIFFCYGQLVFTVKEAAAQQQESATTQKAEKEVTRMVIIMVIAFLICWVPYASVAFYIFTHQGSNFGPIFMTIPAFFAKSAAIYNPVIYIM----MNKQFRNCMLTTICCGKN", @hits[2].query_seq)
|
|
267
|
+
end
|
|
268
|
+
|
|
269
|
+
def test_target_seq
|
|
270
|
+
assert_equal("QKALVKASWGKVKGNAPEIGAEILARLFTAYPDTKAYFPKFGDLSTAEALKSSPKFKAHGKKVLAALGEAVKHLDDDGNLKAALKKLGARHAKRGHVDPANFKLFGEALL", @hits[0].target_seq)
|
|
271
|
+
assert_equal("RAKVLILLVWVLALLLSLPPLLFSWLRTVEEGNVTTCLIDFPEESLLR---SYTLLSTLLGFVLPLLVILVCYTRILRTLRRRARSGASIARSLKRRSSSERKAAKMLLVVVVVFVLCWLPYHIVLLLDSLCLLSIIRVLPTALLITLWLAYVNSCLNPIIY", @hits[1].target_seq)
|
|
272
|
+
assert_equal("IEYIIETTELFGSSYEILLLIEGILFKLIPSIILPIATILLIFQLKKNKKVSSRSSTSSSSNDRSTKLVTFVTISFLIATVPLGILYLIKFFVFEYEGLVMIIDKLAIIFTFLSTINGTIHFLICYFMSSQYRNTVREMFGRKKK", @hits[2].target_seq)
|
|
273
|
+
end
|
|
274
|
+
|
|
275
|
+
def test_midline
|
|
276
|
+
assert_equal("+K L+ WGKV N E GAE LARL YP T+ +F FG+LS+ A+ +P +AHGKKVL + G+AVK+LD+ +K +L H + HVDP NF+L G+ L+", @hits[0].midline)
|
|
277
|
+
assert_equal(" A + + WV+AL + PPL + EG +C ID+ S+ + ++ F +P+++I CY +++ T+ + A+ + +E++ +M++++V+ F++CW+PY V + P + I + A + NP+IY", @hits[1].midline)
|
|
278
|
+
assert_equal("I+Y E+ S+ I + + + F IP II+ L+F +K+ S+T+ + T++V + I+FLI VP + F + + A + N I+ + M+ Q+RN + K ", @hits[2].midline)
|
|
279
|
+
end
|
|
280
|
+
|
|
281
|
+
def test_query_start
|
|
282
|
+
assert_equal(148, @hits[0].query_start)
|
|
283
|
+
assert_equal(299, @hits[1].query_start)
|
|
284
|
+
assert_equal(336, @hits[2].query_start)
|
|
285
|
+
end
|
|
286
|
+
|
|
287
|
+
def test_query_end
|
|
288
|
+
assert_equal(252, @hits[0].query_end)
|
|
289
|
+
assert_equal(453, @hits[1].query_end)
|
|
290
|
+
assert_equal(473, @hits[2].query_end)
|
|
291
|
+
end
|
|
292
|
+
|
|
293
|
+
def test_target_start
|
|
294
|
+
assert_equal(1, @hits[0].target_start)
|
|
295
|
+
assert_equal(100, @hits[1].target_start)
|
|
296
|
+
assert_equal(192, @hits[2].target_start)
|
|
297
|
+
end
|
|
298
|
+
|
|
299
|
+
def test_target_end
|
|
300
|
+
assert_equal(110, @hits[0].target_end)
|
|
301
|
+
assert_equal(258, @hits[1].target_end)
|
|
302
|
+
assert_equal(336, @hits[2].target_end)
|
|
303
|
+
end
|
|
304
|
+
|
|
305
|
+
def test_lap_at
|
|
306
|
+
assert_equal([148, 252, 1, 110], @hits[0].lap_at)
|
|
307
|
+
assert_equal([299, 453, 100, 258], @hits[1].lap_at)
|
|
308
|
+
assert_equal([336, 473, 192, 336], @hits[2].lap_at)
|
|
309
|
+
end
|
|
310
|
+
end #class TestRPSBlastHit
|
|
311
|
+
|
|
312
|
+
class TestRPSBlastHSP < Test::Unit::TestCase
|
|
313
|
+
def setup
|
|
314
|
+
flatfile = Bio::FlatFile.open(Bio::Blast::RPSBlast::Report,
|
|
315
|
+
TestFileName)
|
|
316
|
+
@hsps = flatfile.next_entry.hits[1].hsps
|
|
317
|
+
flatfile.close
|
|
318
|
+
end
|
|
319
|
+
|
|
320
|
+
def test_bit_score
|
|
321
|
+
assert_equal(90.8, @hsps[0].bit_score)
|
|
322
|
+
assert_equal(73.4, @hsps[1].bit_score)
|
|
323
|
+
end
|
|
324
|
+
|
|
325
|
+
def test_score
|
|
326
|
+
assert_equal(225, @hsps[0].score)
|
|
327
|
+
assert_equal(180, @hsps[1].score)
|
|
328
|
+
end
|
|
329
|
+
|
|
330
|
+
def test_evalue
|
|
331
|
+
assert_equal(2.0e-19, @hsps[0].evalue)
|
|
332
|
+
assert_equal(3.0e-14, @hsps[1].evalue)
|
|
333
|
+
end
|
|
334
|
+
|
|
335
|
+
def test_identity
|
|
336
|
+
assert_equal(37, @hsps[0].identity)
|
|
337
|
+
assert_equal(32, @hsps[1].identity)
|
|
338
|
+
end
|
|
339
|
+
|
|
340
|
+
def test_gaps
|
|
341
|
+
assert_equal(10, @hsps[0].gaps)
|
|
342
|
+
assert_equal(nil, @hsps[1].gaps)
|
|
343
|
+
end
|
|
344
|
+
|
|
345
|
+
def test_positive
|
|
346
|
+
assert_equal(76, @hsps[0].positive)
|
|
347
|
+
assert_equal(47, @hsps[1].positive)
|
|
348
|
+
end
|
|
349
|
+
|
|
350
|
+
def test_align_len
|
|
351
|
+
assert_equal(162, @hsps[0].align_len)
|
|
352
|
+
assert_equal(86, @hsps[1].align_len)
|
|
353
|
+
end
|
|
354
|
+
|
|
355
|
+
def test_query_from
|
|
356
|
+
assert_equal(299, @hsps[0].query_from)
|
|
357
|
+
assert_equal(55, @hsps[1].query_from)
|
|
358
|
+
end
|
|
359
|
+
|
|
360
|
+
def test_query_to
|
|
361
|
+
assert_equal(453, @hsps[0].query_to)
|
|
362
|
+
assert_equal(140, @hsps[1].query_to)
|
|
363
|
+
end
|
|
364
|
+
|
|
365
|
+
def test_hit_from
|
|
366
|
+
assert_equal(100, @hsps[0].hit_from)
|
|
367
|
+
assert_equal(2, @hsps[1].hit_from)
|
|
368
|
+
end
|
|
369
|
+
|
|
370
|
+
def test_hit_to
|
|
371
|
+
assert_equal(258, @hsps[0].hit_to)
|
|
372
|
+
assert_equal(87, @hsps[1].hit_to)
|
|
373
|
+
end
|
|
374
|
+
|
|
375
|
+
def test_qseq
|
|
376
|
+
assert_equal("HAIMGVAFTWVMALACAAPPLAGWSRY-IPEGLQCSCGIDYYTLKPEVNNESFVIYMFVVHFTIPMIIIFFCYGQLVFTV----KEAAAQQQESATTQKAEKEVTRMVIIMVIAFLICWVPYASVAFY--IFTHQGSNFGPIFMTIPAFFAKSAAIYNPVIY", @hsps[0].qseq)
|
|
377
|
+
assert_equal("NFLTLYVTVQHKKLRTPLNYILLNLAVADLFMVLGGFTSTLYTSLHGYFVFGPTGCNLEGFFATLGGEIALWSLVVLAIERYVVVC", @hsps[1].qseq)
|
|
378
|
+
end
|
|
379
|
+
|
|
380
|
+
def test_hseq
|
|
381
|
+
assert_equal("RAKVLILLVWVLALLLSLPPLLFSWLRTVEEGNVTTCLIDFPEESLLR---SYTLLSTLLGFVLPLLVILVCYTRILRTLRRRARSGASIARSLKRRSSSERKAAKMLLVVVVVFVLCWLPYHIVLLLDSLCLLSIIRVLPTALLITLWLAYVNSCLNPIIY", @hsps[0].hseq)
|
|
382
|
+
assert_equal("NLLVILVILRTKRLRTPTNIFLLNLAVADLLFLLTLPPWALYYLVGGDWPFGDALCKLVGALFVVNGYASILLLTAISIDRYLAIV", @hsps[1].hseq)
|
|
383
|
+
end
|
|
384
|
+
|
|
385
|
+
def test_midline
|
|
386
|
+
assert_equal(" A + + WV+AL + PPL + EG +C ID+ S+ + ++ F +P+++I CY +++ T+ + A+ + +E++ +M++++V+ F++CW+PY V + P + I + A + NP+IY", @hsps[0].midline)
|
|
387
|
+
assert_equal("N L + V ++ K+LRTP N LLNLAVADL +L LY + G + FG C L G + G ++ L ++I+RY+ + ", @hsps[1].midline)
|
|
388
|
+
end
|
|
389
|
+
|
|
390
|
+
def test_percent_identity
|
|
391
|
+
assert_equal(22, @hsps[0].percent_identity)
|
|
392
|
+
assert_equal(37, @hsps[1].percent_identity)
|
|
393
|
+
end
|
|
394
|
+
end #class TestRPSBlastHSP
|
|
395
|
+
|
|
396
|
+
end #module TestRPSBlast
|
|
397
|
+
end #module Bio
|
|
398
|
+
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
#
|
|
2
|
+
# test/unit/bio/appl/paml/codeml/test_rates.rb - Unit test for Bio::PAML::Codeml::Rates
|
|
3
|
+
#
|
|
4
|
+
# Copyright:: Copyright (C) 2008 Michael D. Barton <mail@michaelbarton.me.uk>
|
|
5
|
+
# License:: The Ruby License
|
|
6
|
+
#
|
|
7
|
+
|
|
8
|
+
require 'pathname'
|
|
9
|
+
libpath = Pathname.new(File.join(File.join(File.dirname(__FILE__), ['..'] * 6, 'lib'))).cleanpath.to_s
|
|
10
|
+
$:.unshift(libpath) unless $:.include?(libpath)
|
|
11
|
+
|
|
12
|
+
require 'test/unit'
|
|
13
|
+
require 'bio/appl/paml/codeml/rates'
|
|
14
|
+
|
|
15
|
+
module Bio; module TestPAMLCodeml
|
|
16
|
+
class TestCodemlRates < Test::Unit::TestCase
|
|
17
|
+
|
|
18
|
+
bioruby_root = Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 6)).cleanpath.to_s
|
|
19
|
+
TEST_DATA = Pathname.new(File.join(bioruby_root, 'test', 'data', 'paml', 'codeml')).cleanpath.to_s
|
|
20
|
+
|
|
21
|
+
def setup
|
|
22
|
+
str = File.read(File.join(TEST_DATA, 'rates'))
|
|
23
|
+
@example_rates = Bio::PAML::Codeml::Rates.new(str)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def test_rates_first_position
|
|
27
|
+
assert_equal('***M', @example_rates.first[:data])
|
|
28
|
+
assert_equal(1, @example_rates.first[:rate])
|
|
29
|
+
assert_equal(1, @example_rates.first[:freq])
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def test_rates_hundred_and_fiftieth_position
|
|
33
|
+
assert('GGGG', @example_rates[149][:data])
|
|
34
|
+
assert(0.828, @example_rates[149][:rate])
|
|
35
|
+
assert(9, @example_rates[149][:freq])
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def test_rates_last_position
|
|
39
|
+
assert('PHPP', @example_rates.last[:data])
|
|
40
|
+
assert(1.752, @example_rates.last[:rate])
|
|
41
|
+
assert(1, @example_rates.last[:freq])
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
end; end #module TestPAMLCodeml; module Bio
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
#
|
|
2
|
+
# test/unit/bio/appl/paml/codeml/test_report.rb - Unit test for Bio::PAML::Codeml::Report
|
|
3
|
+
#
|
|
4
|
+
# Copyright:: Copyright (C) 2008 Michael D. Barton <mail@michaelbarton.me.uk>
|
|
5
|
+
# License:: The Ruby License
|
|
6
|
+
#
|
|
7
|
+
|
|
8
|
+
require 'pathname'
|
|
9
|
+
libpath = Pathname.new(File.join(File.join(File.dirname(__FILE__), ['..'] * 6, 'lib'))).cleanpath.to_s
|
|
10
|
+
$:.unshift(libpath) unless $:.include?(libpath)
|
|
11
|
+
|
|
12
|
+
require 'test/unit'
|
|
13
|
+
require 'bio/appl/paml/codeml/report'
|
|
14
|
+
|
|
15
|
+
module Bio; module TestPAMLCodeml
|
|
16
|
+
class TestCodemlReport < Test::Unit::TestCase
|
|
17
|
+
|
|
18
|
+
bioruby_root = Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 6)).cleanpath.to_s
|
|
19
|
+
TEST_DATA = Pathname.new(File.join(bioruby_root, 'test', 'data', 'paml', 'codeml')).cleanpath.to_s
|
|
20
|
+
|
|
21
|
+
def setup
|
|
22
|
+
str = File.read(File.join(TEST_DATA, 'output.txt'))
|
|
23
|
+
@example_report = Bio::PAML::Codeml::Report.new(str)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def test_tree_log_likelihood
|
|
27
|
+
assert_equal(-1817.465211, @example_report.tree_log_likelihood)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def test_tree_length
|
|
31
|
+
assert_equal(0.77902, @example_report.tree_length)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def test_alpha
|
|
35
|
+
assert_equal(0.58871, @example_report.alpha)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def test_tree
|
|
39
|
+
tree = "(((rabbit: 0.082889, rat: 0.187866): 0.038008, human: 0.055050): 0.033639, goat-cow: 0.096992, marsupial: 0.284574);"
|
|
40
|
+
assert_equal(tree, @example_report.tree)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
end; end #module TestPAMLCodeml; module Bio
|