wwood-bioruby 1.2.11
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +205 -0
- data/README_DEV.rdoc +285 -0
- data/VERSION.yml +4 -0
- data/bin/bioruby +44 -0
- data/bin/br_biofetch.rb +47 -0
- data/bin/br_bioflat.rb +293 -0
- data/bin/br_biogetseq.rb +45 -0
- data/bin/br_pmfetch.rb +421 -0
- data/lib/bio.rb +306 -0
- data/lib/bio/alignment.rb +2518 -0
- data/lib/bio/appl/bl2seq/report.rb +334 -0
- data/lib/bio/appl/blast.rb +505 -0
- data/lib/bio/appl/blast/ddbj.rb +142 -0
- data/lib/bio/appl/blast/format0.rb +1438 -0
- data/lib/bio/appl/blast/format8.rb +83 -0
- 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 +105 -0
- data/lib/bio/appl/blast/report.rb +767 -0
- data/lib/bio/appl/blast/rexml.rb +144 -0
- data/lib/bio/appl/blast/rpsblast.rb +277 -0
- data/lib/bio/appl/blast/wublast.rb +635 -0
- data/lib/bio/appl/blast/xmlparser.rb +236 -0
- data/lib/bio/appl/blat/report.rb +530 -0
- data/lib/bio/appl/clustalw.rb +219 -0
- data/lib/bio/appl/clustalw/report.rb +152 -0
- data/lib/bio/appl/emboss.rb +203 -0
- data/lib/bio/appl/fasta.rb +235 -0
- data/lib/bio/appl/fasta/format10.rb +325 -0
- 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 +552 -0
- data/lib/bio/appl/hmmer.rb +126 -0
- data/lib/bio/appl/hmmer/report.rb +683 -0
- data/lib/bio/appl/iprscan/report.rb +374 -0
- data/lib/bio/appl/mafft.rb +259 -0
- data/lib/bio/appl/mafft/report.rb +226 -0
- data/lib/bio/appl/muscle.rb +52 -0
- 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/phylip/alignment.rb +133 -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 +548 -0
- data/lib/bio/appl/psort/report.rb +542 -0
- data/lib/bio/appl/pts1.rb +263 -0
- data/lib/bio/appl/sim4.rb +124 -0
- data/lib/bio/appl/sim4/report.rb +485 -0
- data/lib/bio/appl/sosui/report.rb +151 -0
- data/lib/bio/appl/spidey/report.rb +593 -0
- data/lib/bio/appl/targetp/report.rb +267 -0
- data/lib/bio/appl/tcoffee.rb +55 -0
- data/lib/bio/appl/tmhmm/report.rb +231 -0
- data/lib/bio/command.rb +593 -0
- data/lib/bio/compat/features.rb +157 -0
- data/lib/bio/compat/references.rb +128 -0
- data/lib/bio/data/aa.rb +353 -0
- data/lib/bio/data/codontable.rb +722 -0
- data/lib/bio/data/na.rb +223 -0
- data/lib/bio/db.rb +329 -0
- data/lib/bio/db/aaindex.rb +357 -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 +352 -0
- data/lib/bio/db/embl/embl.rb +500 -0
- 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 +1283 -0
- data/lib/bio/db/embl/swissprot.rb +42 -0
- data/lib/bio/db/embl/trembl.rb +41 -0
- data/lib/bio/db/embl/uniprot.rb +42 -0
- data/lib/bio/db/fantom.rb +597 -0
- data/lib/bio/db/fasta.rb +410 -0
- 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 +307 -0
- data/lib/bio/db/genbank/ddbj.rb +22 -0
- data/lib/bio/db/genbank/format_genbank.rb +187 -0
- data/lib/bio/db/genbank/genbank.rb +250 -0
- data/lib/bio/db/genbank/genbank_to_biosequence.rb +86 -0
- data/lib/bio/db/genbank/genpept.rb +60 -0
- data/lib/bio/db/genbank/refseq.rb +18 -0
- data/lib/bio/db/gff.rb +1846 -0
- data/lib/bio/db/go.rb +481 -0
- data/lib/bio/db/kegg/brite.rb +41 -0
- data/lib/bio/db/kegg/compound.rb +131 -0
- data/lib/bio/db/kegg/drug.rb +98 -0
- data/lib/bio/db/kegg/enzyme.rb +148 -0
- data/lib/bio/db/kegg/expression.rb +155 -0
- data/lib/bio/db/kegg/genes.rb +263 -0
- data/lib/bio/db/kegg/genome.rb +241 -0
- data/lib/bio/db/kegg/glycan.rb +166 -0
- data/lib/bio/db/kegg/keggtab.rb +357 -0
- data/lib/bio/db/kegg/kgml.rb +256 -0
- data/lib/bio/db/kegg/orthology.rb +136 -0
- data/lib/bio/db/kegg/reaction.rb +82 -0
- data/lib/bio/db/kegg/taxonomy.rb +331 -0
- data/lib/bio/db/lasergene.rb +209 -0
- data/lib/bio/db/litdb.rb +107 -0
- data/lib/bio/db/medline.rb +326 -0
- data/lib/bio/db/nbrf.rb +191 -0
- data/lib/bio/db/newick.rb +658 -0
- data/lib/bio/db/nexus.rb +1854 -0
- data/lib/bio/db/pdb.rb +29 -0
- data/lib/bio/db/pdb/atom.rb +77 -0
- data/lib/bio/db/pdb/chain.rb +210 -0
- data/lib/bio/db/pdb/chemicalcomponent.rb +224 -0
- data/lib/bio/db/pdb/model.rb +148 -0
- data/lib/bio/db/pdb/pdb.rb +1911 -0
- data/lib/bio/db/pdb/residue.rb +176 -0
- data/lib/bio/db/pdb/utils.rb +399 -0
- data/lib/bio/db/prosite.rb +597 -0
- data/lib/bio/db/rebase.rb +456 -0
- data/lib/bio/db/soft.rb +404 -0
- data/lib/bio/db/transfac.rb +375 -0
- data/lib/bio/db/url.rb +42 -0
- data/lib/bio/feature.rb +139 -0
- 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 +461 -0
- data/lib/bio/io/dbget.rb +194 -0
- data/lib/bio/io/ddbjxml.rb +638 -0
- data/lib/bio/io/ebisoap.rb +158 -0
- data/lib/bio/io/ensembl.rb +229 -0
- data/lib/bio/io/fastacmd.rb +163 -0
- data/lib/bio/io/fetch.rb +195 -0
- data/lib/bio/io/flatfile.rb +482 -0
- data/lib/bio/io/flatfile/autodetection.rb +545 -0
- data/lib/bio/io/flatfile/bdb.rb +253 -0
- data/lib/bio/io/flatfile/buffer.rb +237 -0
- data/lib/bio/io/flatfile/index.rb +1381 -0
- data/lib/bio/io/flatfile/indexer.rb +805 -0
- data/lib/bio/io/flatfile/splitter.rb +297 -0
- data/lib/bio/io/higet.rb +73 -0
- data/lib/bio/io/hinv.rb +442 -0
- data/lib/bio/io/keggapi.rb +805 -0
- data/lib/bio/io/ncbirest.rb +733 -0
- data/lib/bio/io/ncbisoap.rb +155 -0
- data/lib/bio/io/pubmed.rb +307 -0
- data/lib/bio/io/registry.rb +292 -0
- data/lib/bio/io/soapwsdl.rb +119 -0
- data/lib/bio/io/sql.rb +186 -0
- data/lib/bio/location.rb +867 -0
- data/lib/bio/map.rb +410 -0
- data/lib/bio/pathway.rb +960 -0
- data/lib/bio/reference.rb +602 -0
- data/lib/bio/sequence.rb +456 -0
- data/lib/bio/sequence/aa.rb +152 -0
- data/lib/bio/sequence/adapter.rb +108 -0
- data/lib/bio/sequence/common.rb +310 -0
- data/lib/bio/sequence/compat.rb +123 -0
- data/lib/bio/sequence/dblink.rb +54 -0
- data/lib/bio/sequence/format.rb +358 -0
- data/lib/bio/sequence/format_raw.rb +23 -0
- data/lib/bio/sequence/generic.rb +24 -0
- data/lib/bio/sequence/na.rb +491 -0
- data/lib/bio/shell.rb +44 -0
- data/lib/bio/shell/core.rb +578 -0
- data/lib/bio/shell/demo.rb +146 -0
- data/lib/bio/shell/interface.rb +218 -0
- data/lib/bio/shell/irb.rb +95 -0
- data/lib/bio/shell/object.rb +71 -0
- data/lib/bio/shell/plugin/blast.rb +42 -0
- data/lib/bio/shell/plugin/codon.rb +218 -0
- data/lib/bio/shell/plugin/das.rb +58 -0
- data/lib/bio/shell/plugin/emboss.rb +23 -0
- data/lib/bio/shell/plugin/entry.rb +105 -0
- data/lib/bio/shell/plugin/flatfile.rb +101 -0
- data/lib/bio/shell/plugin/keggapi.rb +181 -0
- data/lib/bio/shell/plugin/midi.rb +430 -0
- data/lib/bio/shell/plugin/obda.rb +45 -0
- data/lib/bio/shell/plugin/psort.rb +56 -0
- data/lib/bio/shell/plugin/seq.rb +247 -0
- data/lib/bio/shell/plugin/soap.rb +87 -0
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/bioruby_generator.rb +29 -0
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/_classes.rhtml +4 -0
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/_log.rhtml +27 -0
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/_methods.rhtml +11 -0
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/_modules.rhtml +4 -0
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/_variables.rhtml +7 -0
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/bioruby-bg.gif +0 -0
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/bioruby-gem.png +0 -0
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/bioruby-link.gif +0 -0
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/bioruby.css +368 -0
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/bioruby.rhtml +47 -0
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/bioruby_controller.rb +144 -0
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/bioruby_helper.rb +47 -0
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/commands.rhtml +8 -0
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/history.rhtml +10 -0
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/index.rhtml +26 -0
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/spinner.gif +0 -0
- data/lib/bio/shell/script.rb +25 -0
- data/lib/bio/shell/setup.rb +109 -0
- data/lib/bio/shell/web.rb +102 -0
- data/lib/bio/tree.rb +852 -0
- data/lib/bio/util/color_scheme.rb +191 -0
- data/lib/bio/util/color_scheme/buried.rb +59 -0
- data/lib/bio/util/color_scheme/helix.rb +59 -0
- data/lib/bio/util/color_scheme/hydropathy.rb +64 -0
- data/lib/bio/util/color_scheme/nucleotide.rb +31 -0
- data/lib/bio/util/color_scheme/strand.rb +59 -0
- data/lib/bio/util/color_scheme/taylor.rb +50 -0
- data/lib/bio/util/color_scheme/turn.rb +59 -0
- data/lib/bio/util/color_scheme/zappo.rb +50 -0
- data/lib/bio/util/contingency_table.rb +370 -0
- 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 +200 -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 +288 -0
- data/test/data/HMMER/hmmpfam.out +64 -0
- data/test/data/HMMER/hmmsearch.out +88 -0
- data/test/data/SOSUI/sample.report +11 -0
- data/test/data/TMHMM/sample.report +21 -0
- data/test/data/aaindex/DAYM780301 +30 -0
- data/test/data/aaindex/PRAM900102 +20 -0
- data/test/data/bl2seq/cd8a_cd8b_blastp.bl2seq +53 -0
- data/test/data/bl2seq/cd8a_p53_e-5blastp.bl2seq +37 -0
- data/test/data/blast/2.2.15.blastp.m7 +876 -0
- data/test/data/blast/b0002.faa +15 -0
- data/test/data/blast/b0002.faa.m0 +128 -0
- data/test/data/blast/b0002.faa.m7 +65 -0
- data/test/data/blast/b0002.faa.m8 +1 -0
- data/test/data/blast/blastp-multi.m7 +188 -0
- data/test/data/command/echoarg2.bat +1 -0
- data/test/data/embl/AB090716.embl +65 -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/genscan/sample.report +63 -0
- data/test/data/iprscan/merged.raw +32 -0
- data/test/data/iprscan/merged.txt +74 -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/prosite/prosite.dat +2233 -0
- data/test/data/refseq/nm_126355.entret +64 -0
- data/test/data/rpsblast/misc.rpsblast +193 -0
- data/test/data/soft/GDS100_partial.soft +92 -0
- data/test/data/soft/GSE3457_family_partial.soft +874 -0
- data/test/data/uniprot/p53_human.uniprot +1456 -0
- data/test/functional/bio/appl/test_pts1.rb +115 -0
- data/test/functional/bio/io/test_ensembl.rb +229 -0
- data/test/functional/bio/io/test_soapwsdl.rb +52 -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 +14 -0
- data/test/unit/bio/appl/bl2seq/test_report.rb +134 -0
- data/test/unit/bio/appl/blast/test_ncbioptions.rb +112 -0
- data/test/unit/bio/appl/blast/test_report.rb +1135 -0
- data/test/unit/bio/appl/blast/test_rpsblast.rb +398 -0
- data/test/unit/bio/appl/genscan/test_report.rb +182 -0
- data/test/unit/bio/appl/hmmer/test_report.rb +342 -0
- 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/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/sosui/test_report.rb +81 -0
- data/test/unit/bio/appl/targetp/test_report.rb +146 -0
- data/test/unit/bio/appl/test_blast.rb +277 -0
- data/test/unit/bio/appl/test_fasta.rb +130 -0
- data/test/unit/bio/appl/test_psort.rb +57 -0
- data/test/unit/bio/appl/test_pts1.rb +77 -0
- data/test/unit/bio/appl/tmhmm/test_report.rb +126 -0
- data/test/unit/bio/data/test_aa.rb +90 -0
- data/test/unit/bio/data/test_codontable.rb +107 -0
- data/test/unit/bio/data/test_na.rb +80 -0
- data/test/unit/bio/db/embl/test_common.rb +117 -0
- data/test/unit/bio/db/embl/test_embl.rb +214 -0
- data/test/unit/bio/db/embl/test_embl_rel89.rb +219 -0
- data/test/unit/bio/db/embl/test_embl_to_bioseq.rb +203 -0
- data/test/unit/bio/db/embl/test_sptr.rb +1812 -0
- data/test/unit/bio/db/embl/test_uniprot.rb +31 -0
- data/test/unit/bio/db/kegg/test_genes.rb +45 -0
- data/test/unit/bio/db/pdb/test_pdb.rb +152 -0
- data/test/unit/bio/db/test_aaindex.rb +197 -0
- data/test/unit/bio/db/test_fasta.rb +250 -0
- data/test/unit/bio/db/test_gff.rb +1190 -0
- data/test/unit/bio/db/test_lasergene.rb +95 -0
- data/test/unit/bio/db/test_medline.rb +127 -0
- data/test/unit/bio/db/test_newick.rb +293 -0
- data/test/unit/bio/db/test_nexus.rb +364 -0
- data/test/unit/bio/db/test_prosite.rb +1437 -0
- data/test/unit/bio/db/test_rebase.rb +101 -0
- data/test/unit/bio/db/test_soft.rb +138 -0
- data/test/unit/bio/db/test_url.rb +36 -0
- 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 +80 -0
- data/test/unit/bio/io/test_ensembl.rb +109 -0
- data/test/unit/bio/io/test_fastacmd.rb +42 -0
- data/test/unit/bio/io/test_flatfile.rb +505 -0
- data/test/unit/bio/io/test_soapwsdl.rb +32 -0
- data/test/unit/bio/sequence/test_aa.rb +115 -0
- data/test/unit/bio/sequence/test_common.rb +373 -0
- data/test/unit/bio/sequence/test_compat.rb +69 -0
- data/test/unit/bio/sequence/test_dblink.rb +58 -0
- data/test/unit/bio/sequence/test_na.rb +330 -0
- data/test/unit/bio/shell/plugin/test_seq.rb +185 -0
- data/test/unit/bio/test_alignment.rb +1025 -0
- data/test/unit/bio/test_command.rb +349 -0
- data/test/unit/bio/test_db.rb +96 -0
- data/test/unit/bio/test_feature.rb +144 -0
- data/test/unit/bio/test_location.rb +599 -0
- data/test/unit/bio/test_map.rb +230 -0
- data/test/unit/bio/test_pathway.rb +499 -0
- data/test/unit/bio/test_reference.rb +252 -0
- data/test/unit/bio/test_sequence.rb +329 -0
- data/test/unit/bio/test_shell.rb +18 -0
- 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 +101 -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 +33 -0
- data/test/unit/bio/util/test_contingency_table.rb +94 -0
- data/test/unit/bio/util/test_restriction_enzyme.rb +42 -0
- data/test/unit/bio/util/test_sirna.rb +245 -0
- metadata +543 -0
data/lib/bio/data/na.rb
ADDED
@@ -0,0 +1,223 @@
|
|
1
|
+
#
|
2
|
+
# = bio/data/na.rb - Nucleic Acids
|
3
|
+
#
|
4
|
+
# Copyright:: Copyright (C) 2001, 2005
|
5
|
+
# Toshiaki Katayama <k@bioruby.org>
|
6
|
+
# License:: The Ruby License
|
7
|
+
#
|
8
|
+
# $Id: na.rb,v 0.23 2007/04/06 04:41:28 k Exp $
|
9
|
+
#
|
10
|
+
# == Synopsis
|
11
|
+
#
|
12
|
+
# Bio::NucleicAcid class contains data related to nucleic acids.
|
13
|
+
#
|
14
|
+
# == Usage
|
15
|
+
#
|
16
|
+
# Examples:
|
17
|
+
#
|
18
|
+
# require 'bio'
|
19
|
+
#
|
20
|
+
# puts "### na = Bio::NucleicAcid.new"
|
21
|
+
# na = Bio::NucleicAcid.new
|
22
|
+
#
|
23
|
+
# puts "# na.to_re('yrwskmbdhvnatgc')"
|
24
|
+
# p na.to_re('yrwskmbdhvnatgc')
|
25
|
+
#
|
26
|
+
# puts "# Bio::NucleicAcid.to_re('yrwskmbdhvnatgc')"
|
27
|
+
# p Bio::NucleicAcid.to_re('yrwskmbdhvnatgc')
|
28
|
+
#
|
29
|
+
# puts "# na.weight('A')"
|
30
|
+
# p na.weight('A')
|
31
|
+
#
|
32
|
+
# puts "# Bio::NucleicAcid.weight('A')"
|
33
|
+
# p Bio::NucleicAcid.weight('A')
|
34
|
+
#
|
35
|
+
# puts "# na.weight('atgc')"
|
36
|
+
# p na.weight('atgc')
|
37
|
+
#
|
38
|
+
# puts "# Bio::NucleicAcid.weight('atgc')"
|
39
|
+
# p Bio::NucleicAcid.weight('atgc')
|
40
|
+
#
|
41
|
+
|
42
|
+
module Bio
|
43
|
+
|
44
|
+
class NucleicAcid
|
45
|
+
|
46
|
+
module Data
|
47
|
+
|
48
|
+
# IUPAC code
|
49
|
+
# * Faisst and Meyer (Nucleic Acids Res. 20:3-26, 1992)
|
50
|
+
# * http://www.ncbi.nlm.nih.gov/collab/FT/
|
51
|
+
|
52
|
+
NAMES = {
|
53
|
+
|
54
|
+
'y' => '[tc]',
|
55
|
+
'r' => '[ag]',
|
56
|
+
'w' => '[at]',
|
57
|
+
's' => '[gc]',
|
58
|
+
'k' => '[tg]',
|
59
|
+
'm' => '[ac]',
|
60
|
+
|
61
|
+
'b' => '[tgc]',
|
62
|
+
'd' => '[atg]',
|
63
|
+
'h' => '[atc]',
|
64
|
+
'v' => '[agc]',
|
65
|
+
|
66
|
+
'n' => '[atgc]',
|
67
|
+
|
68
|
+
'a' => 'a',
|
69
|
+
't' => 't',
|
70
|
+
'g' => 'g',
|
71
|
+
'c' => 'c',
|
72
|
+
'u' => 'u',
|
73
|
+
|
74
|
+
'A' => 'Adenine',
|
75
|
+
'T' => 'Thymine',
|
76
|
+
'G' => 'Guanine',
|
77
|
+
'C' => 'Cytosine',
|
78
|
+
'U' => 'Uracil',
|
79
|
+
|
80
|
+
'Y' => 'pYrimidine',
|
81
|
+
'R' => 'puRine',
|
82
|
+
'W' => 'Weak',
|
83
|
+
'S' => 'Strong',
|
84
|
+
'K' => 'Keto',
|
85
|
+
'M' => 'aroMatic',
|
86
|
+
|
87
|
+
'B' => 'not A',
|
88
|
+
'D' => 'not C',
|
89
|
+
'H' => 'not G',
|
90
|
+
'V' => 'not T',
|
91
|
+
}
|
92
|
+
|
93
|
+
WEIGHT = {
|
94
|
+
|
95
|
+
# Calculated by BioPerl's Bio::Tools::SeqStats.pm :-)
|
96
|
+
|
97
|
+
'a' => 135.15,
|
98
|
+
't' => 126.13,
|
99
|
+
'g' => 151.15,
|
100
|
+
'c' => 111.12,
|
101
|
+
'u' => 112.10,
|
102
|
+
|
103
|
+
:adenine => 135.15,
|
104
|
+
:thymine => 126.13,
|
105
|
+
:guanine => 151.15,
|
106
|
+
:cytosine => 111.12,
|
107
|
+
:uracil => 112.10,
|
108
|
+
|
109
|
+
:deoxyribose_phosphate => 196.11,
|
110
|
+
:ribose_phosphate => 212.11,
|
111
|
+
|
112
|
+
:hydrogen => 1.00794,
|
113
|
+
:water => 18.015,
|
114
|
+
|
115
|
+
}
|
116
|
+
|
117
|
+
def weight(x = nil, rna = nil)
|
118
|
+
if x
|
119
|
+
if x.length > 1
|
120
|
+
if rna
|
121
|
+
phosphate = WEIGHT[:ribose_phosphate]
|
122
|
+
else
|
123
|
+
phosphate = WEIGHT[:deoxyribose_phosphate]
|
124
|
+
end
|
125
|
+
hydrogen = WEIGHT[:hydrogen]
|
126
|
+
water = WEIGHT[:water]
|
127
|
+
|
128
|
+
total = 0.0
|
129
|
+
x.each_byte do |byte|
|
130
|
+
base = byte.chr.downcase
|
131
|
+
if WEIGHT[base]
|
132
|
+
total += WEIGHT[base] + phosphate - hydrogen * 2
|
133
|
+
else
|
134
|
+
raise "Error: invalid nucleic acid '#{base}'"
|
135
|
+
end
|
136
|
+
end
|
137
|
+
total -= water * (x.length - 1)
|
138
|
+
else
|
139
|
+
WEIGHT[x.to_s.downcase]
|
140
|
+
end
|
141
|
+
else
|
142
|
+
WEIGHT
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
def [](x)
|
147
|
+
NAMES[x]
|
148
|
+
end
|
149
|
+
|
150
|
+
# backward compatibility
|
151
|
+
def names
|
152
|
+
NAMES
|
153
|
+
end
|
154
|
+
alias na names
|
155
|
+
|
156
|
+
def name(x)
|
157
|
+
NAMES[x.to_s.upcase]
|
158
|
+
end
|
159
|
+
|
160
|
+
def to_re(seq, rna = false)
|
161
|
+
replace = {
|
162
|
+
'y' => '[tcy]',
|
163
|
+
'r' => '[agr]',
|
164
|
+
'w' => '[atw]',
|
165
|
+
's' => '[gcw]',
|
166
|
+
'k' => '[tgk]',
|
167
|
+
'm' => '[acm]',
|
168
|
+
'b' => '[tgcyskb]',
|
169
|
+
'd' => '[atgrwkd]',
|
170
|
+
'h' => '[atcwmyh]',
|
171
|
+
'v' => '[agcmrsv]',
|
172
|
+
'n' => '[atgcyrwskmbdhvn]'
|
173
|
+
}
|
174
|
+
replace.default = '.'
|
175
|
+
|
176
|
+
str = seq.to_s.downcase
|
177
|
+
str.gsub!(/[^atgcu]/) { |na|
|
178
|
+
replace[na]
|
179
|
+
}
|
180
|
+
if rna
|
181
|
+
str.tr!("t", "u")
|
182
|
+
end
|
183
|
+
Regexp.new(str)
|
184
|
+
end
|
185
|
+
|
186
|
+
end
|
187
|
+
|
188
|
+
|
189
|
+
# as instance methods
|
190
|
+
include Data
|
191
|
+
|
192
|
+
# as class methods
|
193
|
+
extend Data
|
194
|
+
|
195
|
+
end
|
196
|
+
|
197
|
+
end # module Bio
|
198
|
+
|
199
|
+
|
200
|
+
if __FILE__ == $0
|
201
|
+
|
202
|
+
puts "### na = Bio::NucleicAcid.new"
|
203
|
+
na = Bio::NucleicAcid.new
|
204
|
+
|
205
|
+
puts "# na.to_re('yrwskmbdhvnatgc')"
|
206
|
+
p na.to_re('yrwskmbdhvnatgc')
|
207
|
+
|
208
|
+
puts "# Bio::NucleicAcid.to_re('yrwskmbdhvnatgc')"
|
209
|
+
p Bio::NucleicAcid.to_re('yrwskmbdhvnatgc')
|
210
|
+
|
211
|
+
puts "# na.weight('A')"
|
212
|
+
p na.weight('A')
|
213
|
+
|
214
|
+
puts "# Bio::NucleicAcid.weight('A')"
|
215
|
+
p Bio::NucleicAcid.weight('A')
|
216
|
+
|
217
|
+
puts "# na.weight('atgc')"
|
218
|
+
p na.weight('atgc')
|
219
|
+
|
220
|
+
puts "# Bio::NucleicAcid.weight('atgc')"
|
221
|
+
p Bio::NucleicAcid.weight('atgc')
|
222
|
+
|
223
|
+
end
|
data/lib/bio/db.rb
ADDED
@@ -0,0 +1,329 @@
|
|
1
|
+
#
|
2
|
+
# = bio/db.rb - common API for database parsers
|
3
|
+
#
|
4
|
+
# Copyright:: Copyright (C) 2001, 2002, 2005
|
5
|
+
# Toshiaki Katayama <k@bioruby.org>
|
6
|
+
# License:: The Ruby License
|
7
|
+
#
|
8
|
+
# $Id: db.rb,v 0.38 2007/05/08 17:02:13 nakao Exp $
|
9
|
+
#
|
10
|
+
# == On-demand parsing and cache
|
11
|
+
#
|
12
|
+
# The flatfile parsers (sub classes of the Bio::DB) split the original entry
|
13
|
+
# into a Hash and store the hash in the @orig instance variable. To parse
|
14
|
+
# in detail is delayed until the method is called which requires a further
|
15
|
+
# parsing of a content of the @orig hash. Fully parsed data is cached in the
|
16
|
+
# another hash, @data, separately.
|
17
|
+
#
|
18
|
+
# == Guide lines for the developers to create an new database class
|
19
|
+
#
|
20
|
+
# --- Bio::DB.new(entry)
|
21
|
+
#
|
22
|
+
# The 'new' method should accept the entire entry in one String and
|
23
|
+
# return the parsed database object.
|
24
|
+
#
|
25
|
+
# --- Bio::DB#entry_id
|
26
|
+
#
|
27
|
+
# Database classes should implement the following methods if appropriate:
|
28
|
+
#
|
29
|
+
# * entry_id
|
30
|
+
# * definition
|
31
|
+
#
|
32
|
+
# Every sub class should define the following constants if appropriate:
|
33
|
+
#
|
34
|
+
# * DELIMITER (RS)
|
35
|
+
# * entry separator of the flatfile of the database.
|
36
|
+
# * RS (= record separator) is an alias for the DELIMITER in short.
|
37
|
+
#
|
38
|
+
# * TAGSIZE
|
39
|
+
# * length of the tag field in the FORTRAN-like format.
|
40
|
+
#
|
41
|
+
# |<- tag ->||<- data ---->|
|
42
|
+
# ENTRY_ID A12345
|
43
|
+
# DEFINITION Hoge gene of the Pokemonia pikachuae
|
44
|
+
#
|
45
|
+
# === Template of the sub class
|
46
|
+
#
|
47
|
+
# module Bio
|
48
|
+
# class Hoge < DB
|
49
|
+
#
|
50
|
+
# DELIMITER = RS = "\n//\n"
|
51
|
+
# TAGSIZE = 12 # You can omit this line if not needed
|
52
|
+
#
|
53
|
+
# def initialize(entry)
|
54
|
+
# end
|
55
|
+
#
|
56
|
+
# def entry_id
|
57
|
+
# end
|
58
|
+
#
|
59
|
+
# end # class Hoge
|
60
|
+
# end # module Bio
|
61
|
+
#
|
62
|
+
# === Recommended method names for sub classes
|
63
|
+
#
|
64
|
+
# In general, the method name should be in the singular form when returns
|
65
|
+
# a Object (including the case when the Object is a String), and should be
|
66
|
+
# the plural form when returns same Objects in Array. It depends on the
|
67
|
+
# database classes that which form of the method name can be use.
|
68
|
+
#
|
69
|
+
# For example, GenBank has several REFERENCE fields in one entry, so define
|
70
|
+
# Bio::GenBank#references and this method should return an Array of the
|
71
|
+
# Reference objects. On the other hand, MEDLINE has one REFERENCE information
|
72
|
+
# per one entry, so define Bio::MEDLINE#reference method and this should
|
73
|
+
# return a Reference object.
|
74
|
+
#
|
75
|
+
# The method names used in the sub classes should be taken from the following
|
76
|
+
# list if appropriate:
|
77
|
+
#
|
78
|
+
# --- entry_id #=> String
|
79
|
+
#
|
80
|
+
# The entry identifier.
|
81
|
+
#
|
82
|
+
# --- definition #=> String
|
83
|
+
#
|
84
|
+
# The description of the entry.
|
85
|
+
#
|
86
|
+
# --- reference #=> Bio::Reference
|
87
|
+
# --- references #=> Array of Bio::Reference
|
88
|
+
#
|
89
|
+
# The reference field(s) of the entry.
|
90
|
+
#
|
91
|
+
# --- dblink #=> String
|
92
|
+
# --- dblinks #=> Array of String
|
93
|
+
#
|
94
|
+
# The link(s) to the other database entry.
|
95
|
+
#
|
96
|
+
# --- naseq #=> Bio::Sequence::NA
|
97
|
+
#
|
98
|
+
# The DNA/RNA sequence of the entry.
|
99
|
+
#
|
100
|
+
# --- nalen #=> Integer
|
101
|
+
#
|
102
|
+
# The length of the DNA/RNA sequence of the entry.
|
103
|
+
#
|
104
|
+
# --- aaseq #=> Bio::Sequence::AA
|
105
|
+
#
|
106
|
+
# The amino acid sequence of the entry.
|
107
|
+
#
|
108
|
+
# --- aalen #=> Integer
|
109
|
+
#
|
110
|
+
# The length of the amino acid sequence of the entry.
|
111
|
+
#
|
112
|
+
# --- seq #=> Bio::Sequence::NA or Bio::Sequence::AA
|
113
|
+
#
|
114
|
+
# Returns an appropriate sequence object.
|
115
|
+
#
|
116
|
+
# --- position #=> String
|
117
|
+
#
|
118
|
+
# The position of the sequence in the entry or in the genome (depends on
|
119
|
+
# the database).
|
120
|
+
#
|
121
|
+
# --- locations #=> Bio::Locations
|
122
|
+
#
|
123
|
+
# Returns Bio::Locations.new(position).
|
124
|
+
#
|
125
|
+
# --- division #=> String
|
126
|
+
#
|
127
|
+
# The sub division name of the database.
|
128
|
+
#
|
129
|
+
# * Example:
|
130
|
+
# * EST, VRL etc. for GenBank
|
131
|
+
# * PATTERN, RULE etc. for PROSITE
|
132
|
+
#
|
133
|
+
# --- date #=> String
|
134
|
+
#
|
135
|
+
# The date of the entry.
|
136
|
+
# Should we use Date (by ParseDate) instead of String?
|
137
|
+
#
|
138
|
+
# --- gene #=> String
|
139
|
+
# --- genes #=> Array of String
|
140
|
+
#
|
141
|
+
# The name(s) of the gene.
|
142
|
+
#
|
143
|
+
# --- organism #=> String
|
144
|
+
#
|
145
|
+
# The name of the organism.
|
146
|
+
#
|
147
|
+
|
148
|
+
require 'bio/sequence'
|
149
|
+
require 'bio/reference'
|
150
|
+
require 'bio/feature'
|
151
|
+
|
152
|
+
module Bio
|
153
|
+
|
154
|
+
class DB
|
155
|
+
|
156
|
+
def self.open(filename, *mode, &block)
|
157
|
+
Bio::FlatFile.open(self, filename, *mode, &block)
|
158
|
+
end
|
159
|
+
|
160
|
+
# Returns an entry identifier as a String. This method must be
|
161
|
+
# implemented in every database classes by overriding this method.
|
162
|
+
def entry_id
|
163
|
+
raise NotImplementedError
|
164
|
+
end
|
165
|
+
|
166
|
+
# Returns a list of the top level tags of the entry as an Array of String.
|
167
|
+
def tags
|
168
|
+
@orig.keys
|
169
|
+
end
|
170
|
+
|
171
|
+
# Returns true or false - wether the entry contains the field of the
|
172
|
+
# given tag name.
|
173
|
+
def exists?(tag)
|
174
|
+
@orig.include?(tag)
|
175
|
+
end
|
176
|
+
|
177
|
+
# Returns an intact field of the tag as a String.
|
178
|
+
def get(tag)
|
179
|
+
@orig[tag]
|
180
|
+
end
|
181
|
+
|
182
|
+
# Similar to the get method, however, fetch returns the content of the
|
183
|
+
# field without its tag and any extra white spaces stripped.
|
184
|
+
def fetch(tag, skip = 0)
|
185
|
+
field = @orig[tag].split(/\n/, skip + 1).last.to_s
|
186
|
+
truncate(field.gsub(/^.{0,#{@tagsize}}/,''))
|
187
|
+
end
|
188
|
+
|
189
|
+
|
190
|
+
private
|
191
|
+
|
192
|
+
# Returns a String with successive white spaces are replaced by one
|
193
|
+
# space and stripeed.
|
194
|
+
def truncate(str)
|
195
|
+
str ||= ""
|
196
|
+
return str.gsub(/\s+/, ' ').strip
|
197
|
+
end
|
198
|
+
|
199
|
+
# Returns a tag name of the field as a String.
|
200
|
+
def tag_get(str)
|
201
|
+
str ||= ""
|
202
|
+
return str[0,@tagsize].strip
|
203
|
+
end
|
204
|
+
|
205
|
+
# Returns a String of the field without a tag name.
|
206
|
+
def tag_cut(str)
|
207
|
+
str ||= ""
|
208
|
+
str[0,@tagsize] = ''
|
209
|
+
return str
|
210
|
+
end
|
211
|
+
|
212
|
+
# Returns the content of the field as a String like the fetch method.
|
213
|
+
# Furthermore, field_fetch stores the result in the @data hash.
|
214
|
+
def field_fetch(tag, skip = 0)
|
215
|
+
unless @data[tag]
|
216
|
+
@data[tag] = fetch(tag, skip)
|
217
|
+
end
|
218
|
+
return @data[tag]
|
219
|
+
end
|
220
|
+
|
221
|
+
# Returns an Array containing each line of the field without a tag.
|
222
|
+
# lines_fetch also stores the result in the @data hash.
|
223
|
+
def lines_fetch(tag)
|
224
|
+
unless @data[tag]
|
225
|
+
list = []
|
226
|
+
lines = get(tag).split(/\n/)
|
227
|
+
lines.each do |line|
|
228
|
+
data = tag_cut(line)
|
229
|
+
if data[/^\S/] # next sub field
|
230
|
+
list << data
|
231
|
+
else # continued sub field
|
232
|
+
data.strip!
|
233
|
+
if list.last[/\-$/] # folded
|
234
|
+
list[-1] += data
|
235
|
+
else
|
236
|
+
list[-1] += " #{data}" # rest of list
|
237
|
+
end
|
238
|
+
end
|
239
|
+
end
|
240
|
+
@data[tag] = list
|
241
|
+
end
|
242
|
+
@data[tag]
|
243
|
+
end
|
244
|
+
|
245
|
+
end # class DB
|
246
|
+
|
247
|
+
|
248
|
+
# Stores a NCBI style (GenBank, KEGG etc.) entry.
|
249
|
+
class NCBIDB < DB
|
250
|
+
|
251
|
+
autoload :Common, 'bio/db/genbank/common'
|
252
|
+
|
253
|
+
# The entire entry is passed as a String. The length of the tag field is
|
254
|
+
# passed as an Integer. Parses the entry roughly by the entry2hash method
|
255
|
+
# and returns a database object.
|
256
|
+
def initialize(entry, tagsize)
|
257
|
+
@tagsize = tagsize
|
258
|
+
@orig = entry2hash(entry.strip) # Hash of the original entry
|
259
|
+
@data = {} # Hash of the parsed entry
|
260
|
+
end
|
261
|
+
|
262
|
+
private
|
263
|
+
|
264
|
+
# Splits an entry into an Array of Strings at the level of top tags.
|
265
|
+
def toptag2array(str)
|
266
|
+
sep = "\001"
|
267
|
+
str.gsub(/\n([A-Za-z\/\*])/, "\n#{sep}\\1").split(sep)
|
268
|
+
end
|
269
|
+
|
270
|
+
# Splits a field into an Array of Strings at the level of sub tags.
|
271
|
+
def subtag2array(str)
|
272
|
+
sep = "\001"
|
273
|
+
str.gsub(/\n(\s{1,#{@tagsize-1}}\S)/, "\n#{sep}\\1").split(sep)
|
274
|
+
end
|
275
|
+
|
276
|
+
# Returns the contents of the entry as a Hash with the top level tags as
|
277
|
+
# its keys.
|
278
|
+
def entry2hash(entry)
|
279
|
+
hash = Hash.new('')
|
280
|
+
|
281
|
+
fields = toptag2array(entry)
|
282
|
+
|
283
|
+
fields.each do |field|
|
284
|
+
tag = tag_get(field)
|
285
|
+
hash[tag] += field
|
286
|
+
end
|
287
|
+
return hash
|
288
|
+
end
|
289
|
+
|
290
|
+
end # class NCBIDB
|
291
|
+
|
292
|
+
|
293
|
+
# Class for KEGG databases. Inherits a NCBIDB class.
|
294
|
+
class KEGGDB < NCBIDB
|
295
|
+
end
|
296
|
+
|
297
|
+
|
298
|
+
# Stores an EMBL style (EMBL, TrEMBL, Swiss-Prot etc.) entry.
|
299
|
+
class EMBLDB < DB
|
300
|
+
|
301
|
+
autoload :Common, 'bio/db/embl/common'
|
302
|
+
|
303
|
+
# The entire entry is passed as a String. The length of the tag field is
|
304
|
+
# passed as an Integer. Parses the entry roughly by the entry2hash method
|
305
|
+
# and returns a database object.
|
306
|
+
def initialize(entry, tagsize)
|
307
|
+
@tagsize = tagsize
|
308
|
+
@orig = entry2hash(entry.strip) # Hash of the original entry
|
309
|
+
@data = {} # Hash of the parsed entry
|
310
|
+
end
|
311
|
+
|
312
|
+
private
|
313
|
+
|
314
|
+
# Returns the contents of the entry as a Hash.
|
315
|
+
def entry2hash(entry)
|
316
|
+
hash = Hash.new { |h,k| h[k] = '' }
|
317
|
+
entry.each_line do |line|
|
318
|
+
tag = tag_get(line)
|
319
|
+
next if tag == 'XX'
|
320
|
+
tag = 'R' if tag =~ /^R./ # Reference lines
|
321
|
+
hash[tag].concat line
|
322
|
+
end
|
323
|
+
return hash
|
324
|
+
end
|
325
|
+
|
326
|
+
end # class EMBLDB
|
327
|
+
|
328
|
+
end # module Bio
|
329
|
+
|