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
@@ -0,0 +1,105 @@
|
|
1
|
+
#
|
2
|
+
# = bio/appl/blast/remote.rb - remote BLAST wrapper basic module
|
3
|
+
#
|
4
|
+
# Copyright:: Copyright (C) 2008 Naohisa Goto <ng@bioruby.org>
|
5
|
+
# License:: The Ruby License
|
6
|
+
#
|
7
|
+
# $Id:$
|
8
|
+
#
|
9
|
+
|
10
|
+
require 'bio/appl/blast'
|
11
|
+
|
12
|
+
class Bio::Blast
|
13
|
+
|
14
|
+
# Bio::Blast::Remote is a namespace for Remote Blast factory.
|
15
|
+
module Remote
|
16
|
+
|
17
|
+
autoload :GenomeNet, 'bio/appl/blast/genomenet'
|
18
|
+
autoload :Genomenet, 'bio/appl/blast/genomenet'
|
19
|
+
|
20
|
+
autoload :DDBJ, 'bio/appl/blast/ddbj'
|
21
|
+
autoload :Ddbj, 'bio/appl/blast/ddbj'
|
22
|
+
|
23
|
+
# creates a remote BLAST factory using GenomeNet
|
24
|
+
def self.genomenet(program, db, options = [])
|
25
|
+
GenomeNet.new(program, db, options)
|
26
|
+
#Bio::Blast.new(program, db, options, 'genomenet')
|
27
|
+
end
|
28
|
+
|
29
|
+
# creates a remote BLAST factory using DDBJ Web service
|
30
|
+
def self.ddbj(program, db, options = [])
|
31
|
+
DDBJ.new(program, db, options)
|
32
|
+
#Bio::Blast.new(program, db, options, 'ddbj')
|
33
|
+
end
|
34
|
+
|
35
|
+
# Common methods for meta-information processing
|
36
|
+
# (e.g. list of databases).
|
37
|
+
module Information
|
38
|
+
|
39
|
+
# (private) parses database information and stores data
|
40
|
+
def _parse_databases
|
41
|
+
raise NotImplementedError
|
42
|
+
end
|
43
|
+
private :_parse_databases
|
44
|
+
|
45
|
+
# Returns a list of available nucleotide databases.
|
46
|
+
#
|
47
|
+
# Note: see the note of databases method.
|
48
|
+
#
|
49
|
+
# ---
|
50
|
+
# *Returns*:: Array containing String objects
|
51
|
+
def nucleotide_databases
|
52
|
+
_parse_databases
|
53
|
+
@databases['blastn']
|
54
|
+
end
|
55
|
+
|
56
|
+
# Returns a list of available protein databases.
|
57
|
+
#
|
58
|
+
# Note: see the note of databases method.
|
59
|
+
# ---
|
60
|
+
# *Returns*:: Array containing String objects
|
61
|
+
def protein_databases
|
62
|
+
_parse_databases
|
63
|
+
@databases['blastp']
|
64
|
+
end
|
65
|
+
|
66
|
+
# Returns a list of available databases for given program.
|
67
|
+
#
|
68
|
+
# Note: It parses http://blast.genome.jp/ to obtain database information.
|
69
|
+
# Thus, if the site is changed, this method can not return correct data.
|
70
|
+
# Please tell BioRuby developers when the site is changed.
|
71
|
+
#
|
72
|
+
# ---
|
73
|
+
# *Arguments*:
|
74
|
+
# * _program_ (required): blast program('blastn', 'blastp', 'blastx', 'tblastn' or 'tblastx')
|
75
|
+
# *Returns*:: Array containing String objects
|
76
|
+
def databases(program)
|
77
|
+
_parse_databases
|
78
|
+
@databases[program] || []
|
79
|
+
end
|
80
|
+
|
81
|
+
# Returns a short description of given database.
|
82
|
+
#
|
83
|
+
# Note: see the note of databases method.
|
84
|
+
# ---
|
85
|
+
# *Arguments*:
|
86
|
+
# * _program_ (required): 'blastn', 'blastp', 'blastx', 'tblastn' or 'tblastx'
|
87
|
+
# * _db_ (required): database name
|
88
|
+
# *Returns*:: String
|
89
|
+
def database_description(program, db)
|
90
|
+
_parse_databases
|
91
|
+
h = @database_descriptions[program]
|
92
|
+
h ? (h[db] || '') : ''
|
93
|
+
end
|
94
|
+
|
95
|
+
# Resets data and clears cached data in this module.
|
96
|
+
def reset
|
97
|
+
@parse_databases = false
|
98
|
+
true
|
99
|
+
end
|
100
|
+
end #module Information
|
101
|
+
|
102
|
+
end #module Remote
|
103
|
+
|
104
|
+
end #class Bio::Blast
|
105
|
+
|
@@ -0,0 +1,767 @@
|
|
1
|
+
#
|
2
|
+
# = bio/appl/blast/report.rb - BLAST Report class
|
3
|
+
#
|
4
|
+
# Copyright:: Copyright (C) 2003 Toshiaki Katayama <k@bioruby.org>
|
5
|
+
# License:: The Ruby License
|
6
|
+
#
|
7
|
+
# $Id:$
|
8
|
+
#
|
9
|
+
|
10
|
+
require 'bio/appl/blast'
|
11
|
+
require 'bio/appl/blast/xmlparser'
|
12
|
+
require 'bio/appl/blast/rexml'
|
13
|
+
require 'bio/appl/blast/format8'
|
14
|
+
require 'bio/io/flatfile'
|
15
|
+
|
16
|
+
module Bio
|
17
|
+
class Blast
|
18
|
+
|
19
|
+
# = Bio::Blast::Report
|
20
|
+
#
|
21
|
+
# Parsed results of the blast execution for Tab-delimited and XML output
|
22
|
+
# format. Tab-delimited reports are consists of
|
23
|
+
#
|
24
|
+
# Query id,
|
25
|
+
# Subject id,
|
26
|
+
# percent of identity,
|
27
|
+
# alignment length,
|
28
|
+
# number of mismatches (not including gaps),
|
29
|
+
# number of gap openings,
|
30
|
+
# start of alignment in query,
|
31
|
+
# end of alignment in query,
|
32
|
+
# start of alignment in subject,
|
33
|
+
# end of alignment in subject,
|
34
|
+
# expected value,
|
35
|
+
# bit score.
|
36
|
+
#
|
37
|
+
# according to the MEGABLAST document (README.mbl). As for XML output,
|
38
|
+
# see the following DTDs.
|
39
|
+
#
|
40
|
+
# * http://www.ncbi.nlm.nih.gov/dtd/NCBI_BlastOutput.dtd
|
41
|
+
# * http://www.ncbi.nlm.nih.gov/dtd/NCBI_BlastOutput.mod
|
42
|
+
# * http://www.ncbi.nlm.nih.gov/dtd/NCBI_Entity.mod
|
43
|
+
#
|
44
|
+
class Report
|
45
|
+
|
46
|
+
# for Bio::FlatFile support (only for XML data)
|
47
|
+
DELIMITER = RS = "</BlastOutput>\n"
|
48
|
+
|
49
|
+
# Specify to use XMLParser to parse XML (-m 7) output.
|
50
|
+
def self.xmlparser(data)
|
51
|
+
self.new(data, :xmlparser)
|
52
|
+
end
|
53
|
+
|
54
|
+
# Specify to use REXML to parse XML (-m 7) output.
|
55
|
+
def self.rexml(data)
|
56
|
+
self.new(data, :rexml)
|
57
|
+
end
|
58
|
+
|
59
|
+
# Specify to use tab delimited output parser.
|
60
|
+
def self.tab(data)
|
61
|
+
self.new(data, :tab)
|
62
|
+
end
|
63
|
+
|
64
|
+
def auto_parse(data)
|
65
|
+
if /<?xml/.match(data[/.*/])
|
66
|
+
if defined?(XMLParser)
|
67
|
+
xmlparser_parse(data)
|
68
|
+
@reports = blastxml_split_reports
|
69
|
+
else
|
70
|
+
rexml_parse(data)
|
71
|
+
@reports = blastxml_split_reports
|
72
|
+
end
|
73
|
+
else
|
74
|
+
tab_parse(data)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
private :auto_parse
|
78
|
+
|
79
|
+
# Passing a BLAST output from 'blastall -m 7' or '-m 8' as a String.
|
80
|
+
# Formats are auto detected.
|
81
|
+
def initialize(data, parser = nil)
|
82
|
+
@iterations = []
|
83
|
+
@parameters = {}
|
84
|
+
case parser
|
85
|
+
when :xmlparser # format 7
|
86
|
+
xmlparser_parse(data)
|
87
|
+
@reports = blastxml_split_reports
|
88
|
+
when :rexml # format 7
|
89
|
+
rexml_parse(data)
|
90
|
+
@reports = blastxml_split_reports
|
91
|
+
when :tab # format 8
|
92
|
+
tab_parse(data)
|
93
|
+
when false
|
94
|
+
# do not parse, creates an empty object
|
95
|
+
else
|
96
|
+
auto_parse(data)
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
# Returns an Array of Bio::Blast::Report::Iteration objects.
|
101
|
+
attr_reader :iterations
|
102
|
+
|
103
|
+
# Returns a Hash containing execution parameters. Valid keys are:
|
104
|
+
# 'matrix', 'expect', 'include', 'sc-match', 'sc-mismatch',
|
105
|
+
# 'gap-open', 'gap-extend', 'filter'
|
106
|
+
attr_reader :parameters
|
107
|
+
|
108
|
+
#--
|
109
|
+
# Shortcut for BlastOutput values.
|
110
|
+
#++
|
111
|
+
|
112
|
+
# program name (e.g. "blastp") (String)
|
113
|
+
attr_reader :program
|
114
|
+
|
115
|
+
# BLAST version (e.g. "blastp 2.2.18 [Mar-02-2008]") (String)
|
116
|
+
attr_reader :version
|
117
|
+
|
118
|
+
# reference (String)
|
119
|
+
attr_reader :reference
|
120
|
+
|
121
|
+
# database name or title (String)
|
122
|
+
attr_reader :db
|
123
|
+
|
124
|
+
# query ID (String)
|
125
|
+
attr_reader :query_id
|
126
|
+
|
127
|
+
# query definition line (String)
|
128
|
+
attr_reader :query_def
|
129
|
+
|
130
|
+
# query length (Integer)
|
131
|
+
attr_reader :query_len
|
132
|
+
|
133
|
+
# Matrix used (-M) : shortcuts for @parameters
|
134
|
+
def matrix; @parameters['matrix']; end
|
135
|
+
# Expectation threshold (-e) : shortcuts for @parameters
|
136
|
+
def expect; @parameters['expect']; end
|
137
|
+
# Inclusion threshold (-h) : shortcuts for @parameters
|
138
|
+
def inclusion; @parameters['include']; end
|
139
|
+
# Match score for NT (-r) : shortcuts for @parameters
|
140
|
+
def sc_match; @parameters['sc-match']; end
|
141
|
+
# Mismatch score for NT (-q) : shortcuts for @parameters
|
142
|
+
def sc_mismatch; @parameters['sc-mismatch']; end
|
143
|
+
# Gap opening cost (-G) : shortcuts for @parameters
|
144
|
+
def gap_open; @parameters['gap-open']; end
|
145
|
+
# Gap extension cost (-E) : shortcuts for @parameters
|
146
|
+
def gap_extend; @parameters['gap-extend']; end
|
147
|
+
# Filtering options (-F) : shortcuts for @parameters
|
148
|
+
def filter; @parameters['filter']; end
|
149
|
+
# PHI-BLAST pattern : shortcuts for @parameters
|
150
|
+
def pattern; @parameters['pattern']; end
|
151
|
+
# Limit of request to Entrez : shortcuts for @parameters
|
152
|
+
def entrez_query; @parameters['entrez-query']; end
|
153
|
+
|
154
|
+
# Iterates on each Bio::Blast::Report::Iteration object. (for blastpgp)
|
155
|
+
def each_iteration
|
156
|
+
@iterations.each do |x|
|
157
|
+
yield x
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
# Iterates on each Bio::Blast::Report::Hit object of the the last Iteration.
|
162
|
+
# Shortcut for the last iteration's hits (for blastall)
|
163
|
+
def each_hit
|
164
|
+
@iterations.last.each do |x|
|
165
|
+
yield x
|
166
|
+
end
|
167
|
+
end
|
168
|
+
alias each each_hit
|
169
|
+
|
170
|
+
# Returns a Array of Bio::Blast::Report::Hits of the last iteration.
|
171
|
+
# Shortcut for the last iteration's hits
|
172
|
+
def hits
|
173
|
+
@iterations.last.hits
|
174
|
+
end
|
175
|
+
|
176
|
+
# Returns a Hash containing execution statistics of the last iteration.
|
177
|
+
# Valid keys are:
|
178
|
+
# 'db-num', 'db-len', 'hsp-len', 'eff-space', 'kappa', 'lambda', 'entropy'
|
179
|
+
# Shortcut for the last iteration's statistics.
|
180
|
+
def statistics
|
181
|
+
@iterations.last.statistics
|
182
|
+
end
|
183
|
+
|
184
|
+
# Number of sequences in BLAST db
|
185
|
+
def db_num; statistics['db-num']; end
|
186
|
+
# Length of BLAST db
|
187
|
+
def db_len; statistics['db-len']; end
|
188
|
+
# Effective HSP length
|
189
|
+
def hsp_len; statistics['hsp-len']; end
|
190
|
+
# Effective search space
|
191
|
+
def eff_space; statistics['eff-space']; end
|
192
|
+
# Karlin-Altschul parameter K
|
193
|
+
def kappa; statistics['kappa']; end
|
194
|
+
# Karlin-Altschul parameter Lamba
|
195
|
+
def lambda; statistics['lambda']; end
|
196
|
+
# Karlin-Altschul parameter H
|
197
|
+
def entropy; statistics['entropy']; end
|
198
|
+
|
199
|
+
# Returns a String (or nil) containing execution message of the last
|
200
|
+
# iteration (typically "CONVERGED").
|
201
|
+
# Shortcut for the last iteration's message (for checking 'CONVERGED')
|
202
|
+
def message
|
203
|
+
@iterations.last.message
|
204
|
+
end
|
205
|
+
|
206
|
+
|
207
|
+
# Bio::Blast::Report::Iteration
|
208
|
+
class Iteration
|
209
|
+
def initialize
|
210
|
+
@message = nil
|
211
|
+
@statistics = {}
|
212
|
+
@num = 1
|
213
|
+
@hits = []
|
214
|
+
end
|
215
|
+
# Returns an Array of Bio::Blast::Report::Hit objects.
|
216
|
+
attr_reader :hits
|
217
|
+
|
218
|
+
# Returns a Hash containing execution statistics.
|
219
|
+
# Valid keys are:
|
220
|
+
# 'db-len', 'db-num', 'eff-space', 'entropy', 'hsp-len', 'kappa', 'lambda'
|
221
|
+
attr_reader :statistics
|
222
|
+
|
223
|
+
# Returns the number of iteration counts.
|
224
|
+
attr_accessor :num
|
225
|
+
|
226
|
+
# Returns a String (or nil) containing execution message (typically
|
227
|
+
# "CONVERGED").
|
228
|
+
attr_accessor :message
|
229
|
+
|
230
|
+
# Iterates on each Bio::Blast::Report::Hit object.
|
231
|
+
def each
|
232
|
+
@hits.each do |x|
|
233
|
+
yield x
|
234
|
+
end
|
235
|
+
end
|
236
|
+
|
237
|
+
# query ID, only available for new BLAST XML format
|
238
|
+
attr_accessor :query_id
|
239
|
+
|
240
|
+
# query definition, only available for new BLAST XML format
|
241
|
+
attr_accessor :query_def
|
242
|
+
|
243
|
+
# query length, only available for new BLAST XML format
|
244
|
+
attr_accessor :query_len
|
245
|
+
|
246
|
+
end #class Iteration
|
247
|
+
|
248
|
+
|
249
|
+
# Bio::Blast::Report::Hit
|
250
|
+
class Hit
|
251
|
+
def initialize
|
252
|
+
@hsps = []
|
253
|
+
end
|
254
|
+
|
255
|
+
# Returns an Array of Bio::Blast::Report::Hsp objects.
|
256
|
+
attr_reader :hsps
|
257
|
+
|
258
|
+
# Hit number
|
259
|
+
attr_accessor :num
|
260
|
+
# SeqId of subject
|
261
|
+
attr_accessor :hit_id
|
262
|
+
# Length of subject
|
263
|
+
attr_accessor :len
|
264
|
+
# Definition line of subject
|
265
|
+
attr_accessor :definition
|
266
|
+
# Accession
|
267
|
+
attr_accessor :accession
|
268
|
+
|
269
|
+
# Iterates on each Hsp object.
|
270
|
+
def each
|
271
|
+
@hsps.each do |x|
|
272
|
+
yield x
|
273
|
+
end
|
274
|
+
end
|
275
|
+
|
276
|
+
# Compatible method with Bio::Fasta::Report::Hit class.
|
277
|
+
attr_accessor :query_id
|
278
|
+
# Compatible method with Bio::Fasta::Report::Hit class.
|
279
|
+
attr_accessor :query_def
|
280
|
+
# Compatible method with Bio::Fasta::Report::Hit class.
|
281
|
+
attr_accessor :query_len
|
282
|
+
|
283
|
+
# Compatible method with Bio::Fasta::Report::Hit class.
|
284
|
+
alias target_id accession
|
285
|
+
# Compatible method with Bio::Fasta::Report::Hit class.
|
286
|
+
alias target_def definition
|
287
|
+
# Compatible method with Bio::Fasta::Report::Hit class.
|
288
|
+
alias target_len len
|
289
|
+
|
290
|
+
# Shortcut methods for the best Hsp, some are also compatible with
|
291
|
+
# Bio::Fasta::Report::Hit class.
|
292
|
+
def evalue; @hsps.first.evalue; end
|
293
|
+
def bit_score; @hsps.first.bit_score; end
|
294
|
+
def identity; @hsps.first.identity; end
|
295
|
+
def percent_identity; @hsps.first.percent_identity; end
|
296
|
+
def overlap; @hsps.first.align_len; end
|
297
|
+
|
298
|
+
def query_seq; @hsps.first.qseq; end
|
299
|
+
def target_seq; @hsps.first.hseq; end
|
300
|
+
def midline; @hsps.first.midline; end
|
301
|
+
|
302
|
+
def query_start; @hsps.first.query_from; end
|
303
|
+
def query_end; @hsps.first.query_to; end
|
304
|
+
def target_start; @hsps.first.hit_from; end
|
305
|
+
def target_end; @hsps.first.hit_to; end
|
306
|
+
def lap_at
|
307
|
+
[ query_start, query_end, target_start, target_end ]
|
308
|
+
end
|
309
|
+
end
|
310
|
+
|
311
|
+
|
312
|
+
# Bio::Blast::Report::Hsp
|
313
|
+
class Hsp
|
314
|
+
def initialize
|
315
|
+
@hsp = {}
|
316
|
+
end
|
317
|
+
attr_reader :hsp
|
318
|
+
|
319
|
+
# HSP number
|
320
|
+
attr_accessor :num
|
321
|
+
# Score (in bits) of HSP
|
322
|
+
attr_accessor :bit_score
|
323
|
+
# Sscore of HSP
|
324
|
+
attr_accessor :score
|
325
|
+
# E-value of HSP
|
326
|
+
attr_accessor :evalue
|
327
|
+
# Start of HSP in query
|
328
|
+
attr_accessor :query_from
|
329
|
+
# End of HSP
|
330
|
+
attr_accessor :query_to
|
331
|
+
# Start of HSP in subject
|
332
|
+
attr_accessor :hit_from
|
333
|
+
# End of HSP
|
334
|
+
attr_accessor :hit_to
|
335
|
+
# Start of PHI-BLAST pattern
|
336
|
+
attr_accessor :pattern_from
|
337
|
+
# End of PHI-BLAST pattern
|
338
|
+
attr_accessor :pattern_to
|
339
|
+
# Translation frame of query
|
340
|
+
attr_accessor :query_frame
|
341
|
+
# Translation frame of subject
|
342
|
+
attr_accessor :hit_frame
|
343
|
+
# Number of identities in HSP
|
344
|
+
attr_accessor :identity
|
345
|
+
# Number of positives in HSP
|
346
|
+
attr_accessor :positive
|
347
|
+
# Number of gaps in HSP
|
348
|
+
attr_accessor :gaps
|
349
|
+
# Length of the alignment used
|
350
|
+
attr_accessor :align_len
|
351
|
+
# Score density
|
352
|
+
attr_accessor :density
|
353
|
+
# Alignment string for the query (with gaps)
|
354
|
+
attr_accessor :qseq
|
355
|
+
# Alignment string for subject (with gaps)
|
356
|
+
attr_accessor :hseq
|
357
|
+
# Formating middle line
|
358
|
+
attr_accessor :midline
|
359
|
+
# Available only for '-m 8' format outputs.
|
360
|
+
attr_accessor :percent_identity
|
361
|
+
# Available only for '-m 8' format outputs.
|
362
|
+
attr_accessor :mismatch_count
|
363
|
+
end
|
364
|
+
|
365
|
+
|
366
|
+
# When the report contains results for multiple query sequences,
|
367
|
+
# returns an array of Bio::Blast::Report objects corresponding to
|
368
|
+
# the multiple queries.
|
369
|
+
# Otherwise, returns nil.
|
370
|
+
#
|
371
|
+
# Note for "No hits found":
|
372
|
+
# When no hits found for a query sequence, the result for the query
|
373
|
+
# is completely void and no information available in the result XML,
|
374
|
+
# including query ID and query definition.
|
375
|
+
# The only trace is that iteration number is skipped.
|
376
|
+
# This means that if the no-hit query is the last query,
|
377
|
+
# the query can not be detected, because the result XML is
|
378
|
+
# completely the same as the result XML without the query.
|
379
|
+
attr_reader :reports
|
380
|
+
|
381
|
+
private
|
382
|
+
# (private method)
|
383
|
+
# In new BLAST XML (blastall >= 2.2.14), results of multiple queries
|
384
|
+
# are stored in <Iteration>. This method splits iterations into
|
385
|
+
# multiple Bio::Blast objects and returns them as an array.
|
386
|
+
def blastxml_split_reports
|
387
|
+
unless self.iterations.find { |iter|
|
388
|
+
iter.query_id || iter.query_def || iter.query_len
|
389
|
+
} then
|
390
|
+
# traditional BLAST XML format, or blastpgp result.
|
391
|
+
return nil
|
392
|
+
end
|
393
|
+
|
394
|
+
# new BLAST XML format (blastall 2.2.14 or later)
|
395
|
+
origin = self
|
396
|
+
reports = []
|
397
|
+
prev_iternum = 0
|
398
|
+
firsttime = true
|
399
|
+
|
400
|
+
orig_iters = self.iterations
|
401
|
+
orig_iters.each do |iter|
|
402
|
+
blast = self.class.new(nil, false)
|
403
|
+
# When no hits found, the iteration is skipped in NCBI BLAST XML.
|
404
|
+
# So, filled with empty report object.
|
405
|
+
if prev_iternum + 1 < iter.num then
|
406
|
+
((prev_iternum + 1)...(iter.num)).each do |num|
|
407
|
+
empty_i = Iteration.new
|
408
|
+
empty_i.num = num
|
409
|
+
empty_i.instance_eval {
|
410
|
+
if firsttime then
|
411
|
+
@query_id = origin.query_id
|
412
|
+
@query_def = origin.query_def
|
413
|
+
@query_len = origin.query_len
|
414
|
+
firsttime = false
|
415
|
+
end
|
416
|
+
}
|
417
|
+
empty = self.class.new(nil, false)
|
418
|
+
empty.instance_eval {
|
419
|
+
# queriy_* are copied from the empty_i
|
420
|
+
@query_id = empty_i.query_id
|
421
|
+
@query_def = empty_i.query_def
|
422
|
+
@query_len = empty_i.query_len
|
423
|
+
# others are copied from the origin
|
424
|
+
@program = origin.program
|
425
|
+
@version = origin.version
|
426
|
+
@reference = origin.reference
|
427
|
+
@db = origin.db
|
428
|
+
@parameters.update(origin.parameters)
|
429
|
+
# the empty_i is added to the iterations
|
430
|
+
@iterations.push empty_i
|
431
|
+
}
|
432
|
+
reports.push empty
|
433
|
+
end
|
434
|
+
end
|
435
|
+
|
436
|
+
blast.instance_eval {
|
437
|
+
if firsttime then
|
438
|
+
@query_id = origin.query_id
|
439
|
+
@query_def = origin.query_def
|
440
|
+
@query_len = origin.query_len
|
441
|
+
firsttime = false
|
442
|
+
end
|
443
|
+
# queriy_* are copied from the iter
|
444
|
+
@query_id = iter.query_id if iter.query_id
|
445
|
+
@query_def = iter.query_def if iter.query_def
|
446
|
+
@query_len = iter.query_len if iter.query_len
|
447
|
+
# others are copied from the origin
|
448
|
+
@program = origin.program
|
449
|
+
@version = origin.version
|
450
|
+
@reference = origin.reference
|
451
|
+
@db = origin.db
|
452
|
+
@parameters.update(origin.parameters)
|
453
|
+
# rewrites hit's query_id, query_def, query_len
|
454
|
+
iter.hits.each do |h|
|
455
|
+
h.query_id = @query_id
|
456
|
+
h.query_def = @query_def
|
457
|
+
h.query_len = @query_len
|
458
|
+
end
|
459
|
+
# the iter is added to the iterations
|
460
|
+
@iterations.push iter
|
461
|
+
}
|
462
|
+
|
463
|
+
prev_iternum = iter.num
|
464
|
+
reports.push blast
|
465
|
+
end #orig_iters.each
|
466
|
+
|
467
|
+
# This object's iterations is set as first report's iterations
|
468
|
+
@iterations.clear
|
469
|
+
if rep = reports.first then
|
470
|
+
@iterations = rep.iterations
|
471
|
+
end
|
472
|
+
|
473
|
+
return reports
|
474
|
+
end
|
475
|
+
|
476
|
+
# Flatfile splitter for NCBI BLAST XML format.
|
477
|
+
# It is internally used when reading BLAST XML.
|
478
|
+
# Normally, users do not need to use it directly.
|
479
|
+
class BlastXmlSplitter < Bio::FlatFile::Splitter::Default
|
480
|
+
|
481
|
+
# creates a new splitter object
|
482
|
+
def initialize(klass, bstream)
|
483
|
+
super(klass, bstream)
|
484
|
+
@parsed_entries = []
|
485
|
+
@raw_unsupported = false
|
486
|
+
end
|
487
|
+
|
488
|
+
# rewinds
|
489
|
+
def rewind
|
490
|
+
ret = super
|
491
|
+
@parsed_entries.clear
|
492
|
+
@raw_unsupported = false
|
493
|
+
ret
|
494
|
+
end
|
495
|
+
|
496
|
+
# do nothing
|
497
|
+
def skip_leader
|
498
|
+
nil
|
499
|
+
end
|
500
|
+
|
501
|
+
# get an entry and return the entry as a string
|
502
|
+
def get_entry
|
503
|
+
if @parsed_entries.empty? then
|
504
|
+
@raw_unsupported = false
|
505
|
+
ent = super
|
506
|
+
prepare_parsed_entries(ent)
|
507
|
+
self.parsed_entry = @parsed_entries.shift
|
508
|
+
else
|
509
|
+
raise 'not supported for new BLAST XML format'
|
510
|
+
end
|
511
|
+
ent
|
512
|
+
end
|
513
|
+
|
514
|
+
# get an entry as a Bio::Blast::Report object
|
515
|
+
def get_parsed_entry
|
516
|
+
if @parsed_entries.empty? then
|
517
|
+
ent = get_entry
|
518
|
+
else
|
519
|
+
self.parsed_entry = @parsed_entries.shift
|
520
|
+
self.entry = nil
|
521
|
+
@raw_unsupported = true
|
522
|
+
end
|
523
|
+
self.parsed_entry
|
524
|
+
end
|
525
|
+
|
526
|
+
# current raw entry as a String
|
527
|
+
def entry
|
528
|
+
raise 'not supported for new BLAST XML format' if @raw_unsupported
|
529
|
+
super
|
530
|
+
end
|
531
|
+
|
532
|
+
# start position of the entry
|
533
|
+
def entry_start_pos
|
534
|
+
if entry_pos_flag then
|
535
|
+
raise 'not supported for new BLAST XML format' if @raw_unsupported
|
536
|
+
end
|
537
|
+
super
|
538
|
+
end
|
539
|
+
|
540
|
+
# (end position of the entry) + 1
|
541
|
+
def entry_ended_pos
|
542
|
+
if entry_pos_flag then
|
543
|
+
raise 'not supported for new BLAST XML format' if @raw_unsupported
|
544
|
+
end
|
545
|
+
super
|
546
|
+
end
|
547
|
+
|
548
|
+
private
|
549
|
+
# (private method) to prepare parsed entry
|
550
|
+
def prepare_parsed_entries(ent)
|
551
|
+
if ent then
|
552
|
+
blast = dbclass.new(ent)
|
553
|
+
if blast.reports and blast.reports.size >= 1 then
|
554
|
+
# new blast xml using <Iteration> for multiple queries
|
555
|
+
@parsed_entries.concat blast.reports
|
556
|
+
else
|
557
|
+
# traditional blast xml
|
558
|
+
@parsed_entries.push blast
|
559
|
+
end
|
560
|
+
end
|
561
|
+
end
|
562
|
+
|
563
|
+
end #class BlastXmlSplitter
|
564
|
+
|
565
|
+
# splitter for Bio::FlatFile support
|
566
|
+
FLATFILE_SPLITTER = BlastXmlSplitter
|
567
|
+
|
568
|
+
end # Report
|
569
|
+
|
570
|
+
# NCBI BLAST tabular (-m 8) output parser.
|
571
|
+
# All methods are equal to Bio::Blast::Report.
|
572
|
+
# Only DELIMITER (and RS) is different.
|
573
|
+
#
|
574
|
+
class Report_tab < Report
|
575
|
+
# Delimter of each entry. Bio::FlatFile uses it.
|
576
|
+
DELIMITER = RS = nil
|
577
|
+
end #class Report_tabular
|
578
|
+
|
579
|
+
end # Blast
|
580
|
+
end # Bio
|
581
|
+
|
582
|
+
|
583
|
+
if __FILE__ == $0
|
584
|
+
|
585
|
+
=begin
|
586
|
+
|
587
|
+
begin # p is suitable than pp for the following test script
|
588
|
+
require 'pp'
|
589
|
+
alias p pp
|
590
|
+
rescue
|
591
|
+
end
|
592
|
+
|
593
|
+
# for multiple xml reports (iterates on each Blast::Report)
|
594
|
+
Bio::Blast.reports(ARGF) do |rep|
|
595
|
+
rep.iterations.each do |itr|
|
596
|
+
itr.hits.each do |hit|
|
597
|
+
hit.hsps.each do |hsp|
|
598
|
+
end
|
599
|
+
end
|
600
|
+
end
|
601
|
+
end
|
602
|
+
|
603
|
+
# for multiple xml reports (returns Array of Blast::Report)
|
604
|
+
reps = Bio::Blast.reports(ARGF.read)
|
605
|
+
|
606
|
+
# for a single report (xml or tab) format auto detect, parser auto selected
|
607
|
+
rep = Bio::Blast::Report.new(ARGF.read)
|
608
|
+
|
609
|
+
# to use xmlparser explicitly for a report
|
610
|
+
rep = Bio::Blast::Report.xmlparser(ARGF.read)
|
611
|
+
|
612
|
+
# to use resml explicitly for a report
|
613
|
+
rep = Bio::Blast::Report.rexml(ARGF.read)
|
614
|
+
|
615
|
+
# to use a tab delimited report
|
616
|
+
rep = Bio::Blast::Report.tab(ARGF.read)
|
617
|
+
|
618
|
+
=end
|
619
|
+
|
620
|
+
Bio::Blast.reports(ARGF) do |rep| # for multiple xml reports
|
621
|
+
|
622
|
+
print "# === Bio::Tools::Blast::Report\n"
|
623
|
+
puts
|
624
|
+
print " rep.program #=> "; p rep.program
|
625
|
+
print " rep.version #=> "; p rep.version
|
626
|
+
print " rep.reference #=> "; p rep.reference
|
627
|
+
print " rep.db #=> "; p rep.db
|
628
|
+
print " rep.query_id #=> "; p rep.query_id
|
629
|
+
print " rep.query_def #=> "; p rep.query_def
|
630
|
+
print " rep.query_len #=> "; p rep.query_len
|
631
|
+
puts
|
632
|
+
|
633
|
+
print "# === Parameters\n"
|
634
|
+
puts
|
635
|
+
print " rep.parameters #=> "; p rep.parameters
|
636
|
+
puts
|
637
|
+
print " rep.matrix #=> "; p rep.matrix
|
638
|
+
print " rep.expect #=> "; p rep.expect
|
639
|
+
print " rep.inclusion #=> "; p rep.inclusion
|
640
|
+
print " rep.sc_match #=> "; p rep.sc_match
|
641
|
+
print " rep.sc_mismatch #=> "; p rep.sc_mismatch
|
642
|
+
print " rep.gap_open #=> "; p rep.gap_open
|
643
|
+
print " rep.gap_extend #=> "; p rep.gap_extend
|
644
|
+
print " rep.filter #=> "; p rep.filter
|
645
|
+
print " rep.pattern #=> "; p rep.pattern
|
646
|
+
print " rep.entrez_query #=> "; p rep.entrez_query
|
647
|
+
puts
|
648
|
+
|
649
|
+
print "# === Statistics (last iteration's)\n"
|
650
|
+
puts
|
651
|
+
print " rep.statistics #=> "; p rep.statistics
|
652
|
+
puts
|
653
|
+
print " rep.db_num #=> "; p rep.db_num
|
654
|
+
print " rep.db_len #=> "; p rep.db_len
|
655
|
+
print " rep.hsp_len #=> "; p rep.hsp_len
|
656
|
+
print " rep.eff_space #=> "; p rep.eff_space
|
657
|
+
print " rep.kappa #=> "; p rep.kappa
|
658
|
+
print " rep.lambda #=> "; p rep.lambda
|
659
|
+
print " rep.entropy #=> "; p rep.entropy
|
660
|
+
puts
|
661
|
+
|
662
|
+
print "# === Message (last iteration's)\n"
|
663
|
+
puts
|
664
|
+
print " rep.message #=> "; p rep.message
|
665
|
+
puts
|
666
|
+
|
667
|
+
print "# === Iterations\n"
|
668
|
+
puts
|
669
|
+
print " rep.itrerations.each do |itr|\n"
|
670
|
+
puts
|
671
|
+
|
672
|
+
rep.iterations.each do |itr|
|
673
|
+
|
674
|
+
print "# --- Bio::Blast::Report::Iteration\n"
|
675
|
+
puts
|
676
|
+
|
677
|
+
print " itr.num #=> "; p itr.num
|
678
|
+
print " itr.statistics #=> "; p itr.statistics
|
679
|
+
print " itr.message #=> "; p itr.message
|
680
|
+
print " itr.hits.size #=> "; p itr.hits.size
|
681
|
+
puts
|
682
|
+
|
683
|
+
print " itr.hits.each do |hit|\n"
|
684
|
+
puts
|
685
|
+
|
686
|
+
itr.hits.each do |hit|
|
687
|
+
|
688
|
+
print "# --- Bio::Blast::Report::Hit\n"
|
689
|
+
puts
|
690
|
+
|
691
|
+
print " hit.num #=> "; p hit.num
|
692
|
+
print " hit.hit_id #=> "; p hit.hit_id
|
693
|
+
print " hit.len #=> "; p hit.len
|
694
|
+
print " hit.definition #=> "; p hit.definition
|
695
|
+
print " hit.accession #=> "; p hit.accession
|
696
|
+
|
697
|
+
print " --- compatible/shortcut ---\n"
|
698
|
+
print " hit.query_id #=> "; p hit.query_id
|
699
|
+
print " hit.query_def #=> "; p hit.query_def
|
700
|
+
print " hit.query_len #=> "; p hit.query_len
|
701
|
+
print " hit.target_id #=> "; p hit.target_id
|
702
|
+
print " hit.target_def #=> "; p hit.target_def
|
703
|
+
print " hit.target_len #=> "; p hit.target_len
|
704
|
+
|
705
|
+
print " hit.evalue #=> "; p hit.evalue
|
706
|
+
print " hit.bit_score #=> "; p hit.bit_score
|
707
|
+
print " hit.identity #=> "; p hit.identity
|
708
|
+
print " hit.overlap #=> "; p hit.overlap
|
709
|
+
|
710
|
+
print " hit.query_seq #=> "; p hit.query_seq
|
711
|
+
print " hit.midline #=> "; p hit.midline
|
712
|
+
print " hit.target_seq #=> "; p hit.target_seq
|
713
|
+
|
714
|
+
print " hit.query_start #=> "; p hit.query_start
|
715
|
+
print " hit.query_end #=> "; p hit.query_end
|
716
|
+
print " hit.target_start #=> "; p hit.target_start
|
717
|
+
print " hit.target_end #=> "; p hit.target_end
|
718
|
+
print " hit.lap_at #=> "; p hit.lap_at
|
719
|
+
print " --- compatible/shortcut ---\n"
|
720
|
+
|
721
|
+
print " hit.hsps.size #=> "; p hit.hsps.size
|
722
|
+
puts
|
723
|
+
|
724
|
+
print " hit.hsps.each do |hsp|\n"
|
725
|
+
puts
|
726
|
+
|
727
|
+
hit.hsps.each do |hsp|
|
728
|
+
|
729
|
+
print "# --- Bio::Blast::Report::Hsp\n"
|
730
|
+
puts
|
731
|
+
print " hsp.num #=> "; p hsp.num
|
732
|
+
print " hsp.bit_score #=> "; p hsp.bit_score
|
733
|
+
print " hsp.score #=> "; p hsp.score
|
734
|
+
print " hsp.evalue #=> "; p hsp.evalue
|
735
|
+
print " hsp.identity #=> "; p hsp.identity
|
736
|
+
print " hsp.gaps #=> "; p hsp.gaps
|
737
|
+
print " hsp.positive #=> "; p hsp.positive
|
738
|
+
print " hsp.align_len #=> "; p hsp.align_len
|
739
|
+
print " hsp.density #=> "; p hsp.density
|
740
|
+
|
741
|
+
print " hsp.query_frame #=> "; p hsp.query_frame
|
742
|
+
print " hsp.query_from #=> "; p hsp.query_from
|
743
|
+
print " hsp.query_to #=> "; p hsp.query_to
|
744
|
+
|
745
|
+
print " hsp.hit_frame #=> "; p hsp.hit_frame
|
746
|
+
print " hsp.hit_from #=> "; p hsp.hit_from
|
747
|
+
print " hsp.hit_to #=> "; p hsp.hit_to
|
748
|
+
|
749
|
+
print " hsp.pattern_from#=> "; p hsp.pattern_from
|
750
|
+
print " hsp.pattern_to #=> "; p hsp.pattern_to
|
751
|
+
|
752
|
+
print " hsp.qseq #=> "; p hsp.qseq
|
753
|
+
print " hsp.midline #=> "; p hsp.midline
|
754
|
+
print " hsp.hseq #=> "; p hsp.hseq
|
755
|
+
puts
|
756
|
+
print " hsp.percent_identity #=> "; p hsp.percent_identity
|
757
|
+
print " hsp.mismatch_count #=> "; p hsp.mismatch_count
|
758
|
+
puts
|
759
|
+
|
760
|
+
end
|
761
|
+
end
|
762
|
+
end
|
763
|
+
end # for multiple xml reports
|
764
|
+
|
765
|
+
end
|
766
|
+
|
767
|
+
|