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,212 @@
|
|
1
|
+
#
|
2
|
+
# = bio/appl/gcg/msf.rb - GCG multiple sequence alignment (.msf) parser class
|
3
|
+
#
|
4
|
+
# Copyright:: Copyright (C) 2003, 2006
|
5
|
+
# Naohisa Goto <ng@bioruby.org>
|
6
|
+
# License:: The Ruby License
|
7
|
+
#
|
8
|
+
# $Id: msf.rb,v 1.2 2007/04/05 23:35:39 trevor Exp $
|
9
|
+
#
|
10
|
+
# = About Bio::GCG::Msf
|
11
|
+
#
|
12
|
+
# Please refer document of Bio::GCG::Msf.
|
13
|
+
#
|
14
|
+
|
15
|
+
#---
|
16
|
+
# (depends on autoload)
|
17
|
+
#require 'bio/appl/gcg/seq'
|
18
|
+
#+++
|
19
|
+
|
20
|
+
module Bio
|
21
|
+
module GCG
|
22
|
+
|
23
|
+
# The msf is a multiple sequence alignment format developed by Wisconsin.
|
24
|
+
# Bio::GCG::Msf is a msf format parser.
|
25
|
+
class Msf #< DB
|
26
|
+
|
27
|
+
# delimiter used by Bio::FlatFile
|
28
|
+
DELIMITER = RS = nil
|
29
|
+
|
30
|
+
# Creates a new Msf object.
|
31
|
+
def initialize(str)
|
32
|
+
str = str.sub(/\A[\r\n]+/, '')
|
33
|
+
if /^\!\![A-Z]+\_MULTIPLE\_ALIGNMNENT/ =~ str[/.*/] then
|
34
|
+
@heading = str[/.*/] # '!!NA_MULTIPLE_ALIGNMENT 1.0' or like this
|
35
|
+
str.sub!(/.*/, '')
|
36
|
+
end
|
37
|
+
str.sub!(/.*\.\.$/m, '')
|
38
|
+
@description = $&.to_s.sub(/^.*\.\.$/, '').to_s
|
39
|
+
d = $&.to_s
|
40
|
+
if m = /(.+)\s+MSF\:\s+(\d+)\s+Type\:\s+(\w)\s+(.+)\s+(Comp)?Check\:\s+(\d+)/.match(d) then
|
41
|
+
@entry_id = m[1].to_s.strip
|
42
|
+
@length = (m[2] ? m[2].to_i : nil)
|
43
|
+
@seq_type = m[3]
|
44
|
+
@date = m[4].to_s.strip
|
45
|
+
@checksum = (m[6] ? m[6].to_i : nil)
|
46
|
+
end
|
47
|
+
|
48
|
+
str.sub!(/.*\/\/$/m, '')
|
49
|
+
a = $&.to_s.split(/^/)
|
50
|
+
@seq_info = []
|
51
|
+
a.each do |x|
|
52
|
+
if /Name\: / =~ x then
|
53
|
+
s = {}
|
54
|
+
x.scan(/(\S+)\: +(\S*)/) { |y| s[$1] = $2 }
|
55
|
+
@seq_info << s
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
@data = str
|
60
|
+
@description.sub!(/\A(\r\n|\r|\n)/, '')
|
61
|
+
@align = nil
|
62
|
+
end
|
63
|
+
|
64
|
+
# description
|
65
|
+
attr_reader :description
|
66
|
+
|
67
|
+
# ID of the alignment
|
68
|
+
attr_reader :entry_id
|
69
|
+
|
70
|
+
# alignment length
|
71
|
+
attr_reader :length
|
72
|
+
|
73
|
+
# sequence type ("N" for DNA/RNA or "P" for protein)
|
74
|
+
attr_reader :seq_type
|
75
|
+
|
76
|
+
# date
|
77
|
+
attr_reader :date
|
78
|
+
|
79
|
+
# checksum
|
80
|
+
attr_reader :checksum
|
81
|
+
|
82
|
+
# heading
|
83
|
+
# ('!!NA_MULTIPLE_ALIGNMENT 1.0' or whatever like this)
|
84
|
+
attr_reader :heading
|
85
|
+
|
86
|
+
#---
|
87
|
+
## data (internally used, will be obsoleted)
|
88
|
+
#attr_reader :data
|
89
|
+
#
|
90
|
+
## seq. info. (internally used, will be obsoleted)
|
91
|
+
#attr_reader :seq_info
|
92
|
+
#+++
|
93
|
+
|
94
|
+
# symbol comparison table
|
95
|
+
def symbol_comparison_table
|
96
|
+
unless defined?(@symbol_comparison_table)
|
97
|
+
/Symbol comparison table\: +(\S+)/ =~ @description
|
98
|
+
@symbol_comparison_table = $1
|
99
|
+
end
|
100
|
+
@symbol_comparison_table
|
101
|
+
end
|
102
|
+
|
103
|
+
# gap weight
|
104
|
+
def gap_weight
|
105
|
+
unless defined?(@gap_weight)
|
106
|
+
/GapWeight\: +(\S+)/ =~ @description
|
107
|
+
@gap_weight = $1
|
108
|
+
end
|
109
|
+
@gap_weight
|
110
|
+
end
|
111
|
+
|
112
|
+
# gap length weight
|
113
|
+
def gap_length_weight
|
114
|
+
unless defined?(@gap_length_weight)
|
115
|
+
/GapLengthWeight\: +(\S+)/ =~ @description
|
116
|
+
@gap_length_weight = $1
|
117
|
+
end
|
118
|
+
@gap_length_weight
|
119
|
+
end
|
120
|
+
|
121
|
+
# CompCheck field
|
122
|
+
def compcheck
|
123
|
+
unless defined?(@compcheck)
|
124
|
+
if /CompCheck\: +(\d+)/ =~ @description then
|
125
|
+
@compcheck = $1.to_i
|
126
|
+
else
|
127
|
+
@compcheck = nil
|
128
|
+
end
|
129
|
+
end
|
130
|
+
@compcheck
|
131
|
+
end
|
132
|
+
|
133
|
+
# parsing
|
134
|
+
def do_parse
|
135
|
+
return if @align
|
136
|
+
a = @data.strip.split(/\n\n/)
|
137
|
+
@seq_data = Array.new(@seq_info.size)
|
138
|
+
@seq_data.collect! { |x| Array.new }
|
139
|
+
a.each do |x|
|
140
|
+
b = x.split(/\n/)
|
141
|
+
nw = 0
|
142
|
+
if b.size > @seq_info.size then
|
143
|
+
if /^ +/ =~ b.shift.to_s
|
144
|
+
nw = $&.to_s.length
|
145
|
+
end
|
146
|
+
end
|
147
|
+
if nw > 0 then
|
148
|
+
b.each_with_index { |y, i| y[0, nw] = ''; @seq_data[i] << y }
|
149
|
+
else
|
150
|
+
b.each_with_index { |y, i|
|
151
|
+
@seq_data[i] << y.strip.split(/ +/, 2)[1].to_s
|
152
|
+
}
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
case seq_type
|
157
|
+
when 'P', 'p'
|
158
|
+
k = Bio::Sequence::AA
|
159
|
+
when 'N', 'n'
|
160
|
+
k = Bio::Sequence::NA
|
161
|
+
else
|
162
|
+
k = Bio::Sequence::Generic
|
163
|
+
end
|
164
|
+
@seq_data.collect! do |x|
|
165
|
+
y = x.join('')
|
166
|
+
y.gsub!(/[\s\d]+/, '')
|
167
|
+
k.new(y)
|
168
|
+
end
|
169
|
+
|
170
|
+
aln = Bio::Alignment.new
|
171
|
+
@seq_data.each_with_index do |x, i|
|
172
|
+
aln.store(@seq_info[i]['Name'], x)
|
173
|
+
end
|
174
|
+
@align = aln
|
175
|
+
end
|
176
|
+
private :do_parse
|
177
|
+
|
178
|
+
# returns Bio::Alignment object.
|
179
|
+
def alignment
|
180
|
+
do_parse
|
181
|
+
@align
|
182
|
+
end
|
183
|
+
|
184
|
+
# gets seq data (used internally) (will be obsoleted)
|
185
|
+
def seq_data
|
186
|
+
do_parse
|
187
|
+
@seq_data
|
188
|
+
end
|
189
|
+
|
190
|
+
# validates checksum
|
191
|
+
def validate_checksum
|
192
|
+
do_parse
|
193
|
+
valid = true
|
194
|
+
total = 0
|
195
|
+
@seq_data.each_with_index do |x, i|
|
196
|
+
sum = Bio::GCG::Seq.calc_checksum(x)
|
197
|
+
if sum != @seq_info[i]['Check'].to_i
|
198
|
+
valid = false
|
199
|
+
break
|
200
|
+
end
|
201
|
+
total += sum
|
202
|
+
end
|
203
|
+
return false unless valid
|
204
|
+
if @checksum != 0 # "Check:" field of BioPerl is always 0
|
205
|
+
valid = ((total % 10000) == @checksum)
|
206
|
+
end
|
207
|
+
valid
|
208
|
+
end
|
209
|
+
|
210
|
+
end #class Msf
|
211
|
+
end #module GCG
|
212
|
+
end # module Bio
|
@@ -0,0 +1,195 @@
|
|
1
|
+
#
|
2
|
+
# = bio/appl/gcg/seq.rb - GCG sequence file format class (.seq/.pep file)
|
3
|
+
#
|
4
|
+
# Copyright:: Copyright (C) 2003, 2006
|
5
|
+
# Naohisa Goto <ng@bioruby.org>
|
6
|
+
# License:: The Ruby License
|
7
|
+
#
|
8
|
+
# $Id: seq.rb,v 1.3 2007/04/05 23:35:39 trevor Exp $
|
9
|
+
#
|
10
|
+
# = About Bio::GCG::Seq
|
11
|
+
#
|
12
|
+
# Please refer document of Bio::GCG::Seq.
|
13
|
+
#
|
14
|
+
|
15
|
+
module Bio
|
16
|
+
module GCG
|
17
|
+
|
18
|
+
#
|
19
|
+
# = Bio::GCG::Seq
|
20
|
+
#
|
21
|
+
# This is GCG sequence file format (.seq or .pep) parser class.
|
22
|
+
#
|
23
|
+
# = References
|
24
|
+
#
|
25
|
+
# * Information about GCG Wisconsin Package(R)
|
26
|
+
# http://www.accelrys.com/products/gcg_wisconsin_package .
|
27
|
+
# * EMBOSS sequence formats
|
28
|
+
# http://www.hgmp.mrc.ac.uk/Software/EMBOSS/Themes/SequenceFormats.html
|
29
|
+
# * BioPerl document
|
30
|
+
# http://docs.bioperl.org/releases/bioperl-1.2.3/Bio/SeqIO/gcg.html
|
31
|
+
class Seq #< DB
|
32
|
+
|
33
|
+
# delimiter used by Bio::FlatFile
|
34
|
+
DELIMITER = RS = nil
|
35
|
+
|
36
|
+
# Creates new instance of this class.
|
37
|
+
# str must be a GCG seq formatted string.
|
38
|
+
def initialize(str)
|
39
|
+
@heading = str[/.*/] # '!!NA_SEQUENCE 1.0' or like this
|
40
|
+
str = str.sub(/.*/, '')
|
41
|
+
str.sub!(/.*\.\.$/m, '')
|
42
|
+
@definition = $&.to_s.sub(/^.*\.\.$/, '').to_s
|
43
|
+
desc = $&.to_s
|
44
|
+
if m = /(.+)\s+Length\:\s+(\d+)\s+(.+)\s+Type\:\s+(\w)\s+Check\:\s+(\d+)/.match(desc) then
|
45
|
+
@entry_id = m[1].to_s.strip
|
46
|
+
@length = (m[2] ? m[2].to_i : nil)
|
47
|
+
@date = m[3].to_s.strip
|
48
|
+
@seq_type = m[4]
|
49
|
+
@checksum = (m[5] ? m[5].to_i : nil)
|
50
|
+
end
|
51
|
+
@data = str
|
52
|
+
@seq = nil
|
53
|
+
@definition.strip!
|
54
|
+
end
|
55
|
+
|
56
|
+
# ID field.
|
57
|
+
attr_reader :entry_id
|
58
|
+
|
59
|
+
# Description field.
|
60
|
+
attr_reader :definition
|
61
|
+
|
62
|
+
# "Length:" field.
|
63
|
+
# Note that sometimes this might differ from real sequence length.
|
64
|
+
attr_reader :length
|
65
|
+
|
66
|
+
# Date field of this entry.
|
67
|
+
attr_reader :date
|
68
|
+
|
69
|
+
# "Type:" field, which indicates sequence type.
|
70
|
+
# "N" means nucleic acid sequence, "P" means protein sequence.
|
71
|
+
attr_reader :seq_type
|
72
|
+
|
73
|
+
# "Check:" field, which indicates checksum of current sequence.
|
74
|
+
attr_reader :checksum
|
75
|
+
|
76
|
+
# heading
|
77
|
+
# ('!!NA_SEQUENCE 1.0' or whatever like this)
|
78
|
+
attr_reader :heading
|
79
|
+
|
80
|
+
#---
|
81
|
+
## data (internally used, will be obsoleted)
|
82
|
+
#attr_reader :data
|
83
|
+
#+++
|
84
|
+
|
85
|
+
# Sequence data.
|
86
|
+
# The class of the sequence is Bio::Sequence::NA, Bio::Sequence::AA
|
87
|
+
# or Bio::Sequence::Generic, according to the sequence type.
|
88
|
+
def seq
|
89
|
+
unless @seq then
|
90
|
+
case @seq_type
|
91
|
+
when 'N', 'n'
|
92
|
+
k = Bio::Sequence::NA
|
93
|
+
when 'P', 'p'
|
94
|
+
k = Bio::Sequence::AA
|
95
|
+
else
|
96
|
+
k = Bio::Sequence
|
97
|
+
end
|
98
|
+
@seq = k.new(@data.tr('^-a-zA-Z.~', ''))
|
99
|
+
end
|
100
|
+
@seq
|
101
|
+
end
|
102
|
+
|
103
|
+
# If you know the sequence is AA, use this method.
|
104
|
+
# Returns a Bio::Sequence::AA object.
|
105
|
+
#
|
106
|
+
# If you call naseq for protein sequence,
|
107
|
+
# or aaseq for nucleic sequence, RuntimeError will be raised.
|
108
|
+
def aaseq
|
109
|
+
if seq.is_a?(Bio::Sequence::AA) then
|
110
|
+
@seq
|
111
|
+
else
|
112
|
+
raise 'seq_type != \'P\''
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
# If you know the sequence is NA, use this method.
|
117
|
+
# Returens a Bio::Sequence::NA object.
|
118
|
+
#
|
119
|
+
# If you call naseq for protein sequence,
|
120
|
+
# or aaseq for nucleic sequence, RuntimeError will be raised.
|
121
|
+
def naseq
|
122
|
+
if seq.is_a?(Bio::Sequence::NA) then
|
123
|
+
@seq
|
124
|
+
else
|
125
|
+
raise 'seq_type != \'N\''
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
# Validates checksum.
|
130
|
+
# If validation succeeds, returns true.
|
131
|
+
# Otherwise, returns false.
|
132
|
+
def validate_checksum
|
133
|
+
checksum == self.class.calc_checksum(seq)
|
134
|
+
end
|
135
|
+
|
136
|
+
#---
|
137
|
+
# class methods
|
138
|
+
#+++
|
139
|
+
|
140
|
+
# Calculates checksum from given string.
|
141
|
+
def self.calc_checksum(str)
|
142
|
+
# Reference: Bio::SeqIO::gcg of BioPerl-1.2.3
|
143
|
+
idx = 0
|
144
|
+
sum = 0
|
145
|
+
str.upcase.tr('^A-Z.~', '').each_byte do |c|
|
146
|
+
idx += 1
|
147
|
+
sum += idx * c
|
148
|
+
idx = 0 if idx >= 57
|
149
|
+
end
|
150
|
+
(sum % 10000)
|
151
|
+
end
|
152
|
+
|
153
|
+
# Creates a new GCG sequence format text.
|
154
|
+
# Parameters can be omitted.
|
155
|
+
#
|
156
|
+
# Examples:
|
157
|
+
# Bio::GCG::Seq.to_gcg(:definition=>'H.sapiens DNA',
|
158
|
+
# :seq_type=>'N', :entry_id=>'gi-1234567',
|
159
|
+
# :seq=>seq, :date=>date)
|
160
|
+
#
|
161
|
+
def self.to_gcg(hash)
|
162
|
+
seq = hash[:seq]
|
163
|
+
if seq.is_a?(Bio::Sequence::NA) then
|
164
|
+
seq_type = 'N'
|
165
|
+
elsif seq.is_a?(Bio::Sequence::AA) then
|
166
|
+
seq_type = 'P'
|
167
|
+
else
|
168
|
+
seq_type = (hash[:seq_type] or 'P')
|
169
|
+
end
|
170
|
+
if seq_type == 'N' then
|
171
|
+
head = '!!NA_SEQUENCE 1.0'
|
172
|
+
else
|
173
|
+
head = '!!AA_SEQUENCE 1.0'
|
174
|
+
end
|
175
|
+
date = (hash[:date] or Time.now.strftime('%B %d, %Y %H:%M'))
|
176
|
+
entry_id = hash[:entry_id].to_s.strip
|
177
|
+
len = seq.length
|
178
|
+
checksum = self.calc_checksum(seq)
|
179
|
+
definition = hash[:definition].to_s.strip
|
180
|
+
seq = seq.upcase.gsub(/.{1,50}/, "\\0\n")
|
181
|
+
seq.gsub!(/.{10}/, "\\0 ")
|
182
|
+
w = len.to_s.size + 1
|
183
|
+
i = 1
|
184
|
+
seq.gsub!(/^/) { |x| s = sprintf("\n%*d ", w, i); i += 50; s }
|
185
|
+
|
186
|
+
[ head, "\n", definition, "\n\n",
|
187
|
+
"#{entry_id} Length: #{len} #{date} " \
|
188
|
+
"Type: #{seq_type} Check: #{checksum} ..\n",
|
189
|
+
seq, "\n" ].join('')
|
190
|
+
end
|
191
|
+
|
192
|
+
end #class Seq
|
193
|
+
end #module GCG
|
194
|
+
end #module Bio
|
195
|
+
|
@@ -0,0 +1,552 @@
|
|
1
|
+
#
|
2
|
+
# = bio/appl/genscan/report.rb - Genscan report classes
|
3
|
+
#
|
4
|
+
# Copyright:: Copyright (C) 2003
|
5
|
+
# Mitsuteru C. Nakao <n@bioruby.org>
|
6
|
+
# License:: The Ruby License
|
7
|
+
#
|
8
|
+
# $Id:$
|
9
|
+
#
|
10
|
+
# == Description
|
11
|
+
#
|
12
|
+
#
|
13
|
+
# == Example
|
14
|
+
#
|
15
|
+
# == References
|
16
|
+
#
|
17
|
+
|
18
|
+
require 'bio/db/fasta'
|
19
|
+
|
20
|
+
|
21
|
+
module Bio
|
22
|
+
|
23
|
+
# = Bio::Genscan
|
24
|
+
class Genscan
|
25
|
+
|
26
|
+
# = Bio::Genscan::Report - Class for Genscan report output.
|
27
|
+
#
|
28
|
+
# Parser for the Genscan report output.
|
29
|
+
# * Genscan http://genes.mit.edu/GENSCAN.html
|
30
|
+
class Report
|
31
|
+
|
32
|
+
# Returns Genscan version.
|
33
|
+
attr_reader :genscan_version
|
34
|
+
|
35
|
+
# Returns
|
36
|
+
attr_reader :date_run
|
37
|
+
|
38
|
+
# Returns
|
39
|
+
attr_reader :time
|
40
|
+
|
41
|
+
# Returns Name of query sequence.
|
42
|
+
attr_reader :query_name
|
43
|
+
alias_method :sequence_name, :query_name
|
44
|
+
alias_method :name, :query_name
|
45
|
+
|
46
|
+
# Returns Length of the query sequence.
|
47
|
+
attr_reader :length
|
48
|
+
|
49
|
+
# Returns C+G content of the query sequence.
|
50
|
+
attr_reader :gccontent
|
51
|
+
|
52
|
+
# Returns
|
53
|
+
attr_reader :isochore
|
54
|
+
|
55
|
+
# Returns
|
56
|
+
attr_reader :matrix
|
57
|
+
|
58
|
+
# Returns Array of Bio::Genscan::Report::Gene.
|
59
|
+
attr_reader :predictions
|
60
|
+
alias_method :prediction, :predictions
|
61
|
+
alias_method :genes, :predictions
|
62
|
+
|
63
|
+
|
64
|
+
# Bio::Genscan::Report.new(str)
|
65
|
+
#
|
66
|
+
# Parse a Genscan report output string.
|
67
|
+
def initialize(report)
|
68
|
+
@predictions = []
|
69
|
+
@genscan_version = nil
|
70
|
+
@date_run = nil
|
71
|
+
@time = nil
|
72
|
+
@query_name = nil
|
73
|
+
@length = nil
|
74
|
+
@gccontent = nil
|
75
|
+
@isochore = nil
|
76
|
+
@matrix = nil
|
77
|
+
|
78
|
+
report.each_line("\n") do |line|
|
79
|
+
case line
|
80
|
+
when /^GENSCAN/
|
81
|
+
parse_headline(line)
|
82
|
+
when /^Sequence/
|
83
|
+
parse_sequence(line)
|
84
|
+
when /^Parameter/
|
85
|
+
parse_parameter(line)
|
86
|
+
when /^Predicted genes/
|
87
|
+
break
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
# rests
|
92
|
+
i = report.index(/^Predicted gene/)
|
93
|
+
j = report.index(/^Predicted peptide sequence/)
|
94
|
+
|
95
|
+
# genes/exons
|
96
|
+
genes_region = report[i...j]
|
97
|
+
genes_region.each_line("\n") do |line|
|
98
|
+
if /Init|Intr|Term|PlyA|Prom|Sngl/ =~ line
|
99
|
+
gn, en = line.strip.split(" +")[0].split(/\./).map {|i| i.to_i }
|
100
|
+
add_exon(gn, en, line)
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
# sequences (peptide|CDS)
|
105
|
+
sequence_region = report[j...report.size]
|
106
|
+
sequence_region.gsub!(/^Predicted .+?:/, '')
|
107
|
+
sequence_region.gsub!(/^\s*$/, '')
|
108
|
+
sequence_region.split(Bio::FastaFormat::RS).each do |ff|
|
109
|
+
add_seq(Bio::FastaFormat.new(ff))
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
|
114
|
+
# Bio::Genscan::Report#parse_headline
|
115
|
+
def parse_headline(line)
|
116
|
+
tmp = line.chomp.split(/\t/)
|
117
|
+
@genscan_version = tmp[0].split(' ')[1]
|
118
|
+
@date_run = tmp[1].split(': ')[1]
|
119
|
+
@time = tmp[2].split(': ')[1]
|
120
|
+
end
|
121
|
+
private :parse_headline
|
122
|
+
|
123
|
+
|
124
|
+
# Bio::Genscan::Report#parse_sequence
|
125
|
+
def parse_sequence(line)
|
126
|
+
if /^Sequence (\S+) : (\d+) bp : (\d+[\.\d]+)% C\+G : Isochore (\d+.+?)$/ =~ line
|
127
|
+
@query_name = $1
|
128
|
+
@length = $2.to_i
|
129
|
+
@gccontent = $3.to_f
|
130
|
+
@isochore = $4
|
131
|
+
else
|
132
|
+
raise "Error: [#{line.inspect}]"
|
133
|
+
end
|
134
|
+
end
|
135
|
+
private :parse_sequence
|
136
|
+
|
137
|
+
|
138
|
+
# Bio::Genscan::Report#parse_parameter
|
139
|
+
def parse_parameter(line)
|
140
|
+
if /^Parameter matrix: (\w.+)$/ =~ line.chomp
|
141
|
+
@matrix = $1
|
142
|
+
else
|
143
|
+
raise "Error: [#{line}]"
|
144
|
+
end
|
145
|
+
end
|
146
|
+
private :parse_parameter
|
147
|
+
|
148
|
+
|
149
|
+
# Bio::Genscan::Report#add_gene
|
150
|
+
def add_gene(gn)
|
151
|
+
@predictions[gn - 1] = Gene.new(gn)
|
152
|
+
end
|
153
|
+
private :add_gene
|
154
|
+
|
155
|
+
|
156
|
+
# Bio::Genscan::Report#add_exon
|
157
|
+
def add_exon(gn, en, line)
|
158
|
+
exon = Exon.parser(line)
|
159
|
+
case line
|
160
|
+
when /Prom/
|
161
|
+
begin
|
162
|
+
@predictions[gn - 1].set_promoter(exon)
|
163
|
+
rescue NameError
|
164
|
+
add_gene(gn)
|
165
|
+
@predictions[gn - 1].set_promoter(exon)
|
166
|
+
end
|
167
|
+
when /PlyA/
|
168
|
+
@predictions[gn - 1].set_polyA(exon)
|
169
|
+
else
|
170
|
+
begin
|
171
|
+
@predictions[gn - 1].exons[en - 1] = exon
|
172
|
+
rescue NameError
|
173
|
+
add_gene(gn)
|
174
|
+
@predictions[gn - 1].exons[en - 1] = exon
|
175
|
+
end
|
176
|
+
end
|
177
|
+
end
|
178
|
+
private :add_exon
|
179
|
+
|
180
|
+
|
181
|
+
# Bio::Genscan::Report#add_seq
|
182
|
+
def add_seq(seq)
|
183
|
+
if /peptide_(\d+)/ =~ seq.definition
|
184
|
+
gn = $1.to_i
|
185
|
+
@predictions[gn - 1].set_aaseq(seq)
|
186
|
+
elsif /CDS_(\d+)/ =~ seq.definition
|
187
|
+
gn = $1.to_i
|
188
|
+
@predictions[gn - 1].set_naseq(seq)
|
189
|
+
end
|
190
|
+
end
|
191
|
+
private :add_seq
|
192
|
+
|
193
|
+
|
194
|
+
# = Container class of predicted gene structures.
|
195
|
+
class Gene
|
196
|
+
|
197
|
+
# Bio::Genescan::Report::Gene.new(gene_number)
|
198
|
+
def initialize(gn)
|
199
|
+
@number = gn.to_i
|
200
|
+
@aaseq = Bio::FastaFormat.new("")
|
201
|
+
@naseq = Bio::FastaFormat.new("")
|
202
|
+
@promoter = nil
|
203
|
+
@exons = []
|
204
|
+
@polyA = nil
|
205
|
+
end
|
206
|
+
|
207
|
+
# Returns "Gn", gene number field.
|
208
|
+
attr_reader :number
|
209
|
+
|
210
|
+
# Returns Bio::FastaFormat object.
|
211
|
+
attr_reader :aaseq
|
212
|
+
|
213
|
+
# Returns Bio::FastaFormat object.
|
214
|
+
attr_reader :naseq
|
215
|
+
|
216
|
+
# Returns Array of Bio::Genscan::Report::Exon.
|
217
|
+
attr_reader :exons
|
218
|
+
|
219
|
+
# Returns Bio::Genscan::Report::Exon object.
|
220
|
+
attr_reader :promoter
|
221
|
+
|
222
|
+
# Returns Bio::Genscan::Report::Exon object.
|
223
|
+
attr_reader :polyA
|
224
|
+
|
225
|
+
|
226
|
+
# Bio::Genescan::Report::Gene#seq_aaseq
|
227
|
+
def set_aaseq(seq)
|
228
|
+
@aaseq = seq
|
229
|
+
end
|
230
|
+
|
231
|
+
|
232
|
+
# Bio::Genescan::Report::Gene#seq_naseq
|
233
|
+
def set_naseq(seq)
|
234
|
+
@naseq = seq
|
235
|
+
end
|
236
|
+
|
237
|
+
|
238
|
+
# Bio::Genescan::Report::Gene#seq_promoter
|
239
|
+
def set_promoter(segment)
|
240
|
+
@promoter = segment
|
241
|
+
end
|
242
|
+
|
243
|
+
|
244
|
+
# Bio::Genescan::Report::Gene#seq_polyA
|
245
|
+
def set_polyA(segment)
|
246
|
+
@polyA = segment
|
247
|
+
end
|
248
|
+
|
249
|
+
end # class Gene
|
250
|
+
|
251
|
+
|
252
|
+
# = Container class of a predicted gene structure.
|
253
|
+
class Exon
|
254
|
+
|
255
|
+
#
|
256
|
+
TYPES = {
|
257
|
+
'Init' => 'Initial exon',
|
258
|
+
'Intr' => 'Internal exon',
|
259
|
+
'Term' => 'Terminal exon',
|
260
|
+
'Sngl' => 'Single-exon gene',
|
261
|
+
'Prom' => 'Promoter',
|
262
|
+
'PlyA' => 'poly-A signal'
|
263
|
+
}
|
264
|
+
|
265
|
+
|
266
|
+
# Bio::Genescan::Report::Exon.parser
|
267
|
+
def self.parser(line)
|
268
|
+
e = line.strip.split(/ +/)
|
269
|
+
case line
|
270
|
+
when /PlyA/, /Prom/
|
271
|
+
e[12] = e[6].clone
|
272
|
+
e[11] = 0
|
273
|
+
[6,7,8,9,10].each {|i| e[i] = nil }
|
274
|
+
end
|
275
|
+
self.new(e[0], e[1], e[2], e[3], e[4], e[5], e[6],
|
276
|
+
e[7], e[8], e[9], e[10], e[11], e[12])
|
277
|
+
end
|
278
|
+
|
279
|
+
|
280
|
+
# Returns
|
281
|
+
attr_reader :gene_number
|
282
|
+
|
283
|
+
# Returns "Ex", exon number field
|
284
|
+
attr_reader :number
|
285
|
+
|
286
|
+
# Returns "Type" field.
|
287
|
+
attr_reader :exon_type
|
288
|
+
|
289
|
+
# Returns "S" field.
|
290
|
+
attr_reader :strand
|
291
|
+
|
292
|
+
# Returns Returns first position of the region. "Begin" field.
|
293
|
+
attr_reader :first
|
294
|
+
|
295
|
+
# Returns Returns last position of the region. "End" field.
|
296
|
+
attr_reader :last
|
297
|
+
|
298
|
+
# Returns "Fr" field.
|
299
|
+
attr_reader :frame
|
300
|
+
|
301
|
+
# Returns "Ph" field.
|
302
|
+
attr_reader :phase
|
303
|
+
|
304
|
+
# Returns "CodRg" field.
|
305
|
+
attr_reader :score
|
306
|
+
|
307
|
+
# Returns "P" field.
|
308
|
+
attr_reader :p_value
|
309
|
+
|
310
|
+
# Returns "Tscr" field.
|
311
|
+
attr_reader :t_score
|
312
|
+
alias_method :coding_region_score, :score
|
313
|
+
|
314
|
+
|
315
|
+
# Bio::Genescan::Report::Exon.new(gene_number, exon_type, strand, first,
|
316
|
+
# end, length, frame, phase, acceptor_score, donor_score, score, p_value,
|
317
|
+
# t_score)
|
318
|
+
def initialize(gnex, t, s, b, e, len, fr, ph, iac, dot, cr, prob, ts)
|
319
|
+
@gene_number, @number = gnex.split(".").map {|n| n.to_i }
|
320
|
+
@exon_type = t
|
321
|
+
@strand = s
|
322
|
+
@first = b.to_i
|
323
|
+
@last = e.to_i
|
324
|
+
@length = len.to_i
|
325
|
+
@frame = fr
|
326
|
+
@phase = ph
|
327
|
+
@i_ac = iac.to_i
|
328
|
+
@do_t = dot.to_i
|
329
|
+
@score = cr.to_i
|
330
|
+
@p_value = prob.to_f
|
331
|
+
@t_score = ts.to_f
|
332
|
+
end
|
333
|
+
|
334
|
+
|
335
|
+
|
336
|
+
# Bio::Genescan::Report::Exon#exon_type_long
|
337
|
+
#
|
338
|
+
# Returns a human-readable "Type" of exon.
|
339
|
+
def exon_type_long
|
340
|
+
TYPES[exon_type]
|
341
|
+
end
|
342
|
+
|
343
|
+
|
344
|
+
# Bio::Genescan::Report::Exon#range
|
345
|
+
#
|
346
|
+
# Returns Range object of the region.
|
347
|
+
def range
|
348
|
+
Range.new(@first, @last)
|
349
|
+
end
|
350
|
+
|
351
|
+
|
352
|
+
# Bio::Genescan::Report::Exon#acceptor_score
|
353
|
+
#
|
354
|
+
# "I/Ac" field.
|
355
|
+
def acceptor_score
|
356
|
+
@i_ac
|
357
|
+
end
|
358
|
+
alias_method :initiation_score, :acceptor_score
|
359
|
+
|
360
|
+
|
361
|
+
# Bio::Genescan::Report::Exon#donor_score
|
362
|
+
#
|
363
|
+
# "Do/T" field.
|
364
|
+
def donor_score
|
365
|
+
@do_t
|
366
|
+
end
|
367
|
+
alias_method :termination_score, :donor_score
|
368
|
+
|
369
|
+
end # class Exon
|
370
|
+
|
371
|
+
end # class Report
|
372
|
+
|
373
|
+
end # class Genscan
|
374
|
+
|
375
|
+
end # module Bio
|
376
|
+
|
377
|
+
|
378
|
+
|
379
|
+
|
380
|
+
|
381
|
+
# testing code
|
382
|
+
|
383
|
+
if __FILE__ == $0
|
384
|
+
|
385
|
+
if $<.filename != '-'
|
386
|
+
report = $<.read
|
387
|
+
else
|
388
|
+
report = File.open(__FILE__, 'r').read.scan(/^>>>> (.+)$/).join("\n")
|
389
|
+
end
|
390
|
+
|
391
|
+
|
392
|
+
puts "= class Bio::Genscan::Report "
|
393
|
+
report = Bio::Genscan::Report.new(report)
|
394
|
+
|
395
|
+
|
396
|
+
print " report.genscan_version #=> "
|
397
|
+
p report.genscan_version
|
398
|
+
print " report.date_run #=> "
|
399
|
+
p report.date_run
|
400
|
+
print " report.time #=> "
|
401
|
+
p report.time
|
402
|
+
|
403
|
+
print " report.query_name #=> "
|
404
|
+
p report.query_name
|
405
|
+
print " report.length #=> "
|
406
|
+
p report.length
|
407
|
+
print " report.gccontent #=> "
|
408
|
+
p report.gccontent
|
409
|
+
print " report.isochore #=> "
|
410
|
+
p report.isochore
|
411
|
+
|
412
|
+
print " report.matrix #=> "
|
413
|
+
p report.matrix
|
414
|
+
|
415
|
+
puts " report.predictions (Array of Bio::Genscan::Report::Gene) "
|
416
|
+
print " report.predictions.size #=> "
|
417
|
+
p report.predictions.size
|
418
|
+
|
419
|
+
|
420
|
+
report.predictions.each {|gene|
|
421
|
+
puts "\n== class Bio::Genscan::Report::Gene "
|
422
|
+
print " gene.number #=> "
|
423
|
+
p gene.number
|
424
|
+
print " gene.aaseq (Bio::FastaFormat) #=> "
|
425
|
+
p gene.aaseq
|
426
|
+
print " gene.naseq (Bio::FastaFormat) #=> "
|
427
|
+
p gene.naseq
|
428
|
+
print " ene.promoter (Bio::Genscan::Report::Exon) #=> "
|
429
|
+
p gene.promoter
|
430
|
+
print " gene.polyA (Bio::Genscan::Report::Exon) #=> "
|
431
|
+
p gene.polyA
|
432
|
+
puts " gene.exons (Array of Bio::Genscan::Report::Exon) "
|
433
|
+
print " gene.exons.size #=> "
|
434
|
+
p gene.exons.size
|
435
|
+
|
436
|
+
|
437
|
+
gene.exons.each {|exon|
|
438
|
+
puts "\n== class Bio::Genscan::Report::Exon "
|
439
|
+
print " exon.number #=> "
|
440
|
+
p exon.number
|
441
|
+
print " exon.exon_type #=> "
|
442
|
+
p exon.exon_type
|
443
|
+
print " exon.exon_type_long #=> "
|
444
|
+
p exon.exon_type_long
|
445
|
+
print " exon.strand #=> "
|
446
|
+
p exon.strand
|
447
|
+
print " exon.first #=> "
|
448
|
+
p exon.first
|
449
|
+
print " exon.last #=> "
|
450
|
+
p exon.last
|
451
|
+
print " exon.range (Range) #=> "
|
452
|
+
p exon.range
|
453
|
+
print " exon.frame #=> "
|
454
|
+
p exon.frame
|
455
|
+
print " exon.phase #=> "
|
456
|
+
p exon.phase
|
457
|
+
print " exon.acceptor_score #=> "
|
458
|
+
p exon.acceptor_score
|
459
|
+
print " exon.donor_score #=> "
|
460
|
+
p exon.donor_score
|
461
|
+
print " exon.initiation_score #=> "
|
462
|
+
p exon.initiation_score
|
463
|
+
print " exon.termination_score #=> "
|
464
|
+
p exon.termination_score
|
465
|
+
print " exon.score #=> "
|
466
|
+
p exon.score
|
467
|
+
print " exon.p_value #=> "
|
468
|
+
p exon.p_value
|
469
|
+
print " exon.t_score #=> "
|
470
|
+
p exon.t_score
|
471
|
+
puts
|
472
|
+
}
|
473
|
+
puts
|
474
|
+
}
|
475
|
+
|
476
|
+
end
|
477
|
+
|
478
|
+
|
479
|
+
|
480
|
+
|
481
|
+
|
482
|
+
=begin
|
483
|
+
|
484
|
+
|
485
|
+
= Sample Genscan report with '^>>>> '.
|
486
|
+
|
487
|
+
|
488
|
+
>>>> GENSCAN 1.0 Date run: 30-May-103 Time: 14:06:28
|
489
|
+
>>>>
|
490
|
+
>>>> Sequence HUMRASH : 12942 bp : 68.17% C+G : Isochore 4 (57 - 100 C+G%)
|
491
|
+
>>>>
|
492
|
+
>>>> Parameter matrix: HumanIso.smat
|
493
|
+
>>>>
|
494
|
+
>>>> Predicted genes/exons:
|
495
|
+
>>>>
|
496
|
+
>>>> Gn.Ex Type S .Begin ...End .Len Fr Ph I/Ac Do/T CodRg P.... Tscr..
|
497
|
+
>>>> ----- ---- - ------ ------ ---- -- -- ---- ---- ----- ----- ------
|
498
|
+
>>>>
|
499
|
+
>>>> 1.01 Init + 1664 1774 111 1 0 94 83 212 0.997 21.33
|
500
|
+
>>>> 1.02 Intr + 2042 2220 179 1 2 104 66 408 0.997 40.12
|
501
|
+
>>>> 1.03 Intr + 2374 2533 160 1 1 89 94 302 0.999 32.08
|
502
|
+
>>>> 1.04 Term + 3231 3350 120 2 0 115 48 202 0.980 18.31
|
503
|
+
>>>> 1.05 PlyA + 3722 3727 6 -5.80
|
504
|
+
>>>>
|
505
|
+
>>>> 2.00 Prom + 6469 6508 40 -7.92
|
506
|
+
>>>> 2.01 Init + 8153 8263 111 1 0 94 83 212 0.998 21.33
|
507
|
+
>>>> 2.02 Intr + 8531 8709 179 1 2 104 66 408 0.997 40.12
|
508
|
+
>>>> 2.03 Intr + 8863 9022 160 1 1 89 94 302 0.999 32.08
|
509
|
+
>>>> 2.04 Term + 9720 9839 120 2 0 115 48 202 0.961 18.31
|
510
|
+
>>>>
|
511
|
+
>>>> Predicted peptide sequence(s):
|
512
|
+
>>>>
|
513
|
+
>>>> Predicted coding sequence(s):
|
514
|
+
>>>>
|
515
|
+
>>>>
|
516
|
+
>>>> >HUMRASH|GENSCAN_predicted_peptide_1|189_aa
|
517
|
+
>>>> MTEYKLVVVGAGGVGKSALTIQLIQNHFVDEYDPTIEDSYRKQVVIDGETCLLDILDTAG
|
518
|
+
>>>> QEEYSAMRDQYMRTGEGFLCVFAINNTKSFEDIHQYREQIKRVKDSDDVPMVLVGNKCDL
|
519
|
+
>>>> AARTVESRQAQDLARSYGIPYIETSAKTRQGVEDAFYTLVREIRQHKLRKLNPPDESGPG
|
520
|
+
>>>> CMSCKCVLS
|
521
|
+
>>>>
|
522
|
+
>>>> >HUMRASH|GENSCAN_predicted_CDS_1|570_bp
|
523
|
+
>>>> atgacggaatataagctggtggtggtgggcgccggcggtgtgggcaagagtgcgctgacc
|
524
|
+
>>>> atccagctgatccagaaccattttgtggacgaatacgaccccactatagaggattcctac
|
525
|
+
>>>> cggaagcaggtggtcattgatggggagacgtgcctgttggacatcctggataccgccggc
|
526
|
+
>>>> caggaggagtacagcgccatgcgggaccagtacatgcgcaccggggagggcttcctgtgt
|
527
|
+
>>>> gtgtttgccatcaacaacaccaagtcttttgaggacatccaccagtacagggagcagatc
|
528
|
+
>>>> aaacgggtgaaggactcggatgacgtgcccatggtgctggtggggaacaagtgtgacctg
|
529
|
+
>>>> gctgcacgcactgtggaatctcggcaggctcaggacctcgcccgaagctacggcatcccc
|
530
|
+
>>>> tacatcgagacctcggccaagacccggcagggagtggaggatgccttctacacgttggtg
|
531
|
+
>>>> cgtgagatccggcagcacaagctgcggaagctgaaccctcctgatgagagtggccccggc
|
532
|
+
>>>> tgcatgagctgcaagtgtgtgctctcctga
|
533
|
+
>>>>
|
534
|
+
>>>> >HUMRASH|GENSCAN_predicted_peptide_2|189_aa
|
535
|
+
>>>> MTEYKLVVVGAGGVGKSALTIQLIQNHFVDEYDPTIEDSYRKQVVIDGETCLLDILDTAG
|
536
|
+
>>>> QEEYSAMRDQYMRTGEGFLCVFAINNTKSFEDIHQYREQIKRVKDSDDVPMVLVGNKCDL
|
537
|
+
>>>> AARTVESRQAQDLARSYGIPYIETSAKTRQGVEDAFYTLVREIRQHKLRKLNPPDESGPG
|
538
|
+
>>>> CMSCKCVLS
|
539
|
+
>>>>
|
540
|
+
>>>> >HUMRASH|GENSCAN_predicted_CDS_2|570_bp
|
541
|
+
>>>> atgacggaatataagctggtggtggtgggcgccggcggtgtgggcaagagtgcgctgacc
|
542
|
+
>>>> atccagctgatccagaaccattttgtggacgaatacgaccccactatagaggattcctac
|
543
|
+
>>>> cggaagcaggtggtcattgatggggagacgtgcctgttggacatcctggataccgccggc
|
544
|
+
>>>> caggaggagtacagcgccatgcgggaccagtacatgcgcaccggggagggcttcctgtgt
|
545
|
+
>>>> gtgtttgccatcaacaacaccaagtcttttgaggacatccaccagtacagggagcagatc
|
546
|
+
>>>> aaacgggtgaaggactcggatgacgtgcccatggtgctggtggggaacaagtgtgacctg
|
547
|
+
>>>> gctgcacgcactgtggaatctcggcaggctcaggacctcgcccgaagctacggcatcccc
|
548
|
+
>>>> tacatcgagacctcggccaagacccggcagggagtggaggatgccttctacacgttggtg
|
549
|
+
>>>> cgtgagatccggcagcacaagctgcggaagctgaaccctcctgatgagagtggccccggc
|
550
|
+
>>>> tgcatgagctgcaagtgtgtgctctcctga
|
551
|
+
|
552
|
+
=end
|