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,151 @@
|
|
1
|
+
#
|
2
|
+
# = bio/appl/sosui/report.rb - SOSUI report class
|
3
|
+
#
|
4
|
+
# Copyright:: Copyright (C) 2003
|
5
|
+
# Mitsuteru C. Nakao <n@bioruby.org>
|
6
|
+
# License:: The Ruby License
|
7
|
+
#
|
8
|
+
# $Id: report.rb,v 1.11 2007/04/05 23:35:40 trevor Exp $
|
9
|
+
#
|
10
|
+
# == Example
|
11
|
+
#
|
12
|
+
# == References
|
13
|
+
#
|
14
|
+
# * http://sosui.proteome.bio.tuat.ac.jp/sosui_submit.html
|
15
|
+
#
|
16
|
+
|
17
|
+
|
18
|
+
module Bio
|
19
|
+
|
20
|
+
class SOSUI
|
21
|
+
|
22
|
+
# = SOSUI output report parsing class
|
23
|
+
#
|
24
|
+
# == References
|
25
|
+
# * http://sosui.proteome.bio.tuat.ac.jp/sosui_submit.html
|
26
|
+
class Report
|
27
|
+
|
28
|
+
# Delimiter
|
29
|
+
DELIMITER = "\n>"
|
30
|
+
RS = DELIMITER
|
31
|
+
|
32
|
+
# Query entry_id
|
33
|
+
attr_reader :entry_id
|
34
|
+
|
35
|
+
# Returns the prediction result whether "MEMBRANE PROTEIN" or
|
36
|
+
# "SOLUBLE PROTEIN".
|
37
|
+
attr_reader :prediction
|
38
|
+
|
39
|
+
# Transmembrane helixes ary
|
40
|
+
attr_reader :tmhs
|
41
|
+
|
42
|
+
# Parser for SOSUI output report.
|
43
|
+
def initialize(output_report)
|
44
|
+
entry = output_report.split(/\n/)
|
45
|
+
|
46
|
+
@entry_id = entry[0].strip.sub(/^>/,'')
|
47
|
+
@prediction = entry[1].strip
|
48
|
+
@tms = 0
|
49
|
+
@tmhs = []
|
50
|
+
parse_tmh(entry) if /MEMBRANE/ =~ @prediction
|
51
|
+
end
|
52
|
+
|
53
|
+
private
|
54
|
+
|
55
|
+
# Parser for TMH lines.
|
56
|
+
def parse_tmh(entry)
|
57
|
+
entry.each do |line|
|
58
|
+
if /NUMBER OF TM HELIX = (\d+)/ =~ line
|
59
|
+
@tms = $1
|
60
|
+
elsif /TM (\d+) +(\d+)- *(\d+) (\w+) +(\w+)/ =~ line
|
61
|
+
tmh = $1.to_i
|
62
|
+
range = Range.new($2.to_i, $3.to_i)
|
63
|
+
grade = $4
|
64
|
+
seq = $5
|
65
|
+
@tmhs.push(TMH.new(range, grade, seq))
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
|
71
|
+
# = Bio::SOSUI::Report::TMH
|
72
|
+
# Container class for transmembrane helix information.
|
73
|
+
#
|
74
|
+
# TM 1 31- 53 SECONDARY HIRMTFLRKVYSILSLQVLLTTV
|
75
|
+
class TMH
|
76
|
+
|
77
|
+
# Returns aRng of transmembrane helix
|
78
|
+
attr_reader :range
|
79
|
+
|
80
|
+
# Retruns ``PRIMARY'' or ``SECONDARY'' of helix.
|
81
|
+
attr_reader :grade
|
82
|
+
|
83
|
+
# Returns the sequence. of transmembrane helix.
|
84
|
+
attr_reader :sequence
|
85
|
+
|
86
|
+
# Sets values.
|
87
|
+
def initialize(range, grade, sequence)
|
88
|
+
@range = range
|
89
|
+
@grade = grade
|
90
|
+
@sequence = sequence
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
end # class Report
|
95
|
+
|
96
|
+
end # class SOSUI
|
97
|
+
|
98
|
+
end # module Bio
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
if __FILE__ == $0
|
103
|
+
|
104
|
+
begin
|
105
|
+
require 'pp'
|
106
|
+
alias p pp
|
107
|
+
rescue LoadError
|
108
|
+
end
|
109
|
+
|
110
|
+
|
111
|
+
sample = <<HOGE
|
112
|
+
>HOGE1
|
113
|
+
MEMBRANE PROTEIN
|
114
|
+
NUMBER OF TM HELIX = 6
|
115
|
+
TM 1 12- 34 SECONDARY LLVPILLPEKCYDQLFVQWDLLH
|
116
|
+
TM 2 36- 58 PRIMARY PCLKILLSKGLGLGIVAGSLLVK
|
117
|
+
TM 3 102- 124 SECONDARY SWGEALFLMLQTITICFLVMHYR
|
118
|
+
TM 4 126- 148 PRIMARY QTVKGVAFLACYGLVLLVLLSPL
|
119
|
+
TM 5 152- 174 SECONDARY TVVTLLQASNVPAVVVGRLLQAA
|
120
|
+
TM 6 214- 236 SECONDARY AGTFVVSSLCNGLIAAQLLFYWN
|
121
|
+
|
122
|
+
>HOGE2
|
123
|
+
SOLUBLE PROTEIN
|
124
|
+
|
125
|
+
HOGE
|
126
|
+
|
127
|
+
def hoge(ent)
|
128
|
+
puts '==='
|
129
|
+
puts ent
|
130
|
+
puts '==='
|
131
|
+
sosui = Bio::SOSUI::Report.new(ent)
|
132
|
+
p [:entry_id, sosui.entry_id]
|
133
|
+
p [:prediction, sosui.prediction]
|
134
|
+
p [:tmhs.size, sosui.tmhs]
|
135
|
+
pp [:tmhs, sosui.tmh]
|
136
|
+
end
|
137
|
+
|
138
|
+
sample.split(/#{Bio::SOSUI::Report::DELIMITER}/).each {|ent|
|
139
|
+
hoge(ent)
|
140
|
+
}
|
141
|
+
|
142
|
+
exit if ARGV.size == 0
|
143
|
+
|
144
|
+
while ent = $<.gets(Bio::SOSUI::Report::DELIMITER)
|
145
|
+
hoge(ent)
|
146
|
+
end
|
147
|
+
|
148
|
+
end
|
149
|
+
|
150
|
+
|
151
|
+
|
@@ -0,0 +1,593 @@
|
|
1
|
+
#
|
2
|
+
# = bio/appl/spidey/report.rb - SPIDEY result parser
|
3
|
+
#
|
4
|
+
# Copyright:: Copyright (C) 2004 GOTO Naohisa <ng@bioruby.org>
|
5
|
+
# License:: The Ruby License
|
6
|
+
#
|
7
|
+
# $Id: report.rb,v 1.10 2007/04/05 23:35:40 trevor Exp $
|
8
|
+
#
|
9
|
+
# NCBI Spidey result parser.
|
10
|
+
# Currently, output of default (-p 0 option) or -p 1 option are supported.
|
11
|
+
#
|
12
|
+
# == Notes
|
13
|
+
#
|
14
|
+
# The mRNA sequence is regarded as a query, and
|
15
|
+
# the enomic sequence is regarded as a target (subject, hit).
|
16
|
+
#
|
17
|
+
# == References
|
18
|
+
#
|
19
|
+
# * Wheelan, S.J., et al., Spidey: a tool for mRNA-to-genomic alignments,
|
20
|
+
# Genome Research, 11, 1952--1957, 2001.
|
21
|
+
# http://www.genome.org/cgi/content/abstract/11/11/1952
|
22
|
+
# * http://www.ncbi.nlm.nih.gov/spidey/
|
23
|
+
#
|
24
|
+
|
25
|
+
require 'bio'
|
26
|
+
|
27
|
+
module Bio
|
28
|
+
class Spidey
|
29
|
+
|
30
|
+
# Spidey report parser class.
|
31
|
+
# Please see bio/appl/spidey/report.rb for details.
|
32
|
+
#
|
33
|
+
# Its object may contain some Bio::Spidey::Report::Hit objects.
|
34
|
+
class Report #< DB
|
35
|
+
#--
|
36
|
+
# File format: -p 0 (default) or -p 1 options
|
37
|
+
#++
|
38
|
+
|
39
|
+
# Delimiter of each entry. Bio::FlatFile uses it.
|
40
|
+
DELIMITER = RS = "\n--SPIDEY "
|
41
|
+
|
42
|
+
# (Integer) excess read size included in DELIMITER.
|
43
|
+
DELIMITER_OVERRUN = 9 # "--SPIDEY ".length
|
44
|
+
|
45
|
+
# Creates a new Bio::Spidey::Report object from String.
|
46
|
+
# You can use Bio::FlatFile to read a file.
|
47
|
+
def initialize(str)
|
48
|
+
str = str.sub(/\A\s+/, '')
|
49
|
+
str.sub!(/\n(^\-\-SPIDEY .*)/m, '') # remove trailing entries for sure
|
50
|
+
@entry_overrun = $1
|
51
|
+
data = str.split(/\r?\n(?:\r?\n)+/)
|
52
|
+
d0 = data.shift.to_s.split(/\r?\n/)
|
53
|
+
@hit = Hit.new(data, d0)
|
54
|
+
@all_hits = [ @hit ]
|
55
|
+
if d0.empty? or /\ANo alignment found\.\s*\z/ =~ d0[-1] then
|
56
|
+
@hits = []
|
57
|
+
else
|
58
|
+
@hits = [ @hit ]
|
59
|
+
end
|
60
|
+
end
|
61
|
+
# piece of next entry. Bio::FlatFile uses it.
|
62
|
+
attr_reader :entry_overrun
|
63
|
+
|
64
|
+
# Returns an Array of Bio::Spidey::Report::Hit objects.
|
65
|
+
# Because current version of SPIDEY supports only 1 genomic sequences,
|
66
|
+
# the number of hits is 1 or 0.
|
67
|
+
attr_reader :hits
|
68
|
+
|
69
|
+
# Returns an Array of Bio::Spidey::Report::Hit objects.
|
70
|
+
# Unlike Bio::Spidey::Report#hits, the method returns
|
71
|
+
# results of all trials of pairwise alignment.
|
72
|
+
# This would be a Bio::Spidey specific method.
|
73
|
+
attr_reader :all_hits
|
74
|
+
|
75
|
+
# SeqDesc stores sequence information of query or subject.
|
76
|
+
class SeqDesc
|
77
|
+
#--
|
78
|
+
# description/definitions of a sequence
|
79
|
+
#++
|
80
|
+
|
81
|
+
# Creates a new SeqDesc object.
|
82
|
+
# It is designed to be called from Bio::Spidey::Report::* classes.
|
83
|
+
# Users shall not call it directly.
|
84
|
+
def initialize(seqid, seqdef, len)
|
85
|
+
@entry_id = seqid
|
86
|
+
@definition = seqdef
|
87
|
+
@len = len
|
88
|
+
end
|
89
|
+
|
90
|
+
# Identifier of the sequence.
|
91
|
+
attr_reader :entry_id
|
92
|
+
|
93
|
+
# Definition of the sequence.
|
94
|
+
attr_reader :definition
|
95
|
+
|
96
|
+
# Length of the sequence.
|
97
|
+
attr_reader :len
|
98
|
+
|
99
|
+
# Parses piece of Spidey result text and creates a new SeqDesc object.
|
100
|
+
# It is designed to be called from Bio::Spidey::Report::* classes.
|
101
|
+
# Users shall not call it directly.
|
102
|
+
def self.parse(str)
|
103
|
+
/^(Genomic|mRNA)\:\s*(([^\s]*) (.+))\, (\d+) bp\s*$/ =~ str.to_s
|
104
|
+
seqid = $3
|
105
|
+
seqdef = $2
|
106
|
+
len = ($5 ? $5.to_i : nil)
|
107
|
+
self.new(seqid, seqdef, len)
|
108
|
+
end
|
109
|
+
end #class SeqDesc
|
110
|
+
|
111
|
+
# Sequence segment pair of Spidey result.
|
112
|
+
# Similar to Bio::Blast::Report::Hsp but lacks many methods.
|
113
|
+
# For mRNA-genome mapping programs, unlike other homology search
|
114
|
+
# programs, the class is used not only for exons but also for introns.
|
115
|
+
# (Note that intron data would not be available according to run-time
|
116
|
+
# options of the program.)
|
117
|
+
class SegmentPair
|
118
|
+
#--
|
119
|
+
# segment pair (like Bio::BLAST::*::Report::Hsp)
|
120
|
+
#++
|
121
|
+
|
122
|
+
# Creates a new SegmentPair object.
|
123
|
+
# It is designed to be called from Bio::Spidey::Report::* classes.
|
124
|
+
# Users shall not call it directly.
|
125
|
+
def initialize(genomic, mrna, midline, aaseqline,
|
126
|
+
percent_identity, mismatches, gaps, splice_site,
|
127
|
+
align_len)
|
128
|
+
@genomic = genomic
|
129
|
+
@mrna = mrna
|
130
|
+
@midline = midline
|
131
|
+
@aaseqline = aaseqline
|
132
|
+
@percent_identity = percent_identity
|
133
|
+
@mismaches = mismatches
|
134
|
+
@gaps = gaps
|
135
|
+
@splice_site = splice_site
|
136
|
+
@align_len = align_len
|
137
|
+
end
|
138
|
+
|
139
|
+
# Returns segment informations of the 'Genomic'.
|
140
|
+
# Returns a Bio::Spidey::Report::Segment object.
|
141
|
+
# This would be a Bio::Spidey specific method.
|
142
|
+
attr_reader :genomic
|
143
|
+
|
144
|
+
# Returns segment informations of the 'mRNA'.
|
145
|
+
# Returns a Bio::Spidey::Report::Segment object.
|
146
|
+
# This would be a Bio::Spidey specific method.
|
147
|
+
attr_reader :mrna
|
148
|
+
|
149
|
+
# Returns the middle line of the alignment of the segment pair.
|
150
|
+
# Returns nil if no alignment data are available.
|
151
|
+
attr_reader :midline
|
152
|
+
|
153
|
+
# Returns amino acide sequence in alignment.
|
154
|
+
# Returns String, because white spaces is also important.
|
155
|
+
# Returns nil if no alignment data are available.
|
156
|
+
attr_reader :aaseqline
|
157
|
+
|
158
|
+
# Returns percent identity of the segment pair.
|
159
|
+
attr_reader :percent_identity
|
160
|
+
|
161
|
+
# Returns mismatches.
|
162
|
+
attr_reader :mismatches
|
163
|
+
alias mismatch_count mismatches
|
164
|
+
|
165
|
+
# Returns gaps.
|
166
|
+
attr_reader :gaps
|
167
|
+
|
168
|
+
# Returns splice site information.
|
169
|
+
# Returns a hash which contains :d and :a for keys and
|
170
|
+
# 0, 1, or nil for values.
|
171
|
+
# This would be a Bio::Spidey specific methods.
|
172
|
+
attr_reader :splice_site
|
173
|
+
|
174
|
+
# Returns alignment length of the segment pair.
|
175
|
+
# Returns nil if no alignment data are available.
|
176
|
+
attr_reader :align_len
|
177
|
+
|
178
|
+
# Creates a new SegmentPair object when the segment pair is an intron.
|
179
|
+
# It is designed to be called internally from
|
180
|
+
# Bio::Spidey::Report::* classes.
|
181
|
+
# Users shall not call it directly.
|
182
|
+
def self.new_intron(from, to, strand, aln)
|
183
|
+
genomic = Segment.new(from, to, strand, aln[0])
|
184
|
+
mrna = Segment.new(nil, nil, nil, aln[2])
|
185
|
+
midline = aln[1]
|
186
|
+
aaseqline = aln[3]
|
187
|
+
self.new(genomic, mrna, midline, aaseqline,
|
188
|
+
nil, nil, nil, nil, nil)
|
189
|
+
end
|
190
|
+
|
191
|
+
# Parses a piece of Spidey result text and creates a new
|
192
|
+
# SegmentPair object.
|
193
|
+
# It is designed to be called internally from
|
194
|
+
# Bio::Spidey::Report::* classes.
|
195
|
+
# Users shall not call it directly.
|
196
|
+
def self.parse(str, strand, complement, aln)
|
197
|
+
/\AExon\s*\d+(\(\-\))?\:\s*(\d+)\-(\d+)\s*\(gen\)\s+(\d+)\-(\d+)\s*\(mRNA\)\s+id\s*([\d\.]+)\s*\%\s+mismatches\s+(\d+)\s+gaps\s+(\d+)\s+splice site\s*\(d +a\)\s*\:\s*(\d+)\s+(\d+)/ =~ str
|
198
|
+
if strand == 'minus' then
|
199
|
+
genomic = Segment.new($3, $2, strand, aln[0])
|
200
|
+
else
|
201
|
+
genomic = Segment.new($2, $3, 'plus', aln[0])
|
202
|
+
end
|
203
|
+
if complement then
|
204
|
+
mrna = Segment.new($4, $5, 'minus', aln[2])
|
205
|
+
else
|
206
|
+
mrna = Segment.new($4, $5, 'plus', aln[2])
|
207
|
+
end
|
208
|
+
percent_identity = $6
|
209
|
+
mismatches = ($7 ? $7.to_i : nil)
|
210
|
+
gaps = ($8 ? $8.to_i : nil)
|
211
|
+
splice_site = {
|
212
|
+
:d => ($9 ? $9.to_i : nil),
|
213
|
+
:a => ($10 ? $10.to_i : nil)
|
214
|
+
}
|
215
|
+
midline = aln[1]
|
216
|
+
aaseqline = aln[3]
|
217
|
+
self.new(genomic, mrna, midline, aaseqline,
|
218
|
+
percent_identity, mismatches, gaps, splice_site,
|
219
|
+
(midline ? midline.length : nil))
|
220
|
+
end
|
221
|
+
|
222
|
+
#--
|
223
|
+
# Bio::BLAST::*::Report::Hsp compatible methods
|
224
|
+
# Methods already defined: midline, percent_identity,
|
225
|
+
# gaps, align_len, mismatch_count
|
226
|
+
#++
|
227
|
+
|
228
|
+
# Returns start position of the mRNA (query) (the first position is 1).
|
229
|
+
def query_from; @mrna.from; end
|
230
|
+
|
231
|
+
# Returns end position (including its position) of the mRNA (query).
|
232
|
+
def query_to; @mrna.to; end
|
233
|
+
|
234
|
+
# Returns the sequence (with gaps) of the mRNA (query).
|
235
|
+
def qseq; @mrna.seq; end
|
236
|
+
|
237
|
+
# Returns strand information of the mRNA (query).
|
238
|
+
# Returns 'plus', 'minus', or nil.
|
239
|
+
def query_strand; @mrna.strand; end
|
240
|
+
|
241
|
+
# Returns start position of the genomic (target, hit)
|
242
|
+
# (the first position is 1).
|
243
|
+
def hit_from; @genomic.from; end
|
244
|
+
|
245
|
+
# Returns end position (including its position) of the
|
246
|
+
# genomic (target, hit).
|
247
|
+
def hit_to; @genomic.to; end
|
248
|
+
|
249
|
+
# Returns the sequence (with gaps) of the genomic (target, hit).
|
250
|
+
def hseq; @genomic.seq; end
|
251
|
+
|
252
|
+
# Returns strand information of the genomic (target, hit).
|
253
|
+
# Returns 'plus', 'minus', or nil.
|
254
|
+
def hit_strand; @genomic.strand; end
|
255
|
+
end #class SegmentPair
|
256
|
+
|
257
|
+
# Segment informations of a segment pair.
|
258
|
+
class Segment
|
259
|
+
# Creates a new Segment object.
|
260
|
+
# It is designed to be called internally from
|
261
|
+
# Bio::Spidey::Report::* classes.
|
262
|
+
# Users shall not call it directly.
|
263
|
+
def initialize(pos_st, pos_ed, strand = nil, seq = nil)
|
264
|
+
@from = pos_st ? pos_st.to_i : nil
|
265
|
+
@to = pos_ed ? pos_ed.to_i : nil
|
266
|
+
@strand = strand
|
267
|
+
@seq = seq
|
268
|
+
end
|
269
|
+
|
270
|
+
# start position
|
271
|
+
attr_reader :from
|
272
|
+
|
273
|
+
# end position
|
274
|
+
attr_reader :to
|
275
|
+
|
276
|
+
# strand information
|
277
|
+
attr_reader :strand
|
278
|
+
|
279
|
+
# sequence data
|
280
|
+
attr_reader :seq
|
281
|
+
end #class Segment
|
282
|
+
|
283
|
+
# Hit object of Spidey result.
|
284
|
+
# Similar to Bio::Blast::Report::Hit but lacks many methods.
|
285
|
+
class Hit
|
286
|
+
# Creates a new Hit object.
|
287
|
+
# It is designed to be called internally from
|
288
|
+
# Bio::Spidey::Report::* classes.
|
289
|
+
# Users shall not call it directly.
|
290
|
+
def initialize(data, d0)
|
291
|
+
@data = data
|
292
|
+
@d0 = d0
|
293
|
+
end
|
294
|
+
|
295
|
+
# Fetches fields.
|
296
|
+
def field_fetch(t, ary)
|
297
|
+
reg = Regexp.new(/^#{Regexp.escape(t)}\:\s*(.+)\s*$/)
|
298
|
+
if ary.find { |x| reg =~ x }
|
299
|
+
$1.strip
|
300
|
+
else
|
301
|
+
nil
|
302
|
+
end
|
303
|
+
end
|
304
|
+
private :field_fetch
|
305
|
+
|
306
|
+
# Parses information about strand.
|
307
|
+
def parse_strand
|
308
|
+
x = field_fetch('Strand', @d0)
|
309
|
+
if x =~ /^(.+)Reverse +complement\s*$/ then
|
310
|
+
@strand = $1.strip
|
311
|
+
@complement = true
|
312
|
+
else
|
313
|
+
@strand = x
|
314
|
+
@complement = nil
|
315
|
+
end
|
316
|
+
end
|
317
|
+
private :parse_strand
|
318
|
+
|
319
|
+
# Returns strand information of the hit.
|
320
|
+
# Returns 'plus', 'minus', or nil.
|
321
|
+
# This would be a Bio::Spidey specific method.
|
322
|
+
def strand
|
323
|
+
unless defined?(@strand); parse_strand; end
|
324
|
+
@strand
|
325
|
+
end
|
326
|
+
|
327
|
+
# Returns true if the result reports 'Reverse complement'.
|
328
|
+
# Otherwise, return false or nil.
|
329
|
+
# This would be a Bio::Spidey specific method.
|
330
|
+
def complement?
|
331
|
+
unless defined?(@complement); parse_strand; end
|
332
|
+
@complement
|
333
|
+
end
|
334
|
+
|
335
|
+
# Returns number of exons in the hit.
|
336
|
+
def number_of_exons
|
337
|
+
unless defined?(@number_of_exons)
|
338
|
+
@number_of_exons = field_fetch('Number of exons', @d0).to_i
|
339
|
+
end
|
340
|
+
@number_of_exons
|
341
|
+
end
|
342
|
+
|
343
|
+
# Returns number of splice sites of the hit.
|
344
|
+
def number_of_splice_sites
|
345
|
+
unless defined?(@number_of_splice_sites)
|
346
|
+
@number_of_splice_sites =
|
347
|
+
field_fetch('Number of splice sites', @d0).to_i
|
348
|
+
end
|
349
|
+
@number_of_splice_sites
|
350
|
+
end
|
351
|
+
|
352
|
+
# Returns overall percent identity of the hit.
|
353
|
+
def percent_identity
|
354
|
+
unless defined?(@percent_identity)
|
355
|
+
x = field_fetch('overall percent identity', @d0)
|
356
|
+
@percent_identity =
|
357
|
+
(/([\d\.]+)\s*\%/ =~ x.to_s) ? $1 : nil
|
358
|
+
end
|
359
|
+
@percent_identity
|
360
|
+
end
|
361
|
+
|
362
|
+
# Returns missing mRNA ends of the hit.
|
363
|
+
def missing_mrna_ends
|
364
|
+
unless defined?(@missing_mrna_ends)
|
365
|
+
@missing_mrna_ends = field_fetch('Missing mRNA ends', @d0)
|
366
|
+
end
|
367
|
+
@missing_mrna_ends
|
368
|
+
end
|
369
|
+
|
370
|
+
# Returns sequence informations of the 'Genomic'.
|
371
|
+
# Returns a Bio::Spidey::Report::SeqDesc object.
|
372
|
+
# This would be a Bio::Spidey specific method.
|
373
|
+
def genomic
|
374
|
+
unless defined?(@genomic)
|
375
|
+
@genomic = SeqDesc.parse(@d0.find { |x| /^Genomic\:/ =~ x })
|
376
|
+
end
|
377
|
+
@genomic
|
378
|
+
end
|
379
|
+
|
380
|
+
# Returns sequence informations of the mRNA.
|
381
|
+
# Returns a Bio::Spidey::Report::SeqDesc object.
|
382
|
+
# This would be a Bio::Spidey specific method.
|
383
|
+
def mrna
|
384
|
+
unless defined?(@mrna)
|
385
|
+
@mrna = SeqDesc.parse(@d0.find { |x| /^mRNA\:/ =~ x })
|
386
|
+
end
|
387
|
+
@mrna
|
388
|
+
end
|
389
|
+
|
390
|
+
# Parses segment pairs.
|
391
|
+
def parse_segmentpairs
|
392
|
+
aln = self.align.dup
|
393
|
+
ex = []
|
394
|
+
itr = []
|
395
|
+
segpairs = []
|
396
|
+
cflag = self.complement?
|
397
|
+
strand = self.strand
|
398
|
+
if strand == 'minus' then
|
399
|
+
d_to = 1; d_from = -1
|
400
|
+
else
|
401
|
+
d_to = -1; d_from = 1
|
402
|
+
end
|
403
|
+
@d0.each do |x|
|
404
|
+
#p x
|
405
|
+
if x =~ /^Exon\s*\d+(\(.*\))?\:/ then
|
406
|
+
if a = aln.shift then
|
407
|
+
y = SegmentPair.parse(x, strand, cflag, a[1])
|
408
|
+
ex << y
|
409
|
+
if a[0][0].to_s.length > 0 then
|
410
|
+
to = y.genomic.from + d_to
|
411
|
+
i0 = SegmentPair.new_intron(nil, to, strand, a[0])
|
412
|
+
itr << i0
|
413
|
+
segpairs << i0
|
414
|
+
end
|
415
|
+
segpairs << y
|
416
|
+
if a[2][0].to_s.length > 0 then
|
417
|
+
from = y.genomic.to + d_from
|
418
|
+
i2 = SegmentPair.new_intron(from, nil, strand, a[2])
|
419
|
+
itr << i2
|
420
|
+
segpairs << i2
|
421
|
+
end
|
422
|
+
else
|
423
|
+
y = SegmentPair.parse(x, strand, cflag, [])
|
424
|
+
ex << y
|
425
|
+
segpairs << y
|
426
|
+
end
|
427
|
+
end
|
428
|
+
end
|
429
|
+
@exons = ex
|
430
|
+
@introns = itr
|
431
|
+
@segmentpairs = segpairs
|
432
|
+
end
|
433
|
+
private :parse_segmentpairs
|
434
|
+
|
435
|
+
# Returns exons of the hit.
|
436
|
+
# Returns an array of Bio::Spidey::Report::SegmentPair object.
|
437
|
+
def exons
|
438
|
+
unless defined?(@exons); parse_segmentpairs; end
|
439
|
+
@exons
|
440
|
+
end
|
441
|
+
|
442
|
+
# Returns introns of the hit.
|
443
|
+
# Some of them would contain untranscribed regions.
|
444
|
+
# Returns an array of Bio::Spidey::Report::SegmentPair objects.
|
445
|
+
# (Note that intron data is not always available
|
446
|
+
# according to run-time options of the program.)
|
447
|
+
def introns
|
448
|
+
unless defined?(@introns); parse_segmentpairs; end
|
449
|
+
@introns
|
450
|
+
end
|
451
|
+
|
452
|
+
# Returns segment pairs (exons and introns) of the hit.
|
453
|
+
# Each segment pair is a Bio::Spidey::Report::SegmentPair object.
|
454
|
+
# Returns an array of Bio::Spidey::Report::SegmentPair objects.
|
455
|
+
# (Note that intron data is not always available
|
456
|
+
# according to run-time options of the program.)
|
457
|
+
def segmentpairs
|
458
|
+
unless defined?(@segmentparis); parse_segmentpairs; end
|
459
|
+
@segmentpairs
|
460
|
+
end
|
461
|
+
|
462
|
+
# Returns alignments.
|
463
|
+
# Returns an Array of arrays.
|
464
|
+
# This would be a Bio::Spidey specific method.
|
465
|
+
def align
|
466
|
+
unless defined?(@align); parse_align; end
|
467
|
+
@align
|
468
|
+
end
|
469
|
+
|
470
|
+
# Parses alignment lines.
|
471
|
+
def parse_align_lines(data)
|
472
|
+
misc = [ [], [], [], [] ]
|
473
|
+
data.each do |x|
|
474
|
+
a = x.split(/\r?\n/)
|
475
|
+
if g = a.shift then
|
476
|
+
misc[0] << g
|
477
|
+
(1..3).each do |i|
|
478
|
+
if y = a.shift then
|
479
|
+
if y.length < g.length
|
480
|
+
y << ' ' * (g.length - y.length)
|
481
|
+
end
|
482
|
+
misc[i] << y
|
483
|
+
else
|
484
|
+
misc[i] << ' ' * g.length
|
485
|
+
end
|
486
|
+
end
|
487
|
+
end
|
488
|
+
end
|
489
|
+
misc.collect! { |x| x.join('') }
|
490
|
+
left = []
|
491
|
+
if /\A +/ =~ misc[2] then
|
492
|
+
len = $&.size
|
493
|
+
left = misc.collect { |x| x[0, len] }
|
494
|
+
misc.each { |x| x[0, len] = '' }
|
495
|
+
end
|
496
|
+
right = []
|
497
|
+
if / +\z/ =~ misc[2] then
|
498
|
+
len = $&.size
|
499
|
+
right = misc.collect { |x| x[(-len)..-1] }
|
500
|
+
misc.each { |x| x[(-len)..-1] = '' }
|
501
|
+
end
|
502
|
+
body = misc
|
503
|
+
[ left, body, right ]
|
504
|
+
end
|
505
|
+
private :parse_align_lines
|
506
|
+
|
507
|
+
# Parses alignments.
|
508
|
+
def parse_align
|
509
|
+
r = []
|
510
|
+
data = @data
|
511
|
+
while !data.empty?
|
512
|
+
a = []
|
513
|
+
while x = data.shift and !(x =~ /^(Genomic|Exon\s*\d+)\:/)
|
514
|
+
a.push x
|
515
|
+
end
|
516
|
+
r.push parse_align_lines(a) unless a.empty?
|
517
|
+
end
|
518
|
+
@align = r
|
519
|
+
end
|
520
|
+
private :parse_align
|
521
|
+
|
522
|
+
#--
|
523
|
+
# Bio::BLAST::*::Report::Hit compatible methods
|
524
|
+
#++
|
525
|
+
|
526
|
+
# Length of the mRNA (query) sequence.
|
527
|
+
# Same as Bio::Spidey::Report#query_len.
|
528
|
+
def query_len; mrna.len; end
|
529
|
+
|
530
|
+
# Identifier of the mRNA (query).
|
531
|
+
# Same as Bio::Spidey::Report#query_id.
|
532
|
+
def query_id; mrna.entry_id; end
|
533
|
+
|
534
|
+
# Definition of the mRNA (query).
|
535
|
+
# Same as Bio::Spidey::Report#query_def.
|
536
|
+
def query_def; mrna.definition; end
|
537
|
+
|
538
|
+
# The genomic (target) sequence length.
|
539
|
+
def target_len; genomic.len; end
|
540
|
+
|
541
|
+
# Identifier of the genomic (target) sequence.
|
542
|
+
def target_id; genomic.entry_id; end
|
543
|
+
|
544
|
+
# Definition of the genomic (target) sequence.
|
545
|
+
def target_def; genomic.definition; end
|
546
|
+
|
547
|
+
alias hit_id target_id
|
548
|
+
alias len target_len
|
549
|
+
alias definition target_def
|
550
|
+
|
551
|
+
alias hsps exons
|
552
|
+
|
553
|
+
# Iterates over each exon of the hit.
|
554
|
+
# Yields Bio::Spidey::Report::SegmentPair object.
|
555
|
+
def each(&x) #:yields: segmentpair
|
556
|
+
exons.each(&x)
|
557
|
+
end
|
558
|
+
end #class Hit
|
559
|
+
|
560
|
+
# Returns sequence informationsof the mRNA.
|
561
|
+
# Returns a Bio::Spidey::Report::SeqDesc object.
|
562
|
+
# This would be a Bio::Spidey specific method.
|
563
|
+
def mrna; @hit.mrna; end
|
564
|
+
|
565
|
+
#--
|
566
|
+
#Bio::BLAST::*::Report compatible methods
|
567
|
+
#++
|
568
|
+
|
569
|
+
# Returns number of hits.
|
570
|
+
# Same as hits.size.
|
571
|
+
def num_hits; @hits.size; end
|
572
|
+
|
573
|
+
# Iterates over each hits.
|
574
|
+
# Same as hits.each.
|
575
|
+
# Yields a Bio::Spidey::Report::Hit object.
|
576
|
+
def each_hit(&x) #:yields: hit
|
577
|
+
@hits.each(&x)
|
578
|
+
end
|
579
|
+
alias each each_hit
|
580
|
+
|
581
|
+
# Returns definition of the mRNA (query) sequence.
|
582
|
+
def query_def; @hit.mrna.definition; end
|
583
|
+
|
584
|
+
# Returns identifier of the mRNA (query) sequence.
|
585
|
+
def query_id; @hit.mrna.entry_id; end
|
586
|
+
|
587
|
+
# Returns the length of the mRNA (query) sequence.
|
588
|
+
def query_len; @hit.mrna.len; end
|
589
|
+
end #class Report
|
590
|
+
|
591
|
+
end #class Spidey
|
592
|
+
end #module Bio
|
593
|
+
|