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/db/litdb.rb
ADDED
@@ -0,0 +1,107 @@
|
|
1
|
+
#
|
2
|
+
# = bio/db/litdb.rb - LITDB database class
|
3
|
+
#
|
4
|
+
# Copyright:: Copyright (C) 2001 Toshiaki Katayama <k@bioruby.org>
|
5
|
+
# License:: The Ruby License
|
6
|
+
#
|
7
|
+
# $Id: litdb.rb,v 0.10 2007/04/05 23:35:40 trevor Exp $
|
8
|
+
#
|
9
|
+
|
10
|
+
require 'bio/db'
|
11
|
+
|
12
|
+
module Bio
|
13
|
+
|
14
|
+
# = LITDB class
|
15
|
+
class LITDB < NCBIDB
|
16
|
+
|
17
|
+
# Delimiter
|
18
|
+
DELIMITER = "\nEND\n"
|
19
|
+
|
20
|
+
# Delimiter
|
21
|
+
RS = DELIMITER
|
22
|
+
|
23
|
+
#
|
24
|
+
TAGSIZE = 12
|
25
|
+
|
26
|
+
#
|
27
|
+
def initialize(entry)
|
28
|
+
super(entry, TAGSIZE)
|
29
|
+
end
|
30
|
+
|
31
|
+
# Returns
|
32
|
+
def reference
|
33
|
+
hash = Hash.new('')
|
34
|
+
|
35
|
+
hash['authors'] = author.split(/;/).map {|x| x.sub(/,/, ', ')}
|
36
|
+
hash['title'] = title
|
37
|
+
hash['journal'] = journal.gsub(/\./, '. ').strip
|
38
|
+
|
39
|
+
vol = volume.split(/,\s+/)
|
40
|
+
if vol.size > 1
|
41
|
+
hash['volume'] = vol.shift.sub(/Vol\./, '')
|
42
|
+
hash['pages'],
|
43
|
+
hash['year'] = vol.pop.split(' ')
|
44
|
+
hash['issue'] = vol.shift.sub(/No\./, '') unless vol.empty?
|
45
|
+
end
|
46
|
+
|
47
|
+
return Reference.new(hash)
|
48
|
+
end
|
49
|
+
|
50
|
+
# CODE
|
51
|
+
def entry_id
|
52
|
+
field_fetch('CODE')
|
53
|
+
end
|
54
|
+
|
55
|
+
# TITLE
|
56
|
+
def title
|
57
|
+
field_fetch('TITLE')
|
58
|
+
end
|
59
|
+
|
60
|
+
# FIELD
|
61
|
+
def field
|
62
|
+
field_fetch('FIELD')
|
63
|
+
end
|
64
|
+
|
65
|
+
# JOURNAL
|
66
|
+
def journal
|
67
|
+
field_fetch('JOURNAL')
|
68
|
+
end
|
69
|
+
|
70
|
+
# VOLUME
|
71
|
+
def volume
|
72
|
+
field_fetch('VOLUME')
|
73
|
+
end
|
74
|
+
|
75
|
+
# KEYWORD ';;'
|
76
|
+
def keyword
|
77
|
+
unless @data['KEYWORD']
|
78
|
+
@data['KEYWORD'] = fetch('KEYWORD').split(/;;\s*/)
|
79
|
+
end
|
80
|
+
@data['KEYWORD']
|
81
|
+
end
|
82
|
+
|
83
|
+
# AUTHOR
|
84
|
+
def author
|
85
|
+
field_fetch('AUTHOR')
|
86
|
+
end
|
87
|
+
|
88
|
+
end
|
89
|
+
|
90
|
+
end
|
91
|
+
|
92
|
+
|
93
|
+
if __FILE__ == $0
|
94
|
+
require 'bio/io/fetch'
|
95
|
+
|
96
|
+
entry = Bio::Fetch.query('litdb', '0308004')
|
97
|
+
puts entry
|
98
|
+
p Bio::LITDB.new(entry).reference
|
99
|
+
|
100
|
+
entry = Bio::Fetch.query('litdb', '0309094')
|
101
|
+
puts entry
|
102
|
+
p Bio::LITDB.new(entry).reference
|
103
|
+
|
104
|
+
entry = Bio::Fetch.query('litdb', '0309093')
|
105
|
+
puts entry
|
106
|
+
p Bio::LITDB.new(entry).reference
|
107
|
+
end
|
@@ -0,0 +1,326 @@
|
|
1
|
+
#
|
2
|
+
# = bio/db/medline.rb - NCBI PubMed/MEDLINE database class
|
3
|
+
#
|
4
|
+
# Copyright:: Copyright (C) 2001, 2005
|
5
|
+
# Toshiaki Katayama <k@bioruby.org>
|
6
|
+
# License:: The Ruby License
|
7
|
+
#
|
8
|
+
# $Id: medline.rb,v 1.17 2007/12/21 05:12:41 k Exp $
|
9
|
+
#
|
10
|
+
|
11
|
+
require 'bio/db'
|
12
|
+
|
13
|
+
module Bio
|
14
|
+
|
15
|
+
# == Description
|
16
|
+
#
|
17
|
+
# NCBI PubMed/MEDLINE database class.
|
18
|
+
#
|
19
|
+
# == Examples
|
20
|
+
#
|
21
|
+
# medline = Bio::MEDLINE.new(txt)
|
22
|
+
# medline.reference
|
23
|
+
# medline.pmid == medline.entry_id
|
24
|
+
# medilne.mesh
|
25
|
+
#
|
26
|
+
class MEDLINE < NCBIDB
|
27
|
+
|
28
|
+
def initialize(entry)
|
29
|
+
@pubmed = Hash.new('')
|
30
|
+
|
31
|
+
tag = ''
|
32
|
+
entry.each_line do |line|
|
33
|
+
if line =~ /^\w/
|
34
|
+
tag = line[0,4].strip
|
35
|
+
end
|
36
|
+
@pubmed[tag] += line[6..-1] if line.length > 6
|
37
|
+
end
|
38
|
+
end
|
39
|
+
attr_reader :pubmed
|
40
|
+
|
41
|
+
|
42
|
+
# returns a Reference object.
|
43
|
+
def reference
|
44
|
+
hash = Hash.new('')
|
45
|
+
|
46
|
+
hash['authors'] = authors
|
47
|
+
hash['title'] = title
|
48
|
+
hash['journal'] = journal
|
49
|
+
hash['volume'] = volume
|
50
|
+
hash['issue'] = issue
|
51
|
+
hash['pages'] = pages
|
52
|
+
hash['year'] = year
|
53
|
+
hash['pubmed'] = pmid
|
54
|
+
hash['medline'] = ui
|
55
|
+
hash['abstract'] = abstract
|
56
|
+
hash['mesh'] = mesh
|
57
|
+
hash['affiliations'] = affiliations
|
58
|
+
|
59
|
+
hash.delete_if { |k, v| v.nil? or v.empty? }
|
60
|
+
|
61
|
+
return Reference.new(hash)
|
62
|
+
end
|
63
|
+
|
64
|
+
|
65
|
+
### Common MEDLINE tags
|
66
|
+
|
67
|
+
# PMID - PubMed Unique Identifier
|
68
|
+
# Unique number assigned to each PubMed citation.
|
69
|
+
def pmid
|
70
|
+
@pubmed['PMID'].strip
|
71
|
+
end
|
72
|
+
alias entry_id pmid
|
73
|
+
|
74
|
+
# UI - MEDLINE Unique Identifier
|
75
|
+
# Unique number assigned to each MEDLINE citation.
|
76
|
+
def ui
|
77
|
+
@pubmed['UI'].strip
|
78
|
+
end
|
79
|
+
|
80
|
+
# TA - Journal Title Abbreviation
|
81
|
+
# Standard journal title abbreviation.
|
82
|
+
def ta
|
83
|
+
@pubmed['TA'].gsub(/\s+/, ' ').strip
|
84
|
+
end
|
85
|
+
alias journal ta
|
86
|
+
|
87
|
+
# VI - Volume
|
88
|
+
# Journal volume.
|
89
|
+
def vi
|
90
|
+
@pubmed['VI'].strip
|
91
|
+
end
|
92
|
+
alias volume vi
|
93
|
+
|
94
|
+
# IP - Issue
|
95
|
+
# The number of the issue, part, or supplement of the journal in which
|
96
|
+
# the article was published.
|
97
|
+
def ip
|
98
|
+
@pubmed['IP'].strip
|
99
|
+
end
|
100
|
+
alias issue ip
|
101
|
+
|
102
|
+
# PG - Page Number
|
103
|
+
# The full pagination of the article.
|
104
|
+
def pg
|
105
|
+
@pubmed['PG'].strip
|
106
|
+
end
|
107
|
+
|
108
|
+
def pages
|
109
|
+
pages = pg
|
110
|
+
if pages =~ /-/
|
111
|
+
from, to = pages.split('-')
|
112
|
+
if (len = from.length - to.length) > 0
|
113
|
+
to = from[0,len] + to
|
114
|
+
end
|
115
|
+
pages = "#{from}-#{to}"
|
116
|
+
end
|
117
|
+
return pages
|
118
|
+
end
|
119
|
+
|
120
|
+
# DP - Publication Date
|
121
|
+
# The date the article was published.
|
122
|
+
def dp
|
123
|
+
@pubmed['DP'].strip
|
124
|
+
end
|
125
|
+
alias date dp
|
126
|
+
|
127
|
+
def year
|
128
|
+
dp[0,4]
|
129
|
+
end
|
130
|
+
|
131
|
+
# TI - Title Words
|
132
|
+
# The title of the article.
|
133
|
+
def ti
|
134
|
+
@pubmed['TI'].gsub(/\s+/, ' ').strip
|
135
|
+
end
|
136
|
+
alias title ti
|
137
|
+
|
138
|
+
# AB - Abstract
|
139
|
+
# Abstract.
|
140
|
+
def ab
|
141
|
+
@pubmed['AB'].gsub(/\s+/, ' ').strip
|
142
|
+
end
|
143
|
+
alias abstract ab
|
144
|
+
|
145
|
+
# AU - Author Name
|
146
|
+
# Authors' names.
|
147
|
+
def au
|
148
|
+
@pubmed['AU'].strip
|
149
|
+
end
|
150
|
+
|
151
|
+
def authors
|
152
|
+
authors = []
|
153
|
+
au.split(/\n/).each do |author|
|
154
|
+
if author =~ / /
|
155
|
+
name = author.split(/\s+/)
|
156
|
+
suffix = nil
|
157
|
+
if name.length > 2 && name[-2] =~ /^[A-Z]+$/ # second to last are the initials
|
158
|
+
suffix = name.pop
|
159
|
+
end
|
160
|
+
initial = name.pop.split(//).join('. ')
|
161
|
+
author = "#{name.join(' ')}, #{initial}."
|
162
|
+
end
|
163
|
+
if suffix
|
164
|
+
author << " " + suffix
|
165
|
+
end
|
166
|
+
authors.push(author)
|
167
|
+
end
|
168
|
+
return authors
|
169
|
+
end
|
170
|
+
|
171
|
+
# SO - Source
|
172
|
+
# Composite field containing bibliographic information.
|
173
|
+
def so
|
174
|
+
@pubmed['SO'].strip
|
175
|
+
end
|
176
|
+
alias source so
|
177
|
+
|
178
|
+
# MH - MeSH Terms
|
179
|
+
# NLM's controlled vocabulary.
|
180
|
+
def mh
|
181
|
+
@pubmed['MH'].strip.split(/\n/)
|
182
|
+
end
|
183
|
+
alias mesh mh
|
184
|
+
|
185
|
+
# AD - Affiliation
|
186
|
+
# Institutional affiliation and address of the first author, and grant
|
187
|
+
# numbers.
|
188
|
+
def ad
|
189
|
+
@pubmed['AD'].strip.split(/\n/)
|
190
|
+
end
|
191
|
+
alias affiliations ad
|
192
|
+
|
193
|
+
# AID - Article Identifier
|
194
|
+
# Article ID values may include the pii (controlled publisher identifier)
|
195
|
+
# or doi (Digital Object Identifier).
|
196
|
+
def doi
|
197
|
+
@pubmed['AID'][/(\S+) \[doi\]/, 1]
|
198
|
+
end
|
199
|
+
|
200
|
+
def pii
|
201
|
+
@pubmed['AID'][/(\S+) \[pii\]/, 1]
|
202
|
+
end
|
203
|
+
|
204
|
+
### Other MEDLINE tags
|
205
|
+
|
206
|
+
# CI - Copyright Information
|
207
|
+
# Copyright statement.
|
208
|
+
|
209
|
+
# CIN - Comment In
|
210
|
+
# Reference containing a comment about the article.
|
211
|
+
|
212
|
+
# CN - Collective Name
|
213
|
+
# Corporate author or group names with authorship responsibility.
|
214
|
+
|
215
|
+
# CON - Comment On
|
216
|
+
# Reference upon which the article comments.
|
217
|
+
|
218
|
+
# CY - Country
|
219
|
+
# The place of publication of the journal.
|
220
|
+
|
221
|
+
# DA - Date Created
|
222
|
+
# Used for internal processing at NLM.
|
223
|
+
|
224
|
+
# DCOM - Date Completed
|
225
|
+
# Used for internal processing at NLM.
|
226
|
+
|
227
|
+
# DEP - Date of Electronic Publication
|
228
|
+
# Electronic publication date.
|
229
|
+
|
230
|
+
# EDAT - Entrez Date
|
231
|
+
# The date the citation was added to PubMed.
|
232
|
+
|
233
|
+
# EIN - Erratum In
|
234
|
+
# Reference containing a published erratum to the article.
|
235
|
+
|
236
|
+
# GS - Gene Symbol
|
237
|
+
# Abbreviated gene names (used 1991 through 1996).
|
238
|
+
|
239
|
+
# ID - Identification Number
|
240
|
+
# Research grant numbers, contract numbers, or both that designate
|
241
|
+
# financial support by any agency of the US PHS (Public Health Service).
|
242
|
+
|
243
|
+
# IS - ISSN
|
244
|
+
# International Standard Serial Number of the journal.
|
245
|
+
|
246
|
+
# JC - Journal Title Code
|
247
|
+
# MEDLINE unique three-character code for the journal.
|
248
|
+
|
249
|
+
# JID - NLM Unique ID
|
250
|
+
# Unique journal ID in NLM's catalog of books, journals, and audiovisuals.
|
251
|
+
|
252
|
+
# LA - Language
|
253
|
+
# The language in which the article was published.
|
254
|
+
|
255
|
+
# LR - Last Revision Date
|
256
|
+
# The date a change was made to the record during a maintenance procedure.
|
257
|
+
|
258
|
+
# MHDA - MeSH Date
|
259
|
+
# The date MeSH terms were added to the citation. The MeSH date is the
|
260
|
+
# same as the Entrez date until MeSH are added.
|
261
|
+
|
262
|
+
# PHST - Publication History Status Date
|
263
|
+
# History status date.
|
264
|
+
|
265
|
+
# PS - Personal Name as Subject
|
266
|
+
# Individual is the subject of the article.
|
267
|
+
|
268
|
+
# PST - Publication Status
|
269
|
+
# Publication status.
|
270
|
+
|
271
|
+
# PT - Publication Type
|
272
|
+
# The type of material the article represents.
|
273
|
+
def pt
|
274
|
+
@pubmed['PT'].strip.split(/\n/)
|
275
|
+
end
|
276
|
+
alias publication_type pt
|
277
|
+
|
278
|
+
# RF - Number of References
|
279
|
+
# Number of bibliographic references for Review articles.
|
280
|
+
|
281
|
+
# RIN - Retraction In
|
282
|
+
# Retraction of the article
|
283
|
+
|
284
|
+
# RN - EC/RN Number
|
285
|
+
# Number assigned by the Enzyme Commission to designate a particular
|
286
|
+
# enzyme or by the Chemical Abstracts Service for Registry Numbers.
|
287
|
+
|
288
|
+
# ROF - Retraction Of
|
289
|
+
# Article being retracted.
|
290
|
+
|
291
|
+
# RPF - Republished From
|
292
|
+
# Original article.
|
293
|
+
|
294
|
+
# SB - Journal Subset
|
295
|
+
# Code for a specific set of journals.
|
296
|
+
|
297
|
+
# SI - Secondary Source Identifier
|
298
|
+
# Identifies a secondary source that supplies information, e.g., other
|
299
|
+
# data sources, databanks and accession numbers of molecular sequences
|
300
|
+
# discussed in articles.
|
301
|
+
|
302
|
+
# TT - Transliterated / Vernacular Title
|
303
|
+
# Non-Roman alphabet language titles are transliterated.
|
304
|
+
|
305
|
+
# UIN - Update In
|
306
|
+
# Update to the article.
|
307
|
+
|
308
|
+
# UOF - Update Of
|
309
|
+
# The article being updated.
|
310
|
+
|
311
|
+
# URLF - URL Full-Text
|
312
|
+
# Link to the full-text of article at provider's website. Links are
|
313
|
+
# incomplete. Use PmLink for the complete set of available links.
|
314
|
+
# [PmLink] http://www.ncbi.nlm.nih.gov/entrez/utils/pmlink_help.html
|
315
|
+
|
316
|
+
# URLS - URL Summary
|
317
|
+
# Link to the article summary at provider's website. Links are
|
318
|
+
# incomplete. Use PmLink for the complete set of available links.
|
319
|
+
# [PmLink] http://www.ncbi.nlm.nih.gov/entrez/utils/pmlink_help.html
|
320
|
+
|
321
|
+
end # MEDLINE
|
322
|
+
|
323
|
+
end # Bio
|
324
|
+
|
325
|
+
|
326
|
+
|
data/lib/bio/db/nbrf.rb
ADDED
@@ -0,0 +1,191 @@
|
|
1
|
+
#
|
2
|
+
# = bio/db/nbrf.rb - NBRF/PIR format sequence data class
|
3
|
+
#
|
4
|
+
# Copyright:: Copyright (C) 2001-2003,2006 Naohisa Goto <ng@bioruby.org>
|
5
|
+
# Copyright (C) 2001-2002 Toshiaki Katayama <k@bioruby.org>
|
6
|
+
# License:: The Ruby License
|
7
|
+
#
|
8
|
+
# $Id: nbrf.rb,v 1.10 2007/04/05 23:35:40 trevor Exp $
|
9
|
+
#
|
10
|
+
# Sequence data class for NBRF/PIR flatfile format.
|
11
|
+
#
|
12
|
+
# = References
|
13
|
+
#
|
14
|
+
# * http://pir.georgetown.edu/pirwww/otherinfo/doc/techbulletin.html
|
15
|
+
# * http://www.sander.embl-ebi.ac.uk/Services/webin/help/webin-align/align_format_help.html#pir
|
16
|
+
# * http://www.cmbi.kun.nl/bioinf/tools/crab_pir.html
|
17
|
+
#
|
18
|
+
|
19
|
+
require 'bio/db'
|
20
|
+
require 'bio/sequence'
|
21
|
+
|
22
|
+
module Bio
|
23
|
+
|
24
|
+
# Sequence data class for NBRF/PIR flatfile format.
|
25
|
+
class NBRF < DB
|
26
|
+
#--
|
27
|
+
# based on Bio::FastaFormat class
|
28
|
+
#++
|
29
|
+
|
30
|
+
# Delimiter of each entry. Bio::FlatFile uses it.
|
31
|
+
DELIMITER = RS = "\n>"
|
32
|
+
|
33
|
+
# (Integer) excess read size included in DELIMITER.
|
34
|
+
DELIMITER_OVERRUN = 1 # '>'
|
35
|
+
|
36
|
+
#--
|
37
|
+
# Note: DELIMITER is changed due to the change of Bio::FlatFile.
|
38
|
+
# DELIMITER = RS = "*\n"
|
39
|
+
#++
|
40
|
+
|
41
|
+
# Creates a new NBRF object. It stores the comment and sequence
|
42
|
+
# information from one entry of the NBRF/PIR format string.
|
43
|
+
# If the argument contains more than one
|
44
|
+
# entry, only the first entry is used.
|
45
|
+
def initialize(str)
|
46
|
+
str = str.sub(/\A[\r\n]+/, '') # remove first void lines
|
47
|
+
line1, line2, rest = str.split(/^/, 3)
|
48
|
+
|
49
|
+
rest = rest.to_s
|
50
|
+
rest.sub!(/^>.*/m, '') # remove trailing entries for sure
|
51
|
+
@entry_overrun = $&
|
52
|
+
rest.sub!(/\*\s*\z/, '') # remove last '*' and "\n"
|
53
|
+
@data = rest
|
54
|
+
|
55
|
+
@definition = line2.to_s.chomp
|
56
|
+
if /^>?([A-Za-z0-9]{2})\;(.*)/ =~ line1.to_s then
|
57
|
+
@seq_type = $1
|
58
|
+
@entry_id = $2
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
# Returns sequence type described in the entry.
|
63
|
+
# P1 (protein), F1 (protein fragment)
|
64
|
+
# DL (DNA linear), DC (DNA circular)
|
65
|
+
# RL (DNA linear), RC (DNA circular)
|
66
|
+
# N3 (tRNA), N1 (other functional RNA)
|
67
|
+
attr_accessor :seq_type
|
68
|
+
|
69
|
+
# Returns ID described in the entry.
|
70
|
+
attr_accessor :entry_id
|
71
|
+
alias accession entry_id
|
72
|
+
|
73
|
+
# Returns the description line of the NBRF/PIR formatted data.
|
74
|
+
attr_accessor :definition
|
75
|
+
|
76
|
+
# sequence data of the entry (???)
|
77
|
+
attr_accessor :data
|
78
|
+
|
79
|
+
# piece of next entry. Bio::FlatFile uses it.
|
80
|
+
attr_reader :entry_overrun
|
81
|
+
|
82
|
+
|
83
|
+
# Returns the stored one entry as a NBRF/PIR format. (same as to_s)
|
84
|
+
def entry
|
85
|
+
@entry = ">#{@seq_type or 'XX'};#{@entry_id}\n#{definition}\n#{@data}*\n"
|
86
|
+
end
|
87
|
+
alias to_s entry
|
88
|
+
|
89
|
+
# Returns Bio::Sequence::AA, Bio::Sequence::NA, or Bio::Sequence,
|
90
|
+
# depending on sequence type.
|
91
|
+
def seq_class
|
92
|
+
case @seq_type
|
93
|
+
when /[PF]1/
|
94
|
+
# protein
|
95
|
+
Sequence::AA
|
96
|
+
when /[DR][LC]/, /N[13]/
|
97
|
+
# nucleic
|
98
|
+
Sequence::NA
|
99
|
+
else
|
100
|
+
Sequence
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
# Returns sequence data.
|
105
|
+
# Returns Bio::Sequence::NA, Bio::Sequence::AA or Bio::Sequence,
|
106
|
+
# according to the sequence type.
|
107
|
+
def seq
|
108
|
+
unless defined?(@seq)
|
109
|
+
@seq = seq_class.new(@data.tr(" \t\r\n0-9", '')) # lazy clean up
|
110
|
+
end
|
111
|
+
@seq
|
112
|
+
end
|
113
|
+
|
114
|
+
# Returns sequence length.
|
115
|
+
def length
|
116
|
+
seq.length
|
117
|
+
end
|
118
|
+
|
119
|
+
# Returens the nucleic acid sequence.
|
120
|
+
# If you call naseq for protein sequence, RuntimeError will be occurred.
|
121
|
+
# Use the method if you know whether the sequence is NA or AA.
|
122
|
+
def naseq
|
123
|
+
if seq.is_a?(Bio::Sequence::AA) then
|
124
|
+
raise 'not nucleic but protein sequence'
|
125
|
+
elsif seq.is_a?(Bio::Sequence::NA) then
|
126
|
+
seq
|
127
|
+
else
|
128
|
+
Bio::Sequence::NA.new(seq)
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
# Returens the length of sequence.
|
133
|
+
# If you call nalen for protein sequence, RuntimeError will be occurred.
|
134
|
+
# Use the method if you know whether the sequence is NA or AA.
|
135
|
+
def nalen
|
136
|
+
naseq.length
|
137
|
+
end
|
138
|
+
|
139
|
+
# Returens the protein (amino acids) sequence.
|
140
|
+
# If you call aaseq for nucleic acids sequence,
|
141
|
+
# RuntimeError will be occurred.
|
142
|
+
# Use the method if you know whether the sequence is NA or AA.
|
143
|
+
def aaseq
|
144
|
+
if seq.is_a?(Bio::Sequence::NA) then
|
145
|
+
raise 'not nucleic but protein sequence'
|
146
|
+
elsif seq.is_a?(Bio::Sequence::AA) then
|
147
|
+
seq
|
148
|
+
else
|
149
|
+
Bio::Sequence::AA.new(seq)
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
# Returens the length of protein (amino acids) sequence.
|
154
|
+
# If you call aaseq for nucleic acids sequence,
|
155
|
+
# RuntimeError will be occurred.
|
156
|
+
# Use the method if you know whether the sequence is NA or AA.
|
157
|
+
def aalen
|
158
|
+
aaseq.length
|
159
|
+
end
|
160
|
+
|
161
|
+
#--
|
162
|
+
#class method
|
163
|
+
#++
|
164
|
+
|
165
|
+
# Creates a NBRF/PIR formatted text.
|
166
|
+
# Parameters can be omitted.
|
167
|
+
def self.to_nbrf(hash)
|
168
|
+
seq_type = hash[:seq_type]
|
169
|
+
seq = hash[:seq]
|
170
|
+
unless seq_type
|
171
|
+
if seq.is_a?(Bio::Sequence::AA) then
|
172
|
+
seq_type = 'P1'
|
173
|
+
elsif seq.is_a?(Bio::Sequence::NA) then
|
174
|
+
seq_type = /u/i =~ seq ? 'RL' : 'DL'
|
175
|
+
else
|
176
|
+
seq_type = 'XX'
|
177
|
+
end
|
178
|
+
end
|
179
|
+
width = hash.has_key?(:width) ? hash[:width] : 70
|
180
|
+
if width then
|
181
|
+
seq = seq.to_s + "*"
|
182
|
+
seq.gsub!(Regexp.new(".{1,#{width}}"), "\\0\n")
|
183
|
+
else
|
184
|
+
seq = seq.to_s + "*\n"
|
185
|
+
end
|
186
|
+
">#{seq_type};#{hash[:entry_id]}\n#{hash[:definition]}\n#{seq}"
|
187
|
+
end
|
188
|
+
|
189
|
+
end #class NBRF
|
190
|
+
end #module Bio
|
191
|
+
|