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,263 @@
|
|
1
|
+
module Bio
|
2
|
+
|
3
|
+
#
|
4
|
+
# = bio/appl/pts1.rb - A web service client of PTS1, predicting for the
|
5
|
+
# peroxisomal targeting signal type 1.
|
6
|
+
#
|
7
|
+
# Copyright:: Copyright (C) 2006
|
8
|
+
# Mitsuteru C. Nakao <n@bioruby.org>
|
9
|
+
# License:: The Ruby License
|
10
|
+
#
|
11
|
+
# $Id:$
|
12
|
+
#
|
13
|
+
|
14
|
+
require 'uri'
|
15
|
+
require 'net/http'
|
16
|
+
require 'bio/db/fasta'
|
17
|
+
require 'bio/command'
|
18
|
+
|
19
|
+
# = Bio::PTS1 - A web service client class for PTS1 predictor.
|
20
|
+
#
|
21
|
+
# == Peroxisomal targeting signal type 1 (PTS1) predictor
|
22
|
+
#
|
23
|
+
# Bio::PTS1 class is a client of the PTS1 predictor.
|
24
|
+
#
|
25
|
+
# == Examples
|
26
|
+
#
|
27
|
+
# require 'bio'
|
28
|
+
# sp = Bio::SPTR.new(Bio::Fetch.query("sp", "p53_human"))
|
29
|
+
# faa = sp.seq.to_fasta(sp.entry_id)
|
30
|
+
# pts1 = Bio::PTS1.new
|
31
|
+
# report = pts1.exec_remote(faa)
|
32
|
+
# report.output #=> "<HTML>\n<HEAD><TITLE>PTS1 Prediction Server ..."
|
33
|
+
# report.prediction #=> "Not targeted"
|
34
|
+
# report.cterm #=> "KLMFKTEGPDSD"
|
35
|
+
# report.score #=> "-79.881"
|
36
|
+
# report.fp #=> "67.79%"
|
37
|
+
# report.sppta #=> "-1.110"
|
38
|
+
# report.spptna #=> "-41.937"
|
39
|
+
# report.profile #=> "-36.834"
|
40
|
+
#
|
41
|
+
# == References
|
42
|
+
#
|
43
|
+
# * The PTS1 predictor
|
44
|
+
# http://mendel.imp.ac.at/mendeljsp/sat/pts1/PTS1predictor.jsp
|
45
|
+
#
|
46
|
+
# * Neuberger G, Maurer-Stroh S, Eisenhaber B, Hartig A, Eisenhaber F.
|
47
|
+
# Motif refinement of the peroxisomal targeting signal 1 and evaluation
|
48
|
+
# of taxon-specific differences.
|
49
|
+
# J Mol Biol. 2003 May 2;328(3):567-79. PMID: 12706717
|
50
|
+
#
|
51
|
+
# * Neuberger G, Maurer-Stroh S, Eisenhaber B, Hartig A, Eisenhaber F.
|
52
|
+
# Prediction of peroxisomal targeting signal 1 containing proteins from
|
53
|
+
# amino acid sequence.
|
54
|
+
# J Mol Biol. 2003 May 2;328(3):581-92. PMID: 12706718
|
55
|
+
#
|
56
|
+
class PTS1
|
57
|
+
|
58
|
+
# Organism specific parameter value: function names.
|
59
|
+
FUNCTION = {
|
60
|
+
'METAZOA-specific' => 1,
|
61
|
+
'FUNGI-specific' => 2,
|
62
|
+
'GENERAL' => 3,
|
63
|
+
}
|
64
|
+
|
65
|
+
# Output report.
|
66
|
+
attr_reader :output
|
67
|
+
|
68
|
+
# Used function name (Integer).
|
69
|
+
# function_name = Bio::PTS1::FUNCTION.find_all {|k,v| v == pts1.function }[0][0]
|
70
|
+
attr_reader :function
|
71
|
+
|
72
|
+
# Short-cut for Bio::PTS1.new(Bio::PTS1::FUNCTION['METAZOA-specific'])
|
73
|
+
def self.new_with_metazoa_function
|
74
|
+
self.new('METAZOA-specific')
|
75
|
+
end
|
76
|
+
|
77
|
+
# Short-cut for Bio::PTS1.new(Bio::PTS1::FUNCTION['FUNGI-specific'])
|
78
|
+
def self.new_with_fungi_function
|
79
|
+
self.new('FUNGI-specific')
|
80
|
+
end
|
81
|
+
|
82
|
+
# Short-cut for Bio::PTS1.new(Bio::PTS1::FUNCTION['GENERAL'])
|
83
|
+
def self.new_with_general_function
|
84
|
+
self.new('GENERAL')
|
85
|
+
end
|
86
|
+
|
87
|
+
|
88
|
+
# Constructs Bio::PTS1 web service client.
|
89
|
+
#
|
90
|
+
# == Examples
|
91
|
+
#
|
92
|
+
# serv_default_metazoa_specific = Bio::PTS1.new
|
93
|
+
# serv_general_function = Bio::PTS1.new('GENERAL')
|
94
|
+
# serv_fungi_specific = Bio::PTS1.new(2) # See Bio::PTS1::FUNCTION.
|
95
|
+
#
|
96
|
+
def initialize(func = 'METAZOA-specific')
|
97
|
+
@host = "mendel.imp.ac.at"
|
98
|
+
@cgi_path = "/sat/pts1/cgi-bin/pts1.cgi"
|
99
|
+
@output = nil
|
100
|
+
@function = function(func)
|
101
|
+
end
|
102
|
+
|
103
|
+
|
104
|
+
# Sets and shows the function parameter.
|
105
|
+
#
|
106
|
+
# Organism specific parameter: function names (Bio::PTS1::FUNTION.keys).
|
107
|
+
#
|
108
|
+
#
|
109
|
+
# == Examples
|
110
|
+
#
|
111
|
+
# # sets function name parameter.
|
112
|
+
# serv = Bio::PTS1.new
|
113
|
+
# serv.function('METAZOA-specific')
|
114
|
+
#
|
115
|
+
# # shows function name parameter.
|
116
|
+
# serv.function #=> "METAZOA-specific"
|
117
|
+
#
|
118
|
+
def function(func = nil)
|
119
|
+
return @function.keys.join('') if func == nil
|
120
|
+
|
121
|
+
if FUNCTION.values.include?(func)
|
122
|
+
@function = Hash[*FUNCTION.find {|x| x[1] == func}]
|
123
|
+
elsif FUNCTION[func]
|
124
|
+
@function = {func => FUNCTION[func]}
|
125
|
+
else
|
126
|
+
raise ArgumentError,
|
127
|
+
"Invalid argument: #{func}",
|
128
|
+
"Available function names: #{FUNCTION.keys.inspect}"
|
129
|
+
end
|
130
|
+
@function
|
131
|
+
end
|
132
|
+
|
133
|
+
|
134
|
+
# Executes the query request and returns result output in Bio::PTS1::Report.
|
135
|
+
# The query argument is available both aSting in fasta format text and
|
136
|
+
# aBio::FastaFormat.
|
137
|
+
#
|
138
|
+
# == Examples
|
139
|
+
#
|
140
|
+
# require 'bio'
|
141
|
+
# pts1 = Bio::PTS1.new
|
142
|
+
# pts1.exec(">title\nKLMFKTEGPDSD")
|
143
|
+
#
|
144
|
+
# pts1.exec(Bio::FastaFormat.new(">title\nKLMFKTEGPDSD"))
|
145
|
+
#
|
146
|
+
def exec(query)
|
147
|
+
seq = set_sequence_in_fastaformat(query)
|
148
|
+
|
149
|
+
@form_data = {'function' => @function.values.join(''),
|
150
|
+
'sequence' => seq.seq,
|
151
|
+
'name' => seq.definition }
|
152
|
+
@uri = URI.parse(["http:/", @host, @cgi_path].join('/'))
|
153
|
+
|
154
|
+
result = Bio::Command.post_form(@uri, @form_data)
|
155
|
+
@output = Report.new(result.body)
|
156
|
+
|
157
|
+
return @output
|
158
|
+
end
|
159
|
+
|
160
|
+
private
|
161
|
+
|
162
|
+
# Sets query sequence in Fasta Format if any.
|
163
|
+
def set_sequence_in_fastaformat(query)
|
164
|
+
if query.class == Bio::FastaFormat
|
165
|
+
return query
|
166
|
+
else
|
167
|
+
return Bio::FastaFormat.new(query)
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
171
|
+
|
172
|
+
# = Parser for the PTS1 prediction Report (in HTML).
|
173
|
+
#
|
174
|
+
#
|
175
|
+
class Report
|
176
|
+
|
177
|
+
# Query sequence name.
|
178
|
+
attr_reader :entry_id
|
179
|
+
|
180
|
+
# Amino acids subsequence at C-terminal region.
|
181
|
+
attr_reader :cterm
|
182
|
+
|
183
|
+
# Score
|
184
|
+
attr_reader :score
|
185
|
+
|
186
|
+
# Profile
|
187
|
+
attr_reader :profile
|
188
|
+
|
189
|
+
# S_ppt (non accessibility)
|
190
|
+
attr_reader :spptna
|
191
|
+
|
192
|
+
# S_ppt (accessibility)
|
193
|
+
attr_reader :sppta
|
194
|
+
|
195
|
+
# False positive probability
|
196
|
+
attr_reader :fp
|
197
|
+
|
198
|
+
# Prediction ("Targeted", "Twilight zone" and "Not targeted")
|
199
|
+
attr_reader :prediction
|
200
|
+
|
201
|
+
# Raw output
|
202
|
+
attr_reader :output
|
203
|
+
|
204
|
+
# Parsing PTS1 HTML report.
|
205
|
+
#
|
206
|
+
# == Example
|
207
|
+
#
|
208
|
+
# report = Bio::PTS1::Report.new(str)
|
209
|
+
# report.cterm
|
210
|
+
#
|
211
|
+
def initialize(str)
|
212
|
+
@cterm = ''
|
213
|
+
@score = 0
|
214
|
+
@profile = 0
|
215
|
+
@spptna = 0
|
216
|
+
@sppta = 0
|
217
|
+
@fp = 0
|
218
|
+
@prediction = 0
|
219
|
+
|
220
|
+
if /PTS1 query prediction/m =~ str
|
221
|
+
@output = str
|
222
|
+
parse
|
223
|
+
else
|
224
|
+
raise
|
225
|
+
end
|
226
|
+
end
|
227
|
+
|
228
|
+
|
229
|
+
private
|
230
|
+
|
231
|
+
def parse
|
232
|
+
@output.each_line do |line|
|
233
|
+
case line
|
234
|
+
when /Name<\/td><td>(\S.+)<\/td><\/tr>/
|
235
|
+
@entry_id = $1
|
236
|
+
when /C-terminus<\/td><td>(\w+)<\/td>/
|
237
|
+
@cterm = $1
|
238
|
+
when /Score<\/b><td><b>(-?\d.+?)<\/b><\/td><\/tr>/
|
239
|
+
@score = $1
|
240
|
+
when /Profile<\/i><\/td><td>(.+?)<\/td>/
|
241
|
+
@profile = $1
|
242
|
+
when /S_ppt \(non-accessibility\)<\/i><\/td><td>(.+?)<\/td>/
|
243
|
+
@spptna = $1
|
244
|
+
when /S_ppt \(accessibility\)<\/i><\/td><td>(.+?)<\/td>/
|
245
|
+
@sppta = $1
|
246
|
+
when /P\(false positive\)<\/i><\/td><td>(.+?)<\/td>/
|
247
|
+
@fp = $1
|
248
|
+
when /Prediction classification<\/i><\/td><td>(\w.+?)<\/td>/
|
249
|
+
@prediction = $1
|
250
|
+
else
|
251
|
+
end
|
252
|
+
end
|
253
|
+
end
|
254
|
+
|
255
|
+
end # class Report
|
256
|
+
|
257
|
+
end # class PTS1
|
258
|
+
|
259
|
+
end # module Bio
|
260
|
+
|
261
|
+
|
262
|
+
|
263
|
+
|
@@ -0,0 +1,124 @@
|
|
1
|
+
#
|
2
|
+
# = bio/appl/sim4.rb - sim4 wrapper class
|
3
|
+
#
|
4
|
+
# Copyright:: Copyright (C) 2004 GOTO Naohisa <ng@bioruby.org>
|
5
|
+
# License:: The Ruby License
|
6
|
+
#
|
7
|
+
# $Id: sim4.rb,v 1.10 2007/04/05 23:35:39 trevor Exp $
|
8
|
+
#
|
9
|
+
# The sim4 execution wrapper class.
|
10
|
+
#
|
11
|
+
# == References
|
12
|
+
#
|
13
|
+
# * Florea, L., et al., A Computer program for aligning a cDNA sequence
|
14
|
+
# with a genomic DNA sequence, Genome Research, 8, 967--974, 1998.
|
15
|
+
# http://www.genome.org/cgi/content/abstract/8/9/967
|
16
|
+
#
|
17
|
+
|
18
|
+
require 'tempfile'
|
19
|
+
require 'bio/command'
|
20
|
+
|
21
|
+
module Bio
|
22
|
+
|
23
|
+
# The sim4 execution wrapper class.
|
24
|
+
class Sim4
|
25
|
+
|
26
|
+
autoload :Report, 'bio/appl/sim4/report'
|
27
|
+
|
28
|
+
# Creates a new sim4 execution wrapper object.
|
29
|
+
# [+program+] Program name. Usually 'sim4' in UNIX.
|
30
|
+
# [+database+] Default file name of database('seq2').
|
31
|
+
# [+option+] Options (array of strings).
|
32
|
+
def initialize(program = 'sim4', database = nil, opt = [])
|
33
|
+
@program = program
|
34
|
+
@options = opt
|
35
|
+
@database = database #seq2
|
36
|
+
@command = nil
|
37
|
+
@output = nil
|
38
|
+
@report = nil
|
39
|
+
end
|
40
|
+
|
41
|
+
# default file name of database('seq2')
|
42
|
+
attr_accessor :database
|
43
|
+
|
44
|
+
# name of the program (usually 'sim4' in UNIX)
|
45
|
+
attr_reader :program
|
46
|
+
|
47
|
+
# options
|
48
|
+
attr_accessor :options
|
49
|
+
|
50
|
+
# option is deprecated. Instead, please use options.
|
51
|
+
def option
|
52
|
+
warn "option is deprecated. Please use options."
|
53
|
+
options
|
54
|
+
end
|
55
|
+
|
56
|
+
# last command-line strings executed by the object
|
57
|
+
attr_reader :command
|
58
|
+
|
59
|
+
#---
|
60
|
+
# last messages of program reported to the STDERR
|
61
|
+
#attr_reader :log
|
62
|
+
#+++
|
63
|
+
|
64
|
+
#log is deprecated (no replacement) and returns empty string.
|
65
|
+
def log
|
66
|
+
warn "log is deprecated (no replacement) and returns empty string."
|
67
|
+
''
|
68
|
+
end
|
69
|
+
|
70
|
+
# last result text (String)
|
71
|
+
attr_reader :output
|
72
|
+
|
73
|
+
# last result. Returns a Bio::Sim4::Report object.
|
74
|
+
attr_reader :report
|
75
|
+
|
76
|
+
# Executes the sim4 program.
|
77
|
+
# <tt>seq1</tt> shall be a Bio::Sequence object.
|
78
|
+
# Returns a Bio::Sim4::Report object.
|
79
|
+
def query(seq1)
|
80
|
+
tf = Tempfile.open('sim4')
|
81
|
+
tf.print seq1.to_fasta('seq1', 70)
|
82
|
+
tf.close(false)
|
83
|
+
r = exec_local(tf.path)
|
84
|
+
tf.close(true)
|
85
|
+
r
|
86
|
+
end
|
87
|
+
|
88
|
+
# Executes the sim4 program.
|
89
|
+
# Perform mRNA-genome alignment between given sequences.
|
90
|
+
# <tt>seq1</tt> and <tt>seq2</tt> should be Bio::Sequence objects.
|
91
|
+
# Returns a Bio::Sim4::Report object.
|
92
|
+
def query_pairwise(seq1, seq2)
|
93
|
+
tf = Tempfile.open('sim4')
|
94
|
+
tf.print seq1.to_fasta('seq1', 70)
|
95
|
+
tf.close(false)
|
96
|
+
tf2 = Tempfile.open('seq2')
|
97
|
+
tf2.print seq1.to_fasta('seq2', 70)
|
98
|
+
tf2.close(false)
|
99
|
+
r = exec_local(tf.path, tf2.path)
|
100
|
+
tf.close(true)
|
101
|
+
tf2.close(true)
|
102
|
+
r
|
103
|
+
end
|
104
|
+
|
105
|
+
# Executes the sim4 program.
|
106
|
+
# Perform mRNA-genome alignment between sequences in given files.
|
107
|
+
# <tt>filename1</tt> and <tt>filename2</tt> should be file name strings.
|
108
|
+
# If <tt>filename2</tt> is not specified, using <tt>self.database</tt>.
|
109
|
+
def exec_local(filename1, filename2 = nil)
|
110
|
+
@command = [ @program, filename1, (filename2 or @database), *@options ]
|
111
|
+
@output = nil
|
112
|
+
@report = nil
|
113
|
+
Bio::Command.call_command(@command) do |io|
|
114
|
+
io.close_write
|
115
|
+
@output = io.read
|
116
|
+
@report = Bio::Sim4::Report.new(@output)
|
117
|
+
end
|
118
|
+
@report
|
119
|
+
end
|
120
|
+
alias exec exec_local
|
121
|
+
|
122
|
+
end #class Sim4
|
123
|
+
end #module Bio
|
124
|
+
|
@@ -0,0 +1,485 @@
|
|
1
|
+
#
|
2
|
+
# = bio/appl/sim4/report.rb - sim4 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.9 2007/04/05 23:35:40 trevor Exp $
|
8
|
+
#
|
9
|
+
# The sim4 report parser classes.
|
10
|
+
#
|
11
|
+
# == References
|
12
|
+
#
|
13
|
+
# * Florea, L., et al., A Computer program for aligning a cDNA sequence
|
14
|
+
# with a genomic DNA sequence, Genome Research, 8, 967--974, 1998.
|
15
|
+
# http://www.genome.org/cgi/content/abstract/8/9/967
|
16
|
+
#
|
17
|
+
|
18
|
+
module Bio
|
19
|
+
class Sim4
|
20
|
+
|
21
|
+
# Bio::Sim4::Report is the sim4 report parser class.
|
22
|
+
# Its object may contain some Bio::Sim4::Report::Hit objects.
|
23
|
+
class Report #< DB
|
24
|
+
#--
|
25
|
+
# format: A=0, A=3, or A=4
|
26
|
+
#++
|
27
|
+
|
28
|
+
# Delimiter of each entry. Bio::FlatFile uses it.
|
29
|
+
# In Bio::Sim4::Report, it it nil (1 entry 1 file).
|
30
|
+
DELIMITER = RS = nil # 1 entry 1 file
|
31
|
+
|
32
|
+
# Creates new Bio::Sim4::Report object from String.
|
33
|
+
# You can use Bio::FlatFile to read a file.
|
34
|
+
# Currently, format A=0, A=3, and A=4 are supported.
|
35
|
+
# (A=1, A=2, A=5 are NOT supported yet.)
|
36
|
+
#
|
37
|
+
# Note that 'seq1' in sim4 result is always regarded as 'query',
|
38
|
+
# and 'seq2' is always regarded as 'subject'(target, hit).
|
39
|
+
#
|
40
|
+
# Note that first 'seq1' informations are used for
|
41
|
+
# Bio::Sim4::Report#query_id, #query_def, #query_len, and #seq1 methods.
|
42
|
+
def initialize(text)
|
43
|
+
@hits = []
|
44
|
+
@all_hits = []
|
45
|
+
overrun = ''
|
46
|
+
text.each("\n\nseq1 = ") do |str|
|
47
|
+
str = str.sub(/\A\s+/, '')
|
48
|
+
str.sub!(/\n(^seq1 \= .*)/m, "\n") # remove trailing hits for sure
|
49
|
+
tmp = $1.to_s
|
50
|
+
hit = Hit.new(overrun + str)
|
51
|
+
overrun = tmp
|
52
|
+
unless hit.instance_eval { @data.empty? } then
|
53
|
+
@hits << hit
|
54
|
+
end
|
55
|
+
@all_hits << hit
|
56
|
+
end
|
57
|
+
@seq1 = @all_hits[0].seq1
|
58
|
+
end
|
59
|
+
|
60
|
+
# Returns hits of the entry.
|
61
|
+
# Unlike Bio::Sim4::Report#all_hits, it returns
|
62
|
+
# hits which have alignments.
|
63
|
+
# Returns an Array of Bio::Sim4::Report::Hit objects.
|
64
|
+
attr_reader :hits
|
65
|
+
|
66
|
+
# Returns all hits of the entry.
|
67
|
+
# Unlike Bio::Sim4::Report#hits, it returns
|
68
|
+
# results of all trials of pairwise alignment.
|
69
|
+
# This would be a Bio::Sim4 specific method.
|
70
|
+
# Returns an Array of Bio::Sim4::Report::Hit objects.
|
71
|
+
attr_reader :all_hits
|
72
|
+
|
73
|
+
# Returns sequence informations of 'seq1'.
|
74
|
+
# Returns a Bio::Sim4::Report::SeqDesc object.
|
75
|
+
# This would be a Bio::Sim4 specific method.
|
76
|
+
attr_reader :seq1
|
77
|
+
|
78
|
+
# Bio::Sim4::Report::SeqDesc stores sequence information of
|
79
|
+
# query or subject of sim4 report.
|
80
|
+
class SeqDesc
|
81
|
+
#--
|
82
|
+
# description/definitions of a sequence
|
83
|
+
#++
|
84
|
+
|
85
|
+
# Creates a new object.
|
86
|
+
# It is designed to be called internally from Bio::Sim4::Report object.
|
87
|
+
# Users shall not use it directly.
|
88
|
+
def initialize(seqid, seqdef, len, filename)
|
89
|
+
@entry_id = seqid
|
90
|
+
@definition = seqdef
|
91
|
+
@len = len
|
92
|
+
@filename = filename
|
93
|
+
end
|
94
|
+
# identifier of the sequence
|
95
|
+
attr_reader :entry_id
|
96
|
+
# definition of the sequence
|
97
|
+
attr_reader :definition
|
98
|
+
# sequence length of the sequence
|
99
|
+
attr_reader :len
|
100
|
+
# filename of the sequence
|
101
|
+
attr_reader :filename
|
102
|
+
|
103
|
+
# Parses part of sim4 result text and creates new SeqDesc object.
|
104
|
+
# It is designed to be called internally from Bio::Sim4::Report object.
|
105
|
+
# Users shall not use it directly.
|
106
|
+
def self.parse(str, str2 = nil)
|
107
|
+
/^seq[12] \= (.*)(?: \((.*)\))?\,\s*(\d+)\s*bp\s*$/ =~ str
|
108
|
+
seqid = $2
|
109
|
+
filename = $1
|
110
|
+
len = $3.to_i
|
111
|
+
if str2 then
|
112
|
+
seqdef = str2.sub(/^\>\s*/, '')
|
113
|
+
seqid =seqdef.split(/\s+/, 2)[0] unless seqid
|
114
|
+
else
|
115
|
+
seqdef = (seqid or filename)
|
116
|
+
seqid = filename unless seqid
|
117
|
+
end
|
118
|
+
self.new(seqid, seqdef, len, filename)
|
119
|
+
end
|
120
|
+
end #class SeqDesc
|
121
|
+
|
122
|
+
|
123
|
+
# Sequence segment pair of the sim4 result.
|
124
|
+
# Similar to Bio::Blast::Report::HSP but lacks many methods.
|
125
|
+
# For mRNA-genome mapping programs,
|
126
|
+
# unlike other homology search programs,
|
127
|
+
# the class is used not only for exons but also for introns.
|
128
|
+
# (Note that intron data would not be available according to run-time
|
129
|
+
# options of the program.)
|
130
|
+
class SegmentPair
|
131
|
+
#--
|
132
|
+
# segment pair (like Bio::BLAST::*::Report::HSP)
|
133
|
+
#++
|
134
|
+
|
135
|
+
# Creates a new SegmentPair object.
|
136
|
+
# It is designed to be called internally from
|
137
|
+
# Bio::Sim4::Report::Hit object.
|
138
|
+
# Users shall not use it directly.
|
139
|
+
def initialize(seq1, seq2, midline = nil,
|
140
|
+
percent_identity = nil, direction = nil)
|
141
|
+
@seq1 = seq1
|
142
|
+
@seq2 = seq2
|
143
|
+
@midline = midline
|
144
|
+
@percent_identity = percent_identity
|
145
|
+
@direction = direction
|
146
|
+
end
|
147
|
+
# Returns segment informations of 'seq1'.
|
148
|
+
# Returns a Bio::Sim4::Report::Segment object.
|
149
|
+
# These would be Bio::Sim4 specific methods.
|
150
|
+
attr_reader :seq1
|
151
|
+
# Returns segment informations of 'seq2'.
|
152
|
+
# Returns a Bio::Sim4::Report::Segment object.
|
153
|
+
# These would be Bio::Sim4 specific methods.
|
154
|
+
attr_reader :seq2
|
155
|
+
|
156
|
+
# Returns the "midline" of the segment pair.
|
157
|
+
# Returns nil if no alignment data are available.
|
158
|
+
attr_reader :midline
|
159
|
+
|
160
|
+
# Returns percent identity of the segment pair.
|
161
|
+
attr_reader :percent_identity
|
162
|
+
|
163
|
+
# Returns directions of mapping.
|
164
|
+
# Maybe one of "->", "<-" or "" or nil.
|
165
|
+
# This would be a Bio::Sim4 specific method.
|
166
|
+
attr_reader :direction
|
167
|
+
|
168
|
+
# Parses part of sim4 result text and creates a new SegmentPair object.
|
169
|
+
# It is designed to be called internally from
|
170
|
+
# Bio::Sim4::Report::Hit class.
|
171
|
+
# Users shall not use it directly.
|
172
|
+
def self.parse(str, aln)
|
173
|
+
/^(\d+)\-(\d+)\s*\((\d+)\-(\d+)\)\s*([\d\.]+)\%\s*([\-\<\>]*)/ =~ str
|
174
|
+
self.new(Segment.new($1, $2, aln[0]),
|
175
|
+
Segment.new($3, $4, aln[2]),
|
176
|
+
aln[1], $5, $6)
|
177
|
+
end
|
178
|
+
|
179
|
+
# Parses part of sim4 result text and creates a new SegmentPair
|
180
|
+
# object when the seq1 is a intron.
|
181
|
+
# It is designed to be called internally from
|
182
|
+
# Bio::Sim4::Report::Hit class.
|
183
|
+
# Users shall not use it directly.
|
184
|
+
def self.seq1_intron(prev_e, e, aln)
|
185
|
+
self.new(Segment.new(prev_e.seq1.to+1, e.seq1.from-1, aln[0]),
|
186
|
+
Segment.new(nil, nil, aln[2]),
|
187
|
+
aln[1])
|
188
|
+
end
|
189
|
+
|
190
|
+
# Parses part of sim4 result text and creates a new SegmentPair
|
191
|
+
# object when seq2 is a intron.
|
192
|
+
# It is designed to be called internally from
|
193
|
+
# Bio::Sim4::Report::Hit class.
|
194
|
+
# Users shall not use it directly.
|
195
|
+
def self.seq2_intron(prev_e, e, aln)
|
196
|
+
self.new(Segment.new(nil, nil, aln[0]),
|
197
|
+
Segment.new(prev_e.seq2.to+1, e.seq2.from-1, aln[2]),
|
198
|
+
aln[1])
|
199
|
+
end
|
200
|
+
|
201
|
+
#--
|
202
|
+
# Bio::BLAST::*::Report::Hsp compatible methods
|
203
|
+
# Methods already defined: midline, percent_identity
|
204
|
+
#++
|
205
|
+
|
206
|
+
# start position of the query (the first position is 1)
|
207
|
+
def query_from; @seq1.from; end
|
208
|
+
|
209
|
+
# end position of the query (including its position)
|
210
|
+
def query_to; @seq1.to; end
|
211
|
+
|
212
|
+
# query sequence (with gaps) of the alignment of the segment pair.
|
213
|
+
def qseq; @seq1.seq; end
|
214
|
+
|
215
|
+
# start position of the hit(target) (the first position is 1)
|
216
|
+
def hit_from; @seq2.from; end
|
217
|
+
|
218
|
+
# end position of the hit(target) (including its position)
|
219
|
+
def hit_to; @seq2.to; end
|
220
|
+
|
221
|
+
# hit(target) sequence (with gaps) of the alignment
|
222
|
+
# of the segment pair.
|
223
|
+
def hseq; @seq2.seq; end
|
224
|
+
|
225
|
+
# Returns alignment length of the segment pair.
|
226
|
+
# Returns nil if no alignment data are available.
|
227
|
+
def align_len
|
228
|
+
(@midline and @seq1.seq and @seq2.seq) ? @midline.length : nil
|
229
|
+
end
|
230
|
+
end #class SegmentPair
|
231
|
+
|
232
|
+
# Segment informations of a segment pair.
|
233
|
+
class Segment
|
234
|
+
#--
|
235
|
+
# the segment of a sequence
|
236
|
+
#++
|
237
|
+
|
238
|
+
# Creates a new Segment object.
|
239
|
+
# It is designed to be called internally from
|
240
|
+
# Bio::Sim4::Report::SegmentPair class.
|
241
|
+
# Users shall not use it directly.
|
242
|
+
def initialize(pos_st, pos_ed, seq = nil)
|
243
|
+
@from = pos_st.to_i
|
244
|
+
@to = pos_ed.to_i
|
245
|
+
@seq = seq
|
246
|
+
end
|
247
|
+
# start position of the segment (the first position is 1)
|
248
|
+
attr_reader :from
|
249
|
+
# end position of the segment (including its position)
|
250
|
+
attr_reader :to
|
251
|
+
# sequence (with gaps) of the segment
|
252
|
+
attr_reader :seq
|
253
|
+
end #class Segment
|
254
|
+
|
255
|
+
# Hit object of the sim4 result.
|
256
|
+
# Similar to Bio::Blast::Report::Hit but lacks many methods.
|
257
|
+
class Hit
|
258
|
+
|
259
|
+
# Parses part of sim4 result text and creates a new Hit object.
|
260
|
+
# It is designed to be called internally from Bio::Sim4::Report class.
|
261
|
+
# Users shall not use it directly.
|
262
|
+
def initialize(str)
|
263
|
+
@data = str.split(/\n(?:\r?\n)+/)
|
264
|
+
parse_seqdesc
|
265
|
+
end
|
266
|
+
|
267
|
+
# Parses sequence descriptions.
|
268
|
+
def parse_seqdesc
|
269
|
+
# seq1: query, seq2: target(hit)
|
270
|
+
a0 = @data.shift.split(/\r?\n/)
|
271
|
+
if @data[0].to_s =~ /^\>/ then
|
272
|
+
a1 = @data.shift.split(/\r?\n/)
|
273
|
+
else
|
274
|
+
a1 = []
|
275
|
+
end
|
276
|
+
@seq1 = SeqDesc.parse(a0[0], a1[0])
|
277
|
+
@seq2 = SeqDesc.parse(a0[1], a1[1])
|
278
|
+
|
279
|
+
if @data[0].to_s.sub!(/\A\(complement\)\s*$/, '') then
|
280
|
+
@complement = true
|
281
|
+
@data.shift if @data[0].strip.empty?
|
282
|
+
else
|
283
|
+
@complement = nil
|
284
|
+
end
|
285
|
+
end
|
286
|
+
private :parse_seqdesc
|
287
|
+
|
288
|
+
# Returns sequence informations of 'seq1'.
|
289
|
+
# Returns a Bio::Sim4::Report::SeqDesc object.
|
290
|
+
# This would be Bio::Sim4 specific method.
|
291
|
+
attr_reader :seq1
|
292
|
+
|
293
|
+
# Returns sequence informations of 'seq2'.
|
294
|
+
# Returns a Bio::Sim4::Report::SeqDesc object.
|
295
|
+
# This would be Bio::Sim4 specific method.
|
296
|
+
attr_reader :seq2
|
297
|
+
|
298
|
+
# Returns true if the hit reports '-'(complemental) strand
|
299
|
+
# search result.
|
300
|
+
# Otherwise, return false or nil.
|
301
|
+
# This would be a Bio::Sim4 specific method.
|
302
|
+
def complement?
|
303
|
+
@complement
|
304
|
+
end
|
305
|
+
|
306
|
+
# Parses segment pair.
|
307
|
+
def parse_segmentpairs
|
308
|
+
aln = (self.align ? self.align.dup : [])
|
309
|
+
exo = [] #exons
|
310
|
+
itr = [] #introns
|
311
|
+
sgp = [] #segmentpairs
|
312
|
+
prev_e = nil
|
313
|
+
return unless @data[0]
|
314
|
+
@data[0].split(/\r?\n/).each do |str|
|
315
|
+
ai = (prev_e ? aln.shift : nil)
|
316
|
+
a = (aln.shift or [])
|
317
|
+
e = SegmentPair.parse(str, a)
|
318
|
+
exo << e
|
319
|
+
if ai then
|
320
|
+
# intron data in alignment
|
321
|
+
if ai[2].strip.empty? then
|
322
|
+
i = SegmentPair.seq1_intron(prev_e, e, ai)
|
323
|
+
else
|
324
|
+
i = SegmentPair.seq2_intron(prev_e, e, ai)
|
325
|
+
end
|
326
|
+
itr << i
|
327
|
+
sgp << i
|
328
|
+
end
|
329
|
+
sgp << e
|
330
|
+
prev_e = e
|
331
|
+
end
|
332
|
+
@exons = exo
|
333
|
+
@introns = itr
|
334
|
+
@segmentpairs = sgp
|
335
|
+
end
|
336
|
+
private :parse_segmentpairs
|
337
|
+
|
338
|
+
# Parses alignment.
|
339
|
+
def parse_align
|
340
|
+
s1 = []; ml = []; s2 = []
|
341
|
+
dat = @data[1..-1]
|
342
|
+
return unless dat
|
343
|
+
dat.each do |str|
|
344
|
+
a = str.split(/\r?\n/)
|
345
|
+
a.shift
|
346
|
+
if /^(\s*\d+\s*)(.+)$/ =~ a[0] then
|
347
|
+
range = ($1.length)..($1.length + $2.strip.length - 1)
|
348
|
+
a.collect! { |x| x[range] }
|
349
|
+
s1 << a.shift
|
350
|
+
ml << a.shift
|
351
|
+
s2 << a.shift
|
352
|
+
end
|
353
|
+
end #each
|
354
|
+
alx = ml.join('').split(/([\<\>]+\.+[\<\>]+)/)
|
355
|
+
seq1 = s1.join(''); seq2 = s2.join('')
|
356
|
+
i = 0
|
357
|
+
alx.collect! do |x|
|
358
|
+
len = x.length
|
359
|
+
y = [ seq1[i, len], x, seq2[i, len] ]
|
360
|
+
i += len
|
361
|
+
y
|
362
|
+
end
|
363
|
+
@align = alx
|
364
|
+
end
|
365
|
+
private :parse_align
|
366
|
+
|
367
|
+
# Returns exons of the hit.
|
368
|
+
# Each exon is a Bio::Sim4::Report::SegmentPair object.
|
369
|
+
def exons
|
370
|
+
unless defined?(@exons); parse_segmentpairs; end
|
371
|
+
@exons
|
372
|
+
end
|
373
|
+
|
374
|
+
# Returns segment pairs (exons and introns) of the hit.
|
375
|
+
# Each segment pair is a Bio::Sim4::Report::SegmentPair object.
|
376
|
+
# Returns an array of Bio::Sim4::Report::SegmentPair objects.
|
377
|
+
# (Note that intron data is not always available
|
378
|
+
# according to run-time options of the program.)
|
379
|
+
def segmentpairs
|
380
|
+
unless defined?(@segmentpairs); parse_segmentpairs; end
|
381
|
+
@segmentpairs
|
382
|
+
end
|
383
|
+
|
384
|
+
# Returns introns of the hit.
|
385
|
+
# Some of them would contain untranscribed regions.
|
386
|
+
# Returns an array of Bio::Sim4::Report::SegmentPair objects.
|
387
|
+
# (Note that intron data is not always available
|
388
|
+
# according to run-time options of the program.)
|
389
|
+
def introns
|
390
|
+
unless defined?(@introns); parse_segmentpairs; end
|
391
|
+
@introns
|
392
|
+
end
|
393
|
+
|
394
|
+
# Returns alignments.
|
395
|
+
# Returns an Array of arrays.
|
396
|
+
# Each array contains sequence of seq1, midline, sequence of seq2,
|
397
|
+
# respectively.
|
398
|
+
# This would be a Bio::Sim4 specific method.
|
399
|
+
def align
|
400
|
+
unless defined?(@align); parse_align; end
|
401
|
+
@align
|
402
|
+
end
|
403
|
+
|
404
|
+
#--
|
405
|
+
# Bio::BLAST::*::Report::Hit compatible methods
|
406
|
+
#++
|
407
|
+
|
408
|
+
# Length of the query sequence.
|
409
|
+
# Same as Bio::Sim4::Report#query_len.
|
410
|
+
def query_len; seq1.len; end
|
411
|
+
|
412
|
+
# Identifier of the query sequence.
|
413
|
+
# Same as Bio::Sim4::Report#query_id.
|
414
|
+
def query_id; seq1.entry_id; end
|
415
|
+
|
416
|
+
# Definition of the query sequence
|
417
|
+
# Same as Bio::Sim4::Report#query_def.
|
418
|
+
def query_def; seq1.definition; end
|
419
|
+
|
420
|
+
# length of the hit(target) sequence
|
421
|
+
def target_len; seq2.len; end
|
422
|
+
|
423
|
+
# Identifier of the hit(target) sequence
|
424
|
+
def target_id; seq2.entry_id; end
|
425
|
+
|
426
|
+
# Definition of the hit(target) sequence
|
427
|
+
def target_def; seq2.definition; end
|
428
|
+
|
429
|
+
alias hit_id target_id
|
430
|
+
alias len target_len
|
431
|
+
alias definition target_def
|
432
|
+
|
433
|
+
alias hsps exons
|
434
|
+
|
435
|
+
# Iterates over each exon of the hit.
|
436
|
+
# Yields a Bio::Sim4::Report::SegmentPair object.
|
437
|
+
def each(&x) #:yields: segmentpair
|
438
|
+
exons.each(&x)
|
439
|
+
end
|
440
|
+
end #class Hit
|
441
|
+
|
442
|
+
#--
|
443
|
+
#Bio::BLAST::*::Report compatible methods
|
444
|
+
#++
|
445
|
+
|
446
|
+
# Returns number of hits.
|
447
|
+
# Same as hits.size.
|
448
|
+
def num_hits; @hits.size; end
|
449
|
+
|
450
|
+
# Iterates over each hits of the sim4 result.
|
451
|
+
# Same as hits.each.
|
452
|
+
# Yields a Bio::Sim4::Report::Hit object.
|
453
|
+
def each_hit(&x) #:yields: hit
|
454
|
+
@hits.each(&x)
|
455
|
+
end
|
456
|
+
alias each each_hit
|
457
|
+
|
458
|
+
# Returns the definition of query sequence.
|
459
|
+
# The value will be filename or (first word of) sequence definition
|
460
|
+
# according to sim4 run-time options.
|
461
|
+
def query_def; @seq1.definition; end
|
462
|
+
|
463
|
+
# Returns the identifier of query sequence.
|
464
|
+
# The value will be filename or (first word of) sequence definition
|
465
|
+
# according to sim4 run-time options.
|
466
|
+
def query_id; @seq1.entry_id; end
|
467
|
+
|
468
|
+
# Returns the length of query sequence.
|
469
|
+
def query_len; @seq1.len; end
|
470
|
+
end #class Report
|
471
|
+
|
472
|
+
end #class Sim4
|
473
|
+
end #module Bio
|
474
|
+
|
475
|
+
=begin
|
476
|
+
|
477
|
+
= Bio::Sim4::Report
|
478
|
+
|
479
|
+
= References
|
480
|
+
|
481
|
+
* ((<URL:http://www.genome.org/cgi/content/abstract/8/9/967>))
|
482
|
+
Florea, L., et al., A Computer program for aligning a cDNA sequence
|
483
|
+
with a genomic DNA sequence, Genome Research, 8, 967--974, 1998.
|
484
|
+
|
485
|
+
=end
|