bio 1.0.0 → 1.1.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/bin/bioruby +14 -122
- data/bin/br_biofetch.rb +2 -2
- data/bin/br_bioflat.rb +2 -2
- data/bin/br_biogetseq.rb +2 -2
- data/bin/br_pmfetch.rb +3 -3
- data/doc/Changes-0.7.rd +77 -0
- data/doc/KEGG_API.rd +523 -232
- data/doc/KEGG_API.rd.ja +529 -207
- data/doc/Tutorial.rd +48 -11
- data/lib/bio.rb +59 -6
- data/lib/bio/alignment.rb +713 -103
- data/lib/bio/appl/bl2seq/report.rb +2 -18
- data/lib/bio/appl/blast.rb +108 -91
- data/lib/bio/appl/blast/format0.rb +33 -18
- data/lib/bio/appl/blast/format8.rb +6 -20
- data/lib/bio/appl/blast/report.rb +293 -429
- data/lib/bio/appl/blast/rexml.rb +8 -22
- data/lib/bio/appl/blast/wublast.rb +21 -12
- data/lib/bio/appl/blast/xmlparser.rb +180 -183
- data/lib/bio/appl/blat/report.rb +127 -30
- data/lib/bio/appl/clustalw.rb +87 -59
- data/lib/bio/appl/clustalw/report.rb +20 -22
- data/lib/bio/appl/emboss.rb +113 -20
- data/lib/bio/appl/fasta.rb +173 -198
- data/lib/bio/appl/fasta/format10.rb +244 -347
- data/lib/bio/appl/gcg/msf.rb +212 -0
- data/lib/bio/appl/gcg/seq.rb +195 -0
- data/lib/bio/appl/genscan/report.rb +5 -23
- data/lib/bio/appl/hmmer.rb +8 -45
- data/lib/bio/appl/hmmer/report.rb +2 -20
- data/lib/bio/appl/iprscan/report.rb +374 -0
- data/lib/bio/appl/mafft.rb +87 -50
- data/lib/bio/appl/mafft/report.rb +151 -44
- data/lib/bio/appl/muscle.rb +52 -0
- data/lib/bio/appl/phylip/alignment.rb +129 -0
- data/lib/bio/appl/phylip/distance_matrix.rb +96 -0
- data/lib/bio/appl/probcons.rb +41 -0
- data/lib/bio/appl/psort.rb +89 -96
- data/lib/bio/appl/psort/report.rb +6 -22
- data/lib/bio/appl/pts1.rb +263 -0
- data/lib/bio/appl/sim4.rb +26 -36
- data/lib/bio/appl/sim4/report.rb +2 -18
- data/lib/bio/appl/sosui/report.rb +5 -20
- data/lib/bio/appl/spidey/report.rb +2 -2
- data/lib/bio/appl/targetp/report.rb +4 -20
- data/lib/bio/appl/tcoffee.rb +55 -0
- data/lib/bio/appl/tmhmm/report.rb +4 -20
- data/lib/bio/command.rb +235 -64
- data/lib/bio/data/aa.rb +21 -26
- data/lib/bio/data/codontable.rb +2 -20
- data/lib/bio/data/na.rb +19 -4
- data/lib/bio/db.rb +27 -12
- data/lib/bio/db/aaindex.rb +2 -20
- data/lib/bio/db/embl/common.rb +4 -21
- data/lib/bio/db/embl/embl.rb +33 -85
- data/lib/bio/db/embl/sptr.rb +612 -302
- data/lib/bio/db/embl/swissprot.rb +10 -29
- data/lib/bio/db/embl/trembl.rb +10 -29
- data/lib/bio/db/embl/uniprot.rb +10 -29
- data/lib/bio/db/fantom.rb +15 -20
- data/lib/bio/db/fasta.rb +3 -3
- data/lib/bio/db/genbank/common.rb +37 -46
- data/lib/bio/db/genbank/ddbj.rb +6 -18
- data/lib/bio/db/genbank/genbank.rb +47 -186
- data/lib/bio/db/genbank/genpept.rb +4 -17
- data/lib/bio/db/genbank/refseq.rb +4 -17
- data/lib/bio/db/gff.rb +103 -35
- data/lib/bio/db/go.rb +4 -20
- data/lib/bio/db/kegg/brite.rb +26 -36
- data/lib/bio/db/kegg/compound.rb +81 -85
- data/lib/bio/db/kegg/drug.rb +98 -0
- data/lib/bio/db/kegg/enzyme.rb +133 -110
- data/lib/bio/db/kegg/expression.rb +2 -20
- data/lib/bio/db/kegg/genes.rb +208 -238
- data/lib/bio/db/kegg/genome.rb +164 -285
- data/lib/bio/db/kegg/glycan.rb +114 -157
- data/lib/bio/db/kegg/keggtab.rb +242 -303
- data/lib/bio/db/kegg/kgml.rb +117 -160
- data/lib/bio/db/kegg/orthology.rb +112 -0
- data/lib/bio/db/kegg/reaction.rb +54 -69
- data/lib/bio/db/kegg/taxonomy.rb +331 -0
- data/lib/bio/db/lasergene.rb +209 -0
- data/lib/bio/db/litdb.rb +3 -27
- data/lib/bio/db/medline.rb +228 -249
- data/lib/bio/db/nbrf.rb +3 -3
- data/lib/bio/db/newick.rb +510 -0
- data/lib/bio/db/nexus.rb +1854 -0
- data/lib/bio/db/pdb.rb +5 -17
- data/lib/bio/db/pdb/atom.rb +2 -18
- data/lib/bio/db/pdb/chain.rb +2 -18
- data/lib/bio/db/pdb/chemicalcomponent.rb +2 -18
- data/lib/bio/db/pdb/model.rb +2 -18
- data/lib/bio/db/pdb/pdb.rb +73 -34
- data/lib/bio/db/pdb/residue.rb +4 -20
- data/lib/bio/db/pdb/utils.rb +2 -18
- data/lib/bio/db/prosite.rb +403 -422
- data/lib/bio/db/rebase.rb +84 -40
- data/lib/bio/db/soft.rb +404 -0
- data/lib/bio/db/transfac.rb +5 -17
- data/lib/bio/feature.rb +106 -52
- data/lib/bio/io/das.rb +32 -42
- data/lib/bio/io/dbget.rb +2 -20
- data/lib/bio/io/ddbjxml.rb +77 -138
- data/lib/bio/io/ebisoap.rb +158 -0
- data/lib/bio/io/ensembl.rb +229 -0
- data/lib/bio/io/fastacmd.rb +89 -82
- data/lib/bio/io/fetch.rb +163 -96
- data/lib/bio/io/flatfile.rb +170 -73
- data/lib/bio/io/flatfile/bdb.rb +3 -16
- data/lib/bio/io/flatfile/index.rb +2 -2
- data/lib/bio/io/flatfile/indexer.rb +3 -2
- data/lib/bio/io/higet.rb +12 -31
- data/lib/bio/io/keggapi.rb +210 -269
- data/lib/bio/io/ncbisoap.rb +155 -0
- data/lib/bio/io/pubmed.rb +169 -147
- data/lib/bio/io/registry.rb +4 -20
- data/lib/bio/io/soapwsdl.rb +43 -38
- data/lib/bio/io/sql.rb +242 -305
- data/lib/bio/location.rb +407 -285
- data/lib/bio/map.rb +410 -0
- data/lib/bio/pathway.rb +558 -695
- data/lib/bio/reference.rb +272 -75
- data/lib/bio/sequence.rb +255 -13
- data/lib/bio/sequence/aa.rb +71 -10
- data/lib/bio/sequence/common.rb +187 -33
- data/lib/bio/sequence/compat.rb +59 -4
- data/lib/bio/sequence/format.rb +54 -7
- data/lib/bio/sequence/generic.rb +3 -3
- data/lib/bio/sequence/na.rb +328 -26
- data/lib/bio/shell.rb +11 -4
- data/lib/bio/shell/core.rb +221 -160
- data/lib/bio/shell/demo.rb +18 -15
- data/lib/bio/shell/interface.rb +14 -12
- data/lib/bio/shell/irb.rb +95 -0
- data/lib/bio/shell/object.rb +45 -26
- data/lib/bio/shell/plugin/blast.rb +42 -0
- data/lib/bio/shell/plugin/codon.rb +22 -14
- data/lib/bio/shell/plugin/das.rb +58 -0
- data/lib/bio/shell/plugin/emboss.rb +2 -2
- data/lib/bio/shell/plugin/entry.rb +22 -11
- data/lib/bio/shell/plugin/flatfile.rb +2 -2
- data/lib/bio/shell/plugin/keggapi.rb +13 -6
- data/lib/bio/shell/plugin/midi.rb +4 -4
- data/lib/bio/shell/plugin/obda.rb +2 -2
- data/lib/bio/shell/plugin/psort.rb +56 -0
- data/lib/bio/shell/plugin/seq.rb +35 -8
- data/lib/bio/shell/plugin/soap.rb +87 -0
- data/lib/bio/shell/rails/vendor/plugins/generators/bioruby/bioruby_generator.rb +29 -0
- data/lib/bio/shell/rails/vendor/plugins/generators/bioruby/templates/_classes.rhtml +4 -0
- data/lib/bio/shell/rails/vendor/plugins/generators/bioruby/templates/_log.rhtml +27 -0
- data/lib/bio/shell/rails/vendor/plugins/generators/bioruby/templates/_methods.rhtml +11 -0
- data/lib/bio/shell/rails/vendor/plugins/generators/bioruby/templates/_modules.rhtml +4 -0
- data/lib/bio/shell/rails/vendor/plugins/generators/bioruby/templates/_variables.rhtml +7 -0
- data/lib/bio/shell/rails/vendor/plugins/generators/bioruby/templates/bioruby-bg.gif +0 -0
- data/lib/bio/shell/rails/vendor/plugins/generators/bioruby/templates/bioruby-console.png +0 -0
- data/lib/bio/shell/rails/{public/images/icon.png → vendor/plugins/generators/bioruby/templates/bioruby-gem.png} +0 -0
- data/lib/bio/shell/rails/vendor/plugins/generators/bioruby/templates/bioruby-link.gif +0 -0
- data/lib/bio/shell/rails/vendor/plugins/generators/bioruby/templates/bioruby.css +369 -0
- data/lib/bio/shell/rails/vendor/plugins/generators/bioruby/templates/bioruby.rhtml +47 -0
- data/lib/bio/shell/rails/vendor/plugins/generators/bioruby/templates/bioruby_controller.rb +144 -0
- data/lib/bio/shell/rails/vendor/plugins/generators/bioruby/templates/bioruby_helper.rb +47 -0
- data/lib/bio/shell/rails/vendor/plugins/generators/bioruby/templates/commands.rhtml +8 -0
- data/lib/bio/shell/rails/vendor/plugins/generators/bioruby/templates/history.rhtml +10 -0
- data/lib/bio/shell/rails/vendor/plugins/generators/bioruby/templates/index.rhtml +22 -0
- data/lib/bio/shell/script.rb +25 -0
- data/lib/bio/shell/setup.rb +109 -0
- data/lib/bio/shell/web.rb +70 -58
- data/lib/bio/tree.rb +850 -0
- data/lib/bio/util/color_scheme.rb +84 -107
- data/lib/bio/util/color_scheme/buried.rb +5 -24
- data/lib/bio/util/color_scheme/helix.rb +5 -24
- data/lib/bio/util/color_scheme/hydropathy.rb +5 -24
- data/lib/bio/util/color_scheme/nucleotide.rb +5 -24
- data/lib/bio/util/color_scheme/strand.rb +5 -24
- data/lib/bio/util/color_scheme/taylor.rb +5 -24
- data/lib/bio/util/color_scheme/turn.rb +5 -24
- data/lib/bio/util/color_scheme/zappo.rb +5 -24
- data/lib/bio/util/contingency_table.rb +70 -43
- data/lib/bio/util/restriction_enzyme.rb +228 -0
- data/lib/bio/util/restriction_enzyme/analysis.rb +249 -0
- data/lib/bio/util/restriction_enzyme/analysis_basic.rb +217 -0
- data/lib/bio/util/restriction_enzyme/cut_symbol.rb +107 -0
- data/lib/bio/util/restriction_enzyme/double_stranded.rb +321 -0
- data/lib/bio/util/restriction_enzyme/double_stranded/aligned_strands.rb +130 -0
- data/lib/bio/util/restriction_enzyme/double_stranded/cut_location_pair.rb +103 -0
- data/lib/bio/util/restriction_enzyme/double_stranded/cut_location_pair_in_enzyme_notation.rb +38 -0
- data/lib/bio/util/restriction_enzyme/double_stranded/cut_locations.rb +76 -0
- data/lib/bio/util/restriction_enzyme/double_stranded/cut_locations_in_enzyme_notation.rb +107 -0
- data/lib/bio/util/restriction_enzyme/enzymes.yaml +7061 -0
- data/lib/bio/util/restriction_enzyme/range/cut_range.rb +24 -0
- data/lib/bio/util/restriction_enzyme/range/cut_ranges.rb +47 -0
- data/lib/bio/util/restriction_enzyme/range/horizontal_cut_range.rb +67 -0
- data/lib/bio/util/restriction_enzyme/range/sequence_range.rb +257 -0
- data/lib/bio/util/restriction_enzyme/range/sequence_range/calculated_cuts.rb +242 -0
- data/lib/bio/util/restriction_enzyme/range/sequence_range/fragment.rb +51 -0
- data/lib/bio/util/restriction_enzyme/range/sequence_range/fragments.rb +41 -0
- data/lib/bio/util/restriction_enzyme/range/vertical_cut_range.rb +77 -0
- data/lib/bio/util/restriction_enzyme/single_strand.rb +199 -0
- data/lib/bio/util/restriction_enzyme/single_strand/cut_locations_in_enzyme_notation.rb +135 -0
- data/lib/bio/util/restriction_enzyme/single_strand_complement.rb +23 -0
- data/lib/bio/util/restriction_enzyme/string_formatting.rb +111 -0
- data/lib/bio/util/sirna.rb +4 -22
- data/sample/color_scheme_na.rb +4 -12
- data/sample/enzymes.rb +78 -0
- data/sample/goslim.rb +5 -13
- data/sample/psortplot_html.rb +4 -12
- data/test/data/blast/2.2.15.blastp.m7 +876 -0
- data/test/data/embl/AB090716.embl.rel89 +63 -0
- data/test/data/fasta/example1.txt +75 -0
- data/test/data/fasta/example2.txt +21 -0
- data/test/data/iprscan/merged.raw +32 -0
- data/test/data/iprscan/merged.txt +74 -0
- data/test/data/soft/GDS100_partial.soft +92 -0
- data/test/data/soft/GSE3457_family_partial.soft +874 -0
- data/test/functional/bio/io/test_ensembl.rb +103 -0
- data/test/functional/bio/io/test_soapwsdl.rb +5 -17
- data/test/unit/bio/appl/bl2seq/test_report.rb +2 -2
- data/test/unit/bio/appl/blast/test_report.rb +3 -16
- data/test/unit/bio/appl/blast/test_xmlparser.rb +4 -16
- data/test/unit/bio/appl/genscan/test_report.rb +3 -16
- data/test/unit/bio/appl/hmmer/test_report.rb +3 -16
- data/test/unit/bio/appl/iprscan/test_report.rb +338 -0
- data/test/unit/bio/appl/mafft/test_report.rb +63 -0
- data/test/unit/bio/appl/sosui/test_report.rb +3 -16
- data/test/unit/bio/appl/targetp/test_report.rb +3 -16
- data/test/unit/bio/appl/test_blast.rb +3 -16
- data/test/unit/bio/appl/test_fasta.rb +4 -16
- data/test/unit/bio/appl/test_pts1.rb +140 -0
- data/test/unit/bio/appl/tmhmm/test_report.rb +3 -16
- data/test/unit/bio/data/test_aa.rb +4 -17
- data/test/unit/bio/data/test_codontable.rb +3 -16
- data/test/unit/bio/data/test_na.rb +3 -3
- data/test/unit/bio/db/embl/test_common.rb +3 -16
- data/test/unit/bio/db/embl/test_embl.rb +3 -16
- data/test/unit/bio/db/embl/test_embl_rel89.rb +219 -0
- data/test/unit/bio/db/embl/test_sptr.rb +1548 -41
- data/test/unit/bio/db/embl/test_uniprot.rb +3 -16
- data/test/unit/bio/db/kegg/test_genes.rb +3 -16
- data/test/unit/bio/db/pdb/test_pdb.rb +7 -24
- data/test/unit/bio/db/test_aaindex.rb +2 -2
- data/test/unit/bio/db/test_fasta.rb +3 -16
- data/test/unit/bio/db/test_gff.rb +3 -16
- data/test/unit/bio/db/test_lasergene.rb +95 -0
- data/test/unit/bio/db/test_newick.rb +56 -0
- data/test/unit/bio/db/test_nexus.rb +360 -0
- data/test/unit/bio/db/test_prosite.rb +5 -18
- data/test/unit/bio/db/test_rebase.rb +11 -25
- data/test/unit/bio/db/test_soft.rb +138 -0
- data/test/unit/bio/io/test_ddbjxml.rb +5 -17
- data/test/unit/bio/io/test_ensembl.rb +109 -0
- data/test/unit/bio/io/test_fastacmd.rb +3 -16
- data/test/unit/bio/io/test_flatfile.rb +237 -0
- data/test/unit/bio/io/test_soapwsdl.rb +4 -17
- data/test/unit/bio/sequence/test_aa.rb +3 -3
- data/test/unit/bio/sequence/test_common.rb +3 -16
- data/test/unit/bio/sequence/test_compat.rb +3 -16
- data/test/unit/bio/sequence/test_na.rb +29 -3
- data/test/unit/bio/shell/plugin/test_seq.rb +8 -8
- data/test/unit/bio/test_alignment.rb +16 -27
- data/test/unit/bio/test_command.rb +242 -25
- data/test/unit/bio/test_db.rb +3 -16
- data/test/unit/bio/test_feature.rb +4 -16
- data/test/unit/bio/test_location.rb +4 -16
- data/test/unit/bio/test_map.rb +230 -0
- data/test/unit/bio/test_pathway.rb +4 -16
- data/test/unit/bio/test_reference.rb +2 -2
- data/test/unit/bio/test_sequence.rb +7 -19
- data/test/unit/bio/test_shell.rb +3 -16
- data/test/unit/bio/test_tree.rb +593 -0
- data/test/unit/bio/util/restriction_enzyme/analysis/test_calculated_cuts.rb +299 -0
- data/test/unit/bio/util/restriction_enzyme/analysis/test_cut_ranges.rb +103 -0
- data/test/unit/bio/util/restriction_enzyme/analysis/test_sequence_range.rb +240 -0
- data/test/unit/bio/util/restriction_enzyme/double_stranded/test_aligned_strands.rb +100 -0
- data/test/unit/bio/util/restriction_enzyme/double_stranded/test_cut_location_pair.rb +75 -0
- data/test/unit/bio/util/restriction_enzyme/double_stranded/test_cut_location_pair_in_enzyme_notation.rb +73 -0
- data/test/unit/bio/util/restriction_enzyme/double_stranded/test_cut_locations.rb +53 -0
- data/test/unit/bio/util/restriction_enzyme/double_stranded/test_cut_locations_in_enzyme_notation.rb +104 -0
- data/test/unit/bio/util/restriction_enzyme/single_strand/test_cut_locations_in_enzyme_notation.rb +83 -0
- data/test/unit/bio/util/restriction_enzyme/test_analysis.rb +246 -0
- data/test/unit/bio/util/restriction_enzyme/test_cut_symbol.rb +44 -0
- data/test/unit/bio/util/restriction_enzyme/test_double_stranded.rb +115 -0
- data/test/unit/bio/util/restriction_enzyme/test_single_strand.rb +147 -0
- data/test/unit/bio/util/restriction_enzyme/test_single_strand_complement.rb +147 -0
- data/test/unit/bio/util/restriction_enzyme/test_string_formatting.rb +60 -0
- data/test/unit/bio/util/test_color_scheme.rb +6 -18
- data/test/unit/bio/util/test_contingency_table.rb +6 -18
- data/test/unit/bio/util/test_restriction_enzyme.rb +42 -0
- data/test/unit/bio/util/test_sirna.rb +3 -16
- metadata +228 -169
- data/doc/BioRuby.rd.ja +0 -225
- data/doc/Design.rd.ja +0 -341
- data/doc/TODO.rd.ja +0 -138
- data/lib/bio/appl/fasta/format6.rb +0 -37
- data/lib/bio/db/kegg/cell.rb +0 -88
- data/lib/bio/db/kegg/ko.rb +0 -178
- data/lib/bio/shell/rails/Rakefile +0 -10
- data/lib/bio/shell/rails/app/controllers/application.rb +0 -4
- data/lib/bio/shell/rails/app/controllers/shell_controller.rb +0 -94
- data/lib/bio/shell/rails/app/helpers/application_helper.rb +0 -3
- data/lib/bio/shell/rails/app/models/shell_connection.rb +0 -30
- data/lib/bio/shell/rails/app/views/layouts/shell.rhtml +0 -37
- data/lib/bio/shell/rails/app/views/shell/history.rhtml +0 -5
- data/lib/bio/shell/rails/app/views/shell/index.rhtml +0 -2
- data/lib/bio/shell/rails/app/views/shell/show.rhtml +0 -13
- data/lib/bio/shell/rails/config/boot.rb +0 -19
- data/lib/bio/shell/rails/config/database.yml +0 -85
- data/lib/bio/shell/rails/config/environment.rb +0 -53
- data/lib/bio/shell/rails/config/environments/development.rb +0 -19
- data/lib/bio/shell/rails/config/environments/production.rb +0 -19
- data/lib/bio/shell/rails/config/environments/test.rb +0 -19
- data/lib/bio/shell/rails/config/routes.rb +0 -19
- data/lib/bio/shell/rails/doc/README_FOR_APP +0 -2
- data/lib/bio/shell/rails/public/404.html +0 -8
- data/lib/bio/shell/rails/public/500.html +0 -8
- data/lib/bio/shell/rails/public/dispatch.cgi +0 -10
- data/lib/bio/shell/rails/public/dispatch.fcgi +0 -24
- data/lib/bio/shell/rails/public/dispatch.rb +0 -10
- data/lib/bio/shell/rails/public/favicon.ico +0 -0
- data/lib/bio/shell/rails/public/images/rails.png +0 -0
- data/lib/bio/shell/rails/public/index.html +0 -277
- data/lib/bio/shell/rails/public/javascripts/controls.js +0 -750
- data/lib/bio/shell/rails/public/javascripts/dragdrop.js +0 -584
- data/lib/bio/shell/rails/public/javascripts/effects.js +0 -854
- data/lib/bio/shell/rails/public/javascripts/prototype.js +0 -1785
- data/lib/bio/shell/rails/public/robots.txt +0 -1
- data/lib/bio/shell/rails/public/stylesheets/main.css +0 -187
- data/lib/bio/shell/rails/script/about +0 -3
- data/lib/bio/shell/rails/script/breakpointer +0 -3
- data/lib/bio/shell/rails/script/console +0 -3
- data/lib/bio/shell/rails/script/destroy +0 -3
- data/lib/bio/shell/rails/script/generate +0 -3
- data/lib/bio/shell/rails/script/performance/benchmarker +0 -3
- data/lib/bio/shell/rails/script/performance/profiler +0 -3
- data/lib/bio/shell/rails/script/plugin +0 -3
- data/lib/bio/shell/rails/script/process/reaper +0 -3
- data/lib/bio/shell/rails/script/process/spawner +0 -3
- data/lib/bio/shell/rails/script/process/spinner +0 -3
- data/lib/bio/shell/rails/script/runner +0 -3
- data/lib/bio/shell/rails/script/server +0 -42
- data/lib/bio/shell/rails/test/test_helper.rb +0 -28
data/lib/bio/db/nbrf.rb
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
# = bio/db/nbrf.rb - NBRF/PIR format sequence data class
|
|
3
3
|
#
|
|
4
4
|
# Copyright:: Copyright (C) 2001-2003,2006 Naohisa Goto <ng@bioruby.org>
|
|
5
|
-
# Copyright (C) 2001-2002
|
|
6
|
-
# License:: Ruby
|
|
5
|
+
# Copyright (C) 2001-2002 Toshiaki Katayama <k@bioruby.org>
|
|
6
|
+
# License:: The Ruby License
|
|
7
7
|
#
|
|
8
|
-
# $Id: nbrf.rb,v 1.
|
|
8
|
+
# $Id: nbrf.rb,v 1.10 2007/04/05 23:35:40 trevor Exp $
|
|
9
9
|
#
|
|
10
10
|
# Sequence data class for NBRF/PIR flatfile format.
|
|
11
11
|
#
|
|
@@ -0,0 +1,510 @@
|
|
|
1
|
+
#
|
|
2
|
+
# = bio/db/newick.rb - Newick Standard phylogenetic tree parser / formatter
|
|
3
|
+
#
|
|
4
|
+
# Copyright:: Copyright (C) 2004-2006
|
|
5
|
+
# Naohisa Goto <ng@bioruby.org>
|
|
6
|
+
# Daniel Amelang <dan@amelang.net>
|
|
7
|
+
# License:: The Ruby License
|
|
8
|
+
#
|
|
9
|
+
# $Id: newick.rb,v 1.7 2007/04/05 23:35:40 trevor Exp $
|
|
10
|
+
#
|
|
11
|
+
|
|
12
|
+
require 'bio/tree'
|
|
13
|
+
|
|
14
|
+
module Bio
|
|
15
|
+
class Tree
|
|
16
|
+
|
|
17
|
+
#---
|
|
18
|
+
# newick output
|
|
19
|
+
#+++
|
|
20
|
+
|
|
21
|
+
DEFAULT_OPTIONS =
|
|
22
|
+
{ :indent => ' ' }
|
|
23
|
+
|
|
24
|
+
def __get_option(key, options)
|
|
25
|
+
if (r = options[key]) != nil then
|
|
26
|
+
r
|
|
27
|
+
elsif @options && (r = @options[key]) != nil then
|
|
28
|
+
r
|
|
29
|
+
else
|
|
30
|
+
DEFAULT_OPTIONS[key]
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
private :__get_option
|
|
34
|
+
|
|
35
|
+
# formats leaf
|
|
36
|
+
def __to_newick_format_leaf(node, edge, options)
|
|
37
|
+
|
|
38
|
+
label = get_node_name(node).to_s
|
|
39
|
+
|
|
40
|
+
dist = get_edge_distance_string(edge)
|
|
41
|
+
|
|
42
|
+
bs = get_node_bootstrap_string(node)
|
|
43
|
+
|
|
44
|
+
if __get_option(:branch_length_style, options) == :disabled
|
|
45
|
+
dist = nil
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
case __get_option(:bootstrap_style, options)
|
|
49
|
+
when :disabled
|
|
50
|
+
label + (dist ? ":#{dist}" : '')
|
|
51
|
+
when :molphy
|
|
52
|
+
label + (dist ? ":#{dist}" : '') + (bs ? "[#{bs}]" : '')
|
|
53
|
+
when :traditional
|
|
54
|
+
label + (bs ? bs : '') + (dist ? ":#{dist}" : '')
|
|
55
|
+
else
|
|
56
|
+
# default: same as molphy style
|
|
57
|
+
label + (dist ? ":#{dist}" : '') + (bs ? "[#{bs}]" : '')
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
private :__to_newick_format_leaf
|
|
61
|
+
|
|
62
|
+
# formats leaf for NHX
|
|
63
|
+
def __to_newick_format_leaf_NHX(node, edge, options)
|
|
64
|
+
|
|
65
|
+
label = get_node_name(node).to_s
|
|
66
|
+
|
|
67
|
+
dist = get_edge_distance_string(edge)
|
|
68
|
+
|
|
69
|
+
bs = get_node_bootstrap_string(node)
|
|
70
|
+
|
|
71
|
+
if __get_option(:branch_length_style, options) == :disabled
|
|
72
|
+
dist = nil
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
nhx = {}
|
|
76
|
+
|
|
77
|
+
# bootstrap
|
|
78
|
+
nhx[:B] = bs if bs and !(bs.empty?)
|
|
79
|
+
# EC number
|
|
80
|
+
nhx[:E] = node.ec_number if node.instance_eval {
|
|
81
|
+
defined?(@ec_number) && self.ec_number
|
|
82
|
+
}
|
|
83
|
+
# scientific name
|
|
84
|
+
nhx[:S] = node.scientific_name if node.instance_eval {
|
|
85
|
+
defined?(@scientific_name) && self.scientific_name
|
|
86
|
+
}
|
|
87
|
+
# taxonomy id
|
|
88
|
+
nhx[:T] = node.taxonomy_id if node.instance_eval {
|
|
89
|
+
defined?(@taxonomy_id) && self.taxonomy_id
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
# :D (gene duplication or speciation)
|
|
93
|
+
if node.instance_eval { defined?(@events) && !(self.events.empty?) } then
|
|
94
|
+
if node.events.include?(:gene_duplication)
|
|
95
|
+
nhx[:D] = 'Y'
|
|
96
|
+
elsif node.events.include?(:speciation)
|
|
97
|
+
nhx[:D] = 'N'
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
# log likelihood
|
|
102
|
+
nhx[:L] = edge.log_likelihood if edge.instance_eval {
|
|
103
|
+
defined?(@log_likelihood) && self.log_likelihood }
|
|
104
|
+
# width
|
|
105
|
+
nhx[:W] = edge.width if edge.instance_eval {
|
|
106
|
+
defined?(@width) && self.width }
|
|
107
|
+
|
|
108
|
+
# merges other parameters
|
|
109
|
+
flag = node.instance_eval { defined? @nhx_parameters }
|
|
110
|
+
nhx.merge!(node.nhx_parameters) if flag
|
|
111
|
+
flag = edge.instance_eval { defined? @nhx_parameters }
|
|
112
|
+
nhx.merge!(edge.nhx_parameters) if flag
|
|
113
|
+
|
|
114
|
+
nhx_string = nhx.keys.sort{ |a,b| a.to_s <=> b.to_s }.collect do |key|
|
|
115
|
+
"#{key.to_s}=#{nhx[key].to_s}"
|
|
116
|
+
end.join(':')
|
|
117
|
+
nhx_string = "[&&NHX:" + nhx_string + "]" unless nhx_string.empty?
|
|
118
|
+
|
|
119
|
+
label + (dist ? ":#{dist}" : '') + nhx_string
|
|
120
|
+
end
|
|
121
|
+
private :__to_newick_format_leaf_NHX
|
|
122
|
+
|
|
123
|
+
#
|
|
124
|
+
def __to_newick(parents, source, depth, format_leaf,
|
|
125
|
+
options, &block)
|
|
126
|
+
result = []
|
|
127
|
+
if indent_string = __get_option(:indent, options) then
|
|
128
|
+
indent0 = indent_string * depth
|
|
129
|
+
indent = indent_string * (depth + 1)
|
|
130
|
+
newline = "\n"
|
|
131
|
+
else
|
|
132
|
+
indent0 = indent = newline = ''
|
|
133
|
+
end
|
|
134
|
+
out_edges = self.out_edges(source)
|
|
135
|
+
if block_given? then
|
|
136
|
+
out_edges.sort! { |edge1, edge2| yield(edge1[1], edge2[1]) }
|
|
137
|
+
else
|
|
138
|
+
out_edges.sort! do |edge1, edge2|
|
|
139
|
+
o1 = edge1[1].order_number
|
|
140
|
+
o2 = edge2[1].order_number
|
|
141
|
+
if o1 and o2 then
|
|
142
|
+
o1 <=> o2
|
|
143
|
+
else
|
|
144
|
+
edge1[1].name.to_s <=> edge2[1].name.to_s
|
|
145
|
+
end
|
|
146
|
+
end
|
|
147
|
+
end
|
|
148
|
+
out_edges.each do |src, tgt, edge|
|
|
149
|
+
if parents.include?(tgt) then
|
|
150
|
+
;;
|
|
151
|
+
elsif self.out_degree(tgt) == 1 then
|
|
152
|
+
result << indent + __send__(format_leaf, tgt, edge, options)
|
|
153
|
+
else
|
|
154
|
+
result <<
|
|
155
|
+
__to_newick([ src ].concat(parents), tgt, depth + 1,
|
|
156
|
+
format_leaf, options) +
|
|
157
|
+
__send__(format_leaf, tgt, edge, options)
|
|
158
|
+
end
|
|
159
|
+
end
|
|
160
|
+
indent0 + "(" + newline + result.join(',' + newline) +
|
|
161
|
+
(result.size > 0 ? newline : '') + indent0 + ')'
|
|
162
|
+
end
|
|
163
|
+
private :__to_newick
|
|
164
|
+
|
|
165
|
+
# Returns a newick formatted string.
|
|
166
|
+
# If block is given, the order of the node is sorted
|
|
167
|
+
# (as the same manner as Enumerable#sort).
|
|
168
|
+
# Description about options.
|
|
169
|
+
# :indent : indent string; set false to disable (default: ' ')
|
|
170
|
+
# :bootstrap_style : :disabled disables bootstrap representations
|
|
171
|
+
# :traditional traditional style
|
|
172
|
+
# :molphy Molphy style (default)
|
|
173
|
+
def output_newick(options = {}, &block) #:yields: node1, node2
|
|
174
|
+
root = @root
|
|
175
|
+
root ||= self.nodes.first
|
|
176
|
+
return '();' unless root
|
|
177
|
+
__to_newick([], root, 0, :__to_newick_format_leaf, options, &block) +
|
|
178
|
+
__to_newick_format_leaf(root, Edge.new, options) +
|
|
179
|
+
";\n"
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
alias newick output_newick
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
# Returns a NHX (New Hampshire eXtended) formatted string.
|
|
186
|
+
# If block is given, the order of the node is sorted
|
|
187
|
+
# (as the same manner as Enumerable#sort).
|
|
188
|
+
# Description about options.
|
|
189
|
+
# :indent : indent string; set false to disable (default: ' ')
|
|
190
|
+
def output_nhx(options = {}, &block) #:yields: node1, node2
|
|
191
|
+
root = @root
|
|
192
|
+
root ||= self.nodes.first
|
|
193
|
+
return '();' unless root
|
|
194
|
+
__to_newick([], root, 0,
|
|
195
|
+
:__to_newick_format_leaf_NHX, options, &block) +
|
|
196
|
+
__to_newick_format_leaf_NHX(root, Edge.new, options) +
|
|
197
|
+
";\n"
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
# Returns formatted text (or something) of the tree
|
|
201
|
+
# Currently supported format is: :newick, :nhx
|
|
202
|
+
def output(format, *arg, &block)
|
|
203
|
+
case format
|
|
204
|
+
when :newick
|
|
205
|
+
output_newick(*arg, &block)
|
|
206
|
+
when :nhx
|
|
207
|
+
output_nhx(*arg, &block)
|
|
208
|
+
when :phylip_distance_matrix
|
|
209
|
+
output_phylip_distance_matrix(*arg, &block)
|
|
210
|
+
else
|
|
211
|
+
raise 'Unknown format'
|
|
212
|
+
end
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
#---
|
|
216
|
+
# This method isn't suitable to written in this file?
|
|
217
|
+
#+++
|
|
218
|
+
|
|
219
|
+
# Generates phylip-style distance matrix as a string.
|
|
220
|
+
# if nodes is not given, all leaves in the tree are used.
|
|
221
|
+
# If the names of some of the given (or default) nodes
|
|
222
|
+
# are not defined or are empty, the names are automatically generated.
|
|
223
|
+
def output_phylip_distance_matrix(nodes = nil, options = {})
|
|
224
|
+
nodes = self.leaves unless nodes
|
|
225
|
+
names = nodes.collect do |x|
|
|
226
|
+
y = get_node_name(x)
|
|
227
|
+
y = sprintf("%x", x.__id__.abs) if y.empty?
|
|
228
|
+
y
|
|
229
|
+
end
|
|
230
|
+
m = self.distance_matrix(nodes)
|
|
231
|
+
Bio::Phylip::DistanceMatrix.generate(m, names, options)
|
|
232
|
+
end
|
|
233
|
+
|
|
234
|
+
end #class Tree
|
|
235
|
+
|
|
236
|
+
#---
|
|
237
|
+
# newick parser
|
|
238
|
+
#+++
|
|
239
|
+
|
|
240
|
+
# Newick standard phylogenetic tree parser class.
|
|
241
|
+
#
|
|
242
|
+
# This is alpha version. Incompatible changes may be made frequently.
|
|
243
|
+
class Newick
|
|
244
|
+
|
|
245
|
+
# delemiter of the entry
|
|
246
|
+
DELIMITER = RS = ";"
|
|
247
|
+
|
|
248
|
+
# parse error class
|
|
249
|
+
class ParseError < RuntimeError; end
|
|
250
|
+
|
|
251
|
+
# same as Bio::Tree::Edge
|
|
252
|
+
Edge = Bio::Tree::Edge
|
|
253
|
+
|
|
254
|
+
# same as Bio::Tree::Node
|
|
255
|
+
Node = Bio::Tree::Node
|
|
256
|
+
|
|
257
|
+
# Creates a new Newick object.
|
|
258
|
+
# _options_ for parsing can be set.
|
|
259
|
+
#
|
|
260
|
+
# Note: molphy-style bootstrap values may be parsed, even if
|
|
261
|
+
# the options[:bootstrap_style] is set to :traditional or :disabled.
|
|
262
|
+
# Note: By default, if all of the internal node's names are numeric
|
|
263
|
+
# and there are no NHX and no molphy-style boostrap values,
|
|
264
|
+
# the names of internal nodes are regarded as bootstrap values.
|
|
265
|
+
# options[:bootstrap_style] = :disabled or :molphy to disable the feature
|
|
266
|
+
# (or at least one NHX tag exists).
|
|
267
|
+
def initialize(str, options = nil)
|
|
268
|
+
str = str.sub(/\;(.*)/m, ';')
|
|
269
|
+
@original_string = str
|
|
270
|
+
@entry_overrun = $1
|
|
271
|
+
@options = (options or {})
|
|
272
|
+
end
|
|
273
|
+
|
|
274
|
+
# parser options
|
|
275
|
+
# (in some cases, options can be automatically set by the parser)
|
|
276
|
+
attr_reader :options
|
|
277
|
+
|
|
278
|
+
# original string before parsing
|
|
279
|
+
attr_reader :original_string
|
|
280
|
+
|
|
281
|
+
# string after this entry
|
|
282
|
+
attr_reader :entry_overrun
|
|
283
|
+
|
|
284
|
+
# Gets the tree.
|
|
285
|
+
# Returns a Bio::Tree object.
|
|
286
|
+
def tree
|
|
287
|
+
if !defined?(@tree)
|
|
288
|
+
@tree = __parse_newick(@original_string, @options)
|
|
289
|
+
else
|
|
290
|
+
@tree
|
|
291
|
+
end
|
|
292
|
+
end
|
|
293
|
+
|
|
294
|
+
# Re-parses the tree from the original string.
|
|
295
|
+
# Returns self.
|
|
296
|
+
# This method is useful after changing parser options.
|
|
297
|
+
def reparse
|
|
298
|
+
remove_instance_variable(:tree)
|
|
299
|
+
self.tree
|
|
300
|
+
self
|
|
301
|
+
end
|
|
302
|
+
|
|
303
|
+
private
|
|
304
|
+
|
|
305
|
+
# gets a option
|
|
306
|
+
def __get_option(key, options)
|
|
307
|
+
options[key] or (@options ? @options[key] : nil)
|
|
308
|
+
end
|
|
309
|
+
|
|
310
|
+
# Parses newick formatted leaf (or internal node) name.
|
|
311
|
+
def __parse_newick_leaf(str, node, edge, options)
|
|
312
|
+
case str
|
|
313
|
+
when /(.*)\:(.*)\[(.*)\]/
|
|
314
|
+
node.name = $1
|
|
315
|
+
edge.distance_string = $2 if $2 and !($2.strip.empty?)
|
|
316
|
+
# bracketted string into bstr
|
|
317
|
+
bstr = $3
|
|
318
|
+
when /(.*)\[(.*)\]/
|
|
319
|
+
node.name = $1
|
|
320
|
+
# bracketted string into bstr
|
|
321
|
+
bstr = $2
|
|
322
|
+
when /(.*)\:(.*)/
|
|
323
|
+
node.name = $1
|
|
324
|
+
edge.distance_string = $2 if $2 and !($2.strip.empty?)
|
|
325
|
+
else
|
|
326
|
+
node.name = str
|
|
327
|
+
end
|
|
328
|
+
|
|
329
|
+
# determines NHX or Molphy-style bootstrap
|
|
330
|
+
if bstr and !(bstr.strip.empty?)
|
|
331
|
+
case __get_option(:original_format, options)
|
|
332
|
+
when :nhx
|
|
333
|
+
# regarded as NHX string which might be broken
|
|
334
|
+
__parse_nhx(bstr, node, edge)
|
|
335
|
+
when :traditional
|
|
336
|
+
# simply ignored
|
|
337
|
+
else
|
|
338
|
+
case bstr
|
|
339
|
+
when /\A\&\&NHX/
|
|
340
|
+
# NHX string
|
|
341
|
+
# force to set NHX mode
|
|
342
|
+
@options[:original_format] = :nhx
|
|
343
|
+
__parse_nhx(bstr, node, edge)
|
|
344
|
+
else
|
|
345
|
+
# Molphy-style boostrap values
|
|
346
|
+
# let molphy mode if nothing determined
|
|
347
|
+
@options[:original_format] ||= :molphy
|
|
348
|
+
node.bootstrap_string = bstr
|
|
349
|
+
end #case bstr
|
|
350
|
+
end
|
|
351
|
+
end
|
|
352
|
+
|
|
353
|
+
# returns true
|
|
354
|
+
true
|
|
355
|
+
end
|
|
356
|
+
|
|
357
|
+
# Parses NHX (New Hampshire eXtended) string
|
|
358
|
+
def __parse_nhx(bstr, node, edge)
|
|
359
|
+
a = bstr.split(/\:/)
|
|
360
|
+
a.shift if a[0] == '&&NHX'
|
|
361
|
+
a.each do |str|
|
|
362
|
+
tag, val = str.split(/\=/, 2)
|
|
363
|
+
case tag
|
|
364
|
+
when 'B'
|
|
365
|
+
node.bootstrap_string = val
|
|
366
|
+
when 'D'
|
|
367
|
+
case val
|
|
368
|
+
when 'Y'
|
|
369
|
+
node.events.push :gene_duplication
|
|
370
|
+
when 'N'
|
|
371
|
+
node.events.push :speciation
|
|
372
|
+
end
|
|
373
|
+
when 'E'
|
|
374
|
+
node.ec_number = val
|
|
375
|
+
when 'L'
|
|
376
|
+
edge.log_likelihood = val.to_f
|
|
377
|
+
when 'S'
|
|
378
|
+
node.scientific_name = val
|
|
379
|
+
when 'T'
|
|
380
|
+
node.taxonomy_id = val
|
|
381
|
+
when 'W'
|
|
382
|
+
edge.width = val.to_i
|
|
383
|
+
when 'XB'
|
|
384
|
+
edge.nhx_parameters[:XB] = val
|
|
385
|
+
when 'O', 'SO'
|
|
386
|
+
node.nhx_parameters[tag.to_sym] = val.to_i
|
|
387
|
+
else # :Co, :SN, :Sw, :XN, and others
|
|
388
|
+
node.nhx_parameters[tag.to_sym] = val
|
|
389
|
+
end
|
|
390
|
+
end #each
|
|
391
|
+
true
|
|
392
|
+
end
|
|
393
|
+
|
|
394
|
+
# Parses newick formatted string.
|
|
395
|
+
def __parse_newick(str, options = {})
|
|
396
|
+
# initializing
|
|
397
|
+
root = Node.new
|
|
398
|
+
cur_node = root
|
|
399
|
+
edges = []
|
|
400
|
+
nodes = [ root ]
|
|
401
|
+
internal_nodes = []
|
|
402
|
+
node_stack = []
|
|
403
|
+
# preparation of tokens
|
|
404
|
+
str = str.chop if str[-1..-1] == ';'
|
|
405
|
+
ary = str.split(/([\(\)\,])/)
|
|
406
|
+
ary.collect! { |x| x.strip!; x.empty? ? nil : x }
|
|
407
|
+
ary.compact!
|
|
408
|
+
previous_token = nil
|
|
409
|
+
# main loop
|
|
410
|
+
while token = ary.shift
|
|
411
|
+
#p token
|
|
412
|
+
case token
|
|
413
|
+
when ','
|
|
414
|
+
if previous_token == ',' or previous_token == '(' then
|
|
415
|
+
# there is a leaf whose name is empty.
|
|
416
|
+
ary.unshift(token)
|
|
417
|
+
ary.unshift('')
|
|
418
|
+
token = nil
|
|
419
|
+
end
|
|
420
|
+
when '('
|
|
421
|
+
node = Node.new
|
|
422
|
+
nodes << node
|
|
423
|
+
internal_nodes << node
|
|
424
|
+
node_stack.push(cur_node)
|
|
425
|
+
cur_node = node
|
|
426
|
+
when ')'
|
|
427
|
+
if previous_token == ',' or previous_token == '(' then
|
|
428
|
+
# there is a leaf whose name is empty.
|
|
429
|
+
ary.unshift(token)
|
|
430
|
+
ary.unshift('')
|
|
431
|
+
token = nil
|
|
432
|
+
else
|
|
433
|
+
edge = Edge.new
|
|
434
|
+
next_token = ary[0]
|
|
435
|
+
if next_token and next_token != ',' and next_token != ')' then
|
|
436
|
+
__parse_newick_leaf(next_token, cur_node, edge, options)
|
|
437
|
+
ary.shift
|
|
438
|
+
end
|
|
439
|
+
parent = node_stack.pop
|
|
440
|
+
raise ParseError, 'unmatched parentheses' unless parent
|
|
441
|
+
edges << Bio::Relation.new(parent, cur_node, edge)
|
|
442
|
+
cur_node = parent
|
|
443
|
+
end
|
|
444
|
+
else
|
|
445
|
+
leaf = Node.new
|
|
446
|
+
edge = Edge.new
|
|
447
|
+
__parse_newick_leaf(token, leaf, edge, options)
|
|
448
|
+
nodes << leaf
|
|
449
|
+
edges << Bio::Relation.new(cur_node, leaf, edge)
|
|
450
|
+
end #case
|
|
451
|
+
previous_token = token
|
|
452
|
+
end #while
|
|
453
|
+
raise ParseError, 'unmatched parentheses' unless node_stack.empty?
|
|
454
|
+
bsopt = __get_option(:bootstrap_style, options)
|
|
455
|
+
ofmt = __get_option(:original_format, options)
|
|
456
|
+
unless bsopt == :disabled or bsopt == :molphy or
|
|
457
|
+
ofmt == :nhx or ofmt == :molphy then
|
|
458
|
+
# If all of the internal node's names are numeric,
|
|
459
|
+
# the names are regarded as bootstrap values.
|
|
460
|
+
flag = false
|
|
461
|
+
internal_nodes.each do |node|
|
|
462
|
+
if node.name and !node.name.to_s.strip.empty? then
|
|
463
|
+
if /\A[\+\-]?\d*\.?\d*\z/ =~ node.name
|
|
464
|
+
flag = true
|
|
465
|
+
else
|
|
466
|
+
flag = false
|
|
467
|
+
break
|
|
468
|
+
end
|
|
469
|
+
end
|
|
470
|
+
end
|
|
471
|
+
if flag then
|
|
472
|
+
@options[:bootstrap_style] = :traditional
|
|
473
|
+
@options[:original_format] = :traditional
|
|
474
|
+
internal_nodes.each do |node|
|
|
475
|
+
if node.name then
|
|
476
|
+
node.bootstrap_string = node.name
|
|
477
|
+
node.name = nil
|
|
478
|
+
end
|
|
479
|
+
end
|
|
480
|
+
end
|
|
481
|
+
end
|
|
482
|
+
# Sets nodes order numbers
|
|
483
|
+
nodes.each_with_index do |node, i|
|
|
484
|
+
node.order_number = i
|
|
485
|
+
end
|
|
486
|
+
# If the root implicitly prepared by the program is a leaf and
|
|
487
|
+
# there are no additional information for the edge from the root to
|
|
488
|
+
# the first internal node, the root is removed.
|
|
489
|
+
if rel = edges[-1] and rel.node == [ root, internal_nodes[0] ] and
|
|
490
|
+
rel.relation.instance_eval {
|
|
491
|
+
!defined?(@distance) and !defined?(@log_likelihood) and
|
|
492
|
+
!defined?(@width) and !defined?(@nhx_parameters) } and
|
|
493
|
+
edges.find_all { |x| x.node.include?(root) }.size == 1
|
|
494
|
+
nodes.shift
|
|
495
|
+
edges.pop
|
|
496
|
+
end
|
|
497
|
+
# Let the tree into instance variables
|
|
498
|
+
tree = Bio::Tree.new
|
|
499
|
+
tree.instance_eval {
|
|
500
|
+
@pathway.relations.concat(edges)
|
|
501
|
+
@pathway.to_list
|
|
502
|
+
}
|
|
503
|
+
tree.root = nodes[0]
|
|
504
|
+
tree.options.update(@options)
|
|
505
|
+
tree
|
|
506
|
+
end
|
|
507
|
+
end #class Newick
|
|
508
|
+
|
|
509
|
+
end #module Bio
|
|
510
|
+
|