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/go.rb
ADDED
@@ -0,0 +1,481 @@
|
|
1
|
+
#
|
2
|
+
# = bio/db/go.rb - Classes for Gene Ontology
|
3
|
+
#
|
4
|
+
# Copyright:: Copyright (C) 2003
|
5
|
+
# Mitsuteru C. Nakao <n@bioruby.org>
|
6
|
+
# License:: The Ruby License
|
7
|
+
#
|
8
|
+
# $Id: go.rb,v 1.11 2007/04/05 23:35:40 trevor Exp $
|
9
|
+
#
|
10
|
+
# == Gene Ontology
|
11
|
+
#
|
12
|
+
# == Example
|
13
|
+
#
|
14
|
+
# == References
|
15
|
+
#
|
16
|
+
|
17
|
+
require 'bio/pathway'
|
18
|
+
|
19
|
+
module Bio
|
20
|
+
|
21
|
+
# = Bio::GO
|
22
|
+
# Classes for Gene Ontology http://www.geneontology.org
|
23
|
+
class GO
|
24
|
+
|
25
|
+
# = Bio::GO::Ontology
|
26
|
+
#
|
27
|
+
# Container class for ontologies in the DAG Edit format.
|
28
|
+
#
|
29
|
+
# == Example
|
30
|
+
#
|
31
|
+
# c_data = File.open('component.oontology').read
|
32
|
+
# go_c = Bio::GO::Ontology.new(c_data)
|
33
|
+
# p go_c.bfs_shortest_path('0003673','0005632')
|
34
|
+
class Ontology < Bio::Pathway
|
35
|
+
|
36
|
+
# Bio::GO::Ontology.parse_ogids(line)
|
37
|
+
#
|
38
|
+
# Parsing GOID line in the DAGEdit format
|
39
|
+
# GO:ID[ ; GO:ID...]
|
40
|
+
def self.parse_goids(line)
|
41
|
+
goids = []
|
42
|
+
loop {
|
43
|
+
if /^ *[$%<]\S.+?;/ =~ line
|
44
|
+
endpoint = line.index(';') + 1
|
45
|
+
line = line[endpoint..line.size]
|
46
|
+
elsif /^,* GO:(\d{7}),*/ =~ line
|
47
|
+
goids << $1.clone
|
48
|
+
endpoint = line.index(goids.last) + goids.last.size
|
49
|
+
line = line[endpoint..line.size]
|
50
|
+
else
|
51
|
+
break
|
52
|
+
end
|
53
|
+
}
|
54
|
+
return goids
|
55
|
+
end
|
56
|
+
|
57
|
+
# Returns a Hash instance of the header lines in ontology flatfile.
|
58
|
+
attr_reader :header_lines
|
59
|
+
|
60
|
+
#
|
61
|
+
attr_reader :id2term
|
62
|
+
|
63
|
+
#
|
64
|
+
attr_reader :id2id
|
65
|
+
|
66
|
+
|
67
|
+
# Bio::GO::Ontology.new(str)
|
68
|
+
# The DAG Edit format ontology data parser.
|
69
|
+
def initialize(str)
|
70
|
+
@id2term = {}
|
71
|
+
@header_lines = {}
|
72
|
+
@id2id = {}
|
73
|
+
adj_list = dag_edit_format_parser(str)
|
74
|
+
super(adj_list)
|
75
|
+
end
|
76
|
+
|
77
|
+
|
78
|
+
# Returns a GO_Term correspondig with the given GO_ID.
|
79
|
+
def goid2term(goid)
|
80
|
+
term = id2term[goid]
|
81
|
+
term = id2term[id2id[goid]] if term == nil
|
82
|
+
return term
|
83
|
+
end
|
84
|
+
|
85
|
+
private
|
86
|
+
|
87
|
+
# constructing adjaency list for the given ontology
|
88
|
+
def dag_edit_format_parser(str)
|
89
|
+
stack = []
|
90
|
+
adj_list = []
|
91
|
+
|
92
|
+
str.each {|line|
|
93
|
+
if /^!(.+?):\s+(\S.+)$/ =~ line # Parsing head lines
|
94
|
+
tag = $1
|
95
|
+
value = $2
|
96
|
+
tag.gsub!(/-/,'_')
|
97
|
+
next if tag == 'type'
|
98
|
+
instance_eval("@header_lines['#{tag}'] = '#{value}'")
|
99
|
+
next
|
100
|
+
end
|
101
|
+
|
102
|
+
case line
|
103
|
+
when /^( *)([$<%])(.+?) ; GO:(\d{7})(\n*)/ # GO Term ; GO:ID
|
104
|
+
depth = $1.length.to_i
|
105
|
+
rel = $2
|
106
|
+
term = $3
|
107
|
+
goid1 = goid = $4
|
108
|
+
en = $5
|
109
|
+
goids = parse_goids(line) # GO:ID[ ; GO:ID...]
|
110
|
+
synonyms = parse_synonyms(line) # synonym:Term[ ; synonym:Term...]
|
111
|
+
stack[depth] = goids.first
|
112
|
+
@id2term[goid] = term
|
113
|
+
|
114
|
+
next if depth == 0
|
115
|
+
|
116
|
+
goids.each {|goid|
|
117
|
+
@id2term[goid] = term
|
118
|
+
@id2id[goid] = goids.first
|
119
|
+
adj_list << Bio::Relation.new(stack[depth - 1], goid, rel)
|
120
|
+
}
|
121
|
+
|
122
|
+
if en == ""
|
123
|
+
loop {
|
124
|
+
case line
|
125
|
+
when /^\n$/
|
126
|
+
break
|
127
|
+
when /^ *([<%]) (.+?) ; GO:(\d{7})/ # <%GO Term ; GO:ID
|
128
|
+
rel1 = $1
|
129
|
+
term1 = $2
|
130
|
+
goid1 = $3
|
131
|
+
goids1 = parse_goids(line)
|
132
|
+
synonyms1 = parse_synonyms(line)
|
133
|
+
|
134
|
+
@id2term[goid1] = term1
|
135
|
+
goids.each {|goid|
|
136
|
+
adj_list << Bio::Relation.new(goid1, goid, rel1)
|
137
|
+
}
|
138
|
+
else
|
139
|
+
break
|
140
|
+
end
|
141
|
+
}
|
142
|
+
end
|
143
|
+
end
|
144
|
+
}
|
145
|
+
return adj_list
|
146
|
+
end
|
147
|
+
|
148
|
+
|
149
|
+
# Returns an ary of GO IDs by parsing an entry line in the DAG Edit
|
150
|
+
# format.
|
151
|
+
def parse_goids(line)
|
152
|
+
Ontology.parse_goids(line)
|
153
|
+
end
|
154
|
+
|
155
|
+
# Bio::GO::Ontology#parse_synonyms(line)
|
156
|
+
def parse_synonyms(line)
|
157
|
+
synonyms = []
|
158
|
+
loop {
|
159
|
+
if / ; synonym:(\S.+?) *[;<%\n]/ =~ line
|
160
|
+
synonyms << $1.clone
|
161
|
+
endpoint = line.index(synonyms.last) + synonyms.last.size
|
162
|
+
line = line[endpoint..line.size]
|
163
|
+
else
|
164
|
+
break
|
165
|
+
end
|
166
|
+
}
|
167
|
+
return synonyms
|
168
|
+
end
|
169
|
+
|
170
|
+
end # class Ontology
|
171
|
+
|
172
|
+
|
173
|
+
|
174
|
+
# = Bio::GO::GeneAssociation
|
175
|
+
# $CVSROOT/go/gene-associations/gene_association.*
|
176
|
+
#
|
177
|
+
# Data parser for the gene_association go annotation.
|
178
|
+
# See also the file format http://www.geneontology.org/doc/GO.annotation.html#file
|
179
|
+
#
|
180
|
+
# == Example
|
181
|
+
#
|
182
|
+
# mgi_data = File.open('gene_association.mgi').read
|
183
|
+
# mgi = Bio::GO::GeneAssociation.parser(mgi_data)
|
184
|
+
#
|
185
|
+
# Bio::GO::GeneAssociation.parser(mgi_data) do |entry|
|
186
|
+
# p [entry.entry_id, entry.evidence, entry.goid]
|
187
|
+
# end
|
188
|
+
#
|
189
|
+
class GeneAssociation # < Bio::DB
|
190
|
+
|
191
|
+
# Delimiter
|
192
|
+
DELIMITER = "\n"
|
193
|
+
|
194
|
+
# Delimiter
|
195
|
+
RS = DELIMITER
|
196
|
+
|
197
|
+
# Retruns an Array of parsed gene_association flatfile.
|
198
|
+
# Block is acceptable.
|
199
|
+
def self.parser(str)
|
200
|
+
if block_given?
|
201
|
+
str.each(DELIMITER) {|line|
|
202
|
+
next if /^!/ =~ line
|
203
|
+
yield GeneAssociation.new(line)
|
204
|
+
}
|
205
|
+
else
|
206
|
+
galist = []
|
207
|
+
str.each(DELIMITER) {|line|
|
208
|
+
next if /^!/ =~ line
|
209
|
+
galist << GeneAssociation.new(line)
|
210
|
+
}
|
211
|
+
return galist
|
212
|
+
end
|
213
|
+
end
|
214
|
+
|
215
|
+
# Returns DB variable.
|
216
|
+
attr_reader :db # -> aStr
|
217
|
+
|
218
|
+
# Returns Db_Object_Id variable. Alias to entry_id.
|
219
|
+
attr_reader :db_object_id # -> aStr
|
220
|
+
|
221
|
+
# Returns Db_Object_Symbol variable.
|
222
|
+
attr_reader :db_object_symbol
|
223
|
+
|
224
|
+
# Returns Db_Object_Name variable.
|
225
|
+
attr_reader :qualifier
|
226
|
+
|
227
|
+
# Returns Db_Reference variable.
|
228
|
+
attr_reader :db_reference # -> []
|
229
|
+
|
230
|
+
# Retruns Evidence code variable.
|
231
|
+
attr_reader :evidence
|
232
|
+
|
233
|
+
# Returns the entry is associated with this value.
|
234
|
+
attr_reader :with # -> []
|
235
|
+
|
236
|
+
# Returns Aspect valiable.
|
237
|
+
attr_reader :aspect
|
238
|
+
|
239
|
+
#
|
240
|
+
attr_reader :db_object_name
|
241
|
+
|
242
|
+
#
|
243
|
+
attr_reader :db_object_synonym # -> []
|
244
|
+
|
245
|
+
# Returns Db_Object_Type variable.
|
246
|
+
attr_reader :db_object_type
|
247
|
+
|
248
|
+
# Returns Taxon variable.
|
249
|
+
attr_reader :taxon
|
250
|
+
|
251
|
+
# Returns Date variable.
|
252
|
+
attr_reader :date
|
253
|
+
|
254
|
+
#
|
255
|
+
attr_reader :assigned_by
|
256
|
+
|
257
|
+
alias entry_id db_object_id
|
258
|
+
|
259
|
+
|
260
|
+
# Parsing an entry (in a line) in the gene_association flatfile.
|
261
|
+
def initialize(entry)
|
262
|
+
tmp = entry.chomp.split(/\t/)
|
263
|
+
@db = tmp[0]
|
264
|
+
@db_object_id = tmp[1]
|
265
|
+
@db_object_symbol = tmp[2]
|
266
|
+
@qualifier = tmp[3] #
|
267
|
+
@goid = tmp[4]
|
268
|
+
@db_reference = tmp[5].split(/\|/) #
|
269
|
+
@evidence = tmp[6]
|
270
|
+
@with = tmp[7].split(/\|/) #
|
271
|
+
@aspect = tmp[8]
|
272
|
+
@db_object_name = tmp[9] #
|
273
|
+
@db_object_synonym = tmp[10].split(/\|/) #
|
274
|
+
@db_object_type = tmp[11]
|
275
|
+
@taxon = tmp[12] # taxon:4932
|
276
|
+
@date = tmp[13] # 20010118
|
277
|
+
@assigned_by = tmp[14]
|
278
|
+
end
|
279
|
+
|
280
|
+
|
281
|
+
# Returns GO_ID in /\d{7}/ format. Giving not nil arg, returns
|
282
|
+
# /GO:\d{7}/ style.
|
283
|
+
#
|
284
|
+
# * Bio::GO::GeneAssociation#goid -> "001234"
|
285
|
+
# * Bio::GO::GeneAssociation#goid(true) -> "GO:001234"
|
286
|
+
def goid(org = nil)
|
287
|
+
if org
|
288
|
+
@goid
|
289
|
+
else
|
290
|
+
@goid.sub('GO:','')
|
291
|
+
end
|
292
|
+
end
|
293
|
+
|
294
|
+
# Bio::GO::GeneAssociation#to_str -> a line of gene_association file.
|
295
|
+
def to_str
|
296
|
+
return [@db, @db_object_id, @db_object_symbol, @quialifier, @goid,
|
297
|
+
@qualifier.join("|"), @evidence, @with.join("|"), @aspect,
|
298
|
+
@db_object_name, @db_object_synonym.join("|"), @db_object_type,
|
299
|
+
@taxon, @date, @assigned_by].join("\t")
|
300
|
+
end
|
301
|
+
|
302
|
+
end # class GeneAssociation
|
303
|
+
|
304
|
+
|
305
|
+
|
306
|
+
# = Container class for files in geneontology.org/go/external2go/*2go.
|
307
|
+
#
|
308
|
+
# The line syntax is:
|
309
|
+
#
|
310
|
+
# database:<identifier> > GO:<term> ; GO:<GO_id>
|
311
|
+
#
|
312
|
+
# == Example
|
313
|
+
#
|
314
|
+
# spkw2go = Bio::GO::External2go.new(File.read("spkw2go"))
|
315
|
+
# spkw2go.size
|
316
|
+
# spkw2go.each do |relation|
|
317
|
+
# relation # -> {:db => "", :db_id => "", :go_term => "", :go_id => ""}
|
318
|
+
# end
|
319
|
+
# spkw2go.dbs
|
320
|
+
#
|
321
|
+
# == SAMPLE
|
322
|
+
# !date: 2005/02/08 18:02:54
|
323
|
+
# !Mapping of SWISS-PROT KEYWORDS to GO terms.
|
324
|
+
# !Evelyn Camon, SWISS-PROT.
|
325
|
+
# !
|
326
|
+
# SP_KW:ATP synthesis > GO:ATP biosynthesis ; GO:0006754
|
327
|
+
# ...
|
328
|
+
#
|
329
|
+
class External2go < Array
|
330
|
+
|
331
|
+
# Returns aHash of the external2go header information
|
332
|
+
attr_reader :header
|
333
|
+
|
334
|
+
# Constructor from parsing external2go file.
|
335
|
+
def self.parser(str)
|
336
|
+
e2g = self.new
|
337
|
+
str.each_line do |line|
|
338
|
+
line.chomp!
|
339
|
+
if line =~ /^\!date: (.+)/
|
340
|
+
e2g.header[:date] = $1
|
341
|
+
elsif line =~ /^\!(.*)/
|
342
|
+
e2g.header[:desc] << $1
|
343
|
+
elsif ary = line.scan(/^(.+?):(.+) > GO:(.+) ; (GO:\d{7})/).first
|
344
|
+
e2g << {:db_id => ary[1], :db => ary[0], :go_term => ary[2], :go_id => ary[3]}
|
345
|
+
else
|
346
|
+
raise("Invalid Format Line: \n #{line.inspect}\n")
|
347
|
+
end
|
348
|
+
end
|
349
|
+
return e2g
|
350
|
+
end
|
351
|
+
|
352
|
+
|
353
|
+
# Constructor.
|
354
|
+
# relation := {:db => aStr, :db_id => aStr, :go_term => aStr, :go_id => aStr}
|
355
|
+
def initialize
|
356
|
+
@header = {:date => '', :desc => []}
|
357
|
+
super
|
358
|
+
end
|
359
|
+
|
360
|
+
|
361
|
+
# Bio::GO::External2go#set_date(value)
|
362
|
+
def set_date(value)
|
363
|
+
@header[:date] = value
|
364
|
+
end
|
365
|
+
|
366
|
+
|
367
|
+
# Bio::GO::External2go#set_desc(ary)
|
368
|
+
def set_desc(ary)
|
369
|
+
@header[:desc] = ary
|
370
|
+
end
|
371
|
+
|
372
|
+
|
373
|
+
# Bio::GO::External2go#to_str
|
374
|
+
# Returns the contents in the external2go format.
|
375
|
+
def to_str
|
376
|
+
["!date: #{@header[:date]}",
|
377
|
+
@header[:desc].map {|e| "!#{e}" },
|
378
|
+
self.map { |e| [e[:db], ':', e[:db_id], ' > GO:', e[:go_term], ' ; ', e[:go_id]].join }
|
379
|
+
].join("\n")
|
380
|
+
end
|
381
|
+
|
382
|
+
|
383
|
+
# Returns ary of databases.
|
384
|
+
def dbs
|
385
|
+
self.map {|rel| rel[:db] }.uniq
|
386
|
+
end
|
387
|
+
|
388
|
+
|
389
|
+
# Returns ary of database IDs.
|
390
|
+
def db_ids
|
391
|
+
self.map {|rel| rel[:db_id] }.uniq
|
392
|
+
end
|
393
|
+
|
394
|
+
# Returns ary of GO Terms.
|
395
|
+
def go_terms
|
396
|
+
self.map {|rel| rel[:go_term] }.uniq
|
397
|
+
end
|
398
|
+
|
399
|
+
# Returns ary of GO IDs.
|
400
|
+
def go_ids
|
401
|
+
self.map {|rel| rel[:go_id] }.uniq
|
402
|
+
end
|
403
|
+
|
404
|
+
end # class External2go
|
405
|
+
|
406
|
+
end # class GO
|
407
|
+
|
408
|
+
end # module Bio
|
409
|
+
|
410
|
+
|
411
|
+
|
412
|
+
|
413
|
+
|
414
|
+
if __FILE__ == $0
|
415
|
+
|
416
|
+
require 'net/http'
|
417
|
+
|
418
|
+
def wget(url)
|
419
|
+
if /http:\/\/(.+?)\// =~ url
|
420
|
+
host = $1
|
421
|
+
path = url[(url.index(host) + host.size)..url.size]
|
422
|
+
else
|
423
|
+
raise ArgumentError, "Invalid URL\n#{url}"
|
424
|
+
end
|
425
|
+
|
426
|
+
result = Net::HTTP.new(host).get(path).body
|
427
|
+
end
|
428
|
+
|
429
|
+
|
430
|
+
|
431
|
+
go_c_url = 'http://www.geneontology.org/ontology/component.ontology'
|
432
|
+
ga_url = 'http://www.geneontology.org/gene-associations/gene_association.sgd.gz'
|
433
|
+
e2g_url = 'http://www.geneontology.org/external2go/spkw2go'
|
434
|
+
|
435
|
+
|
436
|
+
|
437
|
+
puts "\n #==> Bio::GO::Ontology"
|
438
|
+
p go_c_url
|
439
|
+
component_ontology = wget(go_c_url)
|
440
|
+
comp = Bio::GO::Ontology.new(component_ontology)
|
441
|
+
|
442
|
+
[['0003673', '0005632'],
|
443
|
+
['0003673', '0005619'],
|
444
|
+
['0003673', '0004649']].each {|pair|
|
445
|
+
puts
|
446
|
+
p pair
|
447
|
+
p [:pair, pair.map {|i| [comp.id2term[i], comp.goid2term(i)] }]
|
448
|
+
puts "\n #==> comp.bfs_shortest_path(pair[0], pair[1])"
|
449
|
+
p comp.bfs_shortest_path(pair[0], pair[1])
|
450
|
+
}
|
451
|
+
|
452
|
+
|
453
|
+
puts "\n #==> Bio::GO::External2go"
|
454
|
+
p e2g_url
|
455
|
+
spkw2go = Bio::GO::External2go.new(wget(e2g_url))
|
456
|
+
|
457
|
+
puts "\n #==> spkw2go.db"
|
458
|
+
p spkw2go.db
|
459
|
+
|
460
|
+
puts "\n #==> spkw2go[1]"
|
461
|
+
p spkw2go[1]
|
462
|
+
|
463
|
+
|
464
|
+
|
465
|
+
require 'zlib'
|
466
|
+
puts "\n #==> Bio::GO::GeenAssociation"
|
467
|
+
p ga_url
|
468
|
+
ga = Zlib::Inflate.inflate(wget(ga_url))
|
469
|
+
ga = Bio::GO::GeneAssociation.parser(ga)
|
470
|
+
|
471
|
+
puts "\n #==> ga.size"
|
472
|
+
p ga.size
|
473
|
+
|
474
|
+
puts "\n #==> ga[100]"
|
475
|
+
p ga[100]
|
476
|
+
|
477
|
+
|
478
|
+
|
479
|
+
|
480
|
+
|
481
|
+
end
|