wwood-bioruby 1.2.11
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +205 -0
- data/README_DEV.rdoc +285 -0
- data/VERSION.yml +4 -0
- data/bin/bioruby +44 -0
- data/bin/br_biofetch.rb +47 -0
- data/bin/br_bioflat.rb +293 -0
- data/bin/br_biogetseq.rb +45 -0
- data/bin/br_pmfetch.rb +421 -0
- data/lib/bio.rb +306 -0
- data/lib/bio/alignment.rb +2518 -0
- data/lib/bio/appl/bl2seq/report.rb +334 -0
- data/lib/bio/appl/blast.rb +505 -0
- data/lib/bio/appl/blast/ddbj.rb +142 -0
- data/lib/bio/appl/blast/format0.rb +1438 -0
- data/lib/bio/appl/blast/format8.rb +83 -0
- data/lib/bio/appl/blast/genomenet.rb +263 -0
- data/lib/bio/appl/blast/ncbioptions.rb +220 -0
- data/lib/bio/appl/blast/remote.rb +105 -0
- data/lib/bio/appl/blast/report.rb +767 -0
- data/lib/bio/appl/blast/rexml.rb +144 -0
- data/lib/bio/appl/blast/rpsblast.rb +277 -0
- data/lib/bio/appl/blast/wublast.rb +635 -0
- data/lib/bio/appl/blast/xmlparser.rb +236 -0
- data/lib/bio/appl/blat/report.rb +530 -0
- data/lib/bio/appl/clustalw.rb +219 -0
- data/lib/bio/appl/clustalw/report.rb +152 -0
- data/lib/bio/appl/emboss.rb +203 -0
- data/lib/bio/appl/fasta.rb +235 -0
- data/lib/bio/appl/fasta/format10.rb +325 -0
- data/lib/bio/appl/gcg/msf.rb +212 -0
- data/lib/bio/appl/gcg/seq.rb +195 -0
- data/lib/bio/appl/genscan/report.rb +552 -0
- data/lib/bio/appl/hmmer.rb +126 -0
- data/lib/bio/appl/hmmer/report.rb +683 -0
- data/lib/bio/appl/iprscan/report.rb +374 -0
- data/lib/bio/appl/mafft.rb +259 -0
- data/lib/bio/appl/mafft/report.rb +226 -0
- data/lib/bio/appl/muscle.rb +52 -0
- data/lib/bio/appl/paml/baseml.rb +95 -0
- data/lib/bio/appl/paml/baseml/report.rb +32 -0
- data/lib/bio/appl/paml/codeml.rb +242 -0
- data/lib/bio/appl/paml/codeml/rates.rb +67 -0
- data/lib/bio/appl/paml/codeml/report.rb +67 -0
- data/lib/bio/appl/paml/common.rb +348 -0
- data/lib/bio/appl/paml/common_report.rb +38 -0
- data/lib/bio/appl/paml/yn00.rb +103 -0
- data/lib/bio/appl/paml/yn00/report.rb +32 -0
- data/lib/bio/appl/phylip/alignment.rb +133 -0
- data/lib/bio/appl/phylip/distance_matrix.rb +96 -0
- data/lib/bio/appl/probcons.rb +41 -0
- data/lib/bio/appl/psort.rb +548 -0
- data/lib/bio/appl/psort/report.rb +542 -0
- data/lib/bio/appl/pts1.rb +263 -0
- data/lib/bio/appl/sim4.rb +124 -0
- data/lib/bio/appl/sim4/report.rb +485 -0
- data/lib/bio/appl/sosui/report.rb +151 -0
- data/lib/bio/appl/spidey/report.rb +593 -0
- data/lib/bio/appl/targetp/report.rb +267 -0
- data/lib/bio/appl/tcoffee.rb +55 -0
- data/lib/bio/appl/tmhmm/report.rb +231 -0
- data/lib/bio/command.rb +593 -0
- data/lib/bio/compat/features.rb +157 -0
- data/lib/bio/compat/references.rb +128 -0
- data/lib/bio/data/aa.rb +353 -0
- data/lib/bio/data/codontable.rb +722 -0
- data/lib/bio/data/na.rb +223 -0
- data/lib/bio/db.rb +329 -0
- data/lib/bio/db/aaindex.rb +357 -0
- data/lib/bio/db/biosql/biosql_to_biosequence.rb +67 -0
- data/lib/bio/db/biosql/sequence.rb +508 -0
- data/lib/bio/db/embl/common.rb +352 -0
- data/lib/bio/db/embl/embl.rb +500 -0
- data/lib/bio/db/embl/embl_to_biosequence.rb +85 -0
- data/lib/bio/db/embl/format_embl.rb +190 -0
- data/lib/bio/db/embl/sptr.rb +1283 -0
- data/lib/bio/db/embl/swissprot.rb +42 -0
- data/lib/bio/db/embl/trembl.rb +41 -0
- data/lib/bio/db/embl/uniprot.rb +42 -0
- data/lib/bio/db/fantom.rb +597 -0
- data/lib/bio/db/fasta.rb +410 -0
- data/lib/bio/db/fasta/defline.rb +532 -0
- data/lib/bio/db/fasta/fasta_to_biosequence.rb +63 -0
- data/lib/bio/db/fasta/format_fasta.rb +97 -0
- data/lib/bio/db/genbank/common.rb +307 -0
- data/lib/bio/db/genbank/ddbj.rb +22 -0
- data/lib/bio/db/genbank/format_genbank.rb +187 -0
- data/lib/bio/db/genbank/genbank.rb +250 -0
- data/lib/bio/db/genbank/genbank_to_biosequence.rb +86 -0
- data/lib/bio/db/genbank/genpept.rb +60 -0
- data/lib/bio/db/genbank/refseq.rb +18 -0
- data/lib/bio/db/gff.rb +1846 -0
- data/lib/bio/db/go.rb +481 -0
- data/lib/bio/db/kegg/brite.rb +41 -0
- data/lib/bio/db/kegg/compound.rb +131 -0
- data/lib/bio/db/kegg/drug.rb +98 -0
- data/lib/bio/db/kegg/enzyme.rb +148 -0
- data/lib/bio/db/kegg/expression.rb +155 -0
- data/lib/bio/db/kegg/genes.rb +263 -0
- data/lib/bio/db/kegg/genome.rb +241 -0
- data/lib/bio/db/kegg/glycan.rb +166 -0
- data/lib/bio/db/kegg/keggtab.rb +357 -0
- data/lib/bio/db/kegg/kgml.rb +256 -0
- data/lib/bio/db/kegg/orthology.rb +136 -0
- data/lib/bio/db/kegg/reaction.rb +82 -0
- data/lib/bio/db/kegg/taxonomy.rb +331 -0
- data/lib/bio/db/lasergene.rb +209 -0
- data/lib/bio/db/litdb.rb +107 -0
- data/lib/bio/db/medline.rb +326 -0
- data/lib/bio/db/nbrf.rb +191 -0
- data/lib/bio/db/newick.rb +658 -0
- data/lib/bio/db/nexus.rb +1854 -0
- data/lib/bio/db/pdb.rb +29 -0
- data/lib/bio/db/pdb/atom.rb +77 -0
- data/lib/bio/db/pdb/chain.rb +210 -0
- data/lib/bio/db/pdb/chemicalcomponent.rb +224 -0
- data/lib/bio/db/pdb/model.rb +148 -0
- data/lib/bio/db/pdb/pdb.rb +1911 -0
- data/lib/bio/db/pdb/residue.rb +176 -0
- data/lib/bio/db/pdb/utils.rb +399 -0
- data/lib/bio/db/prosite.rb +597 -0
- data/lib/bio/db/rebase.rb +456 -0
- data/lib/bio/db/soft.rb +404 -0
- data/lib/bio/db/transfac.rb +375 -0
- data/lib/bio/db/url.rb +42 -0
- data/lib/bio/feature.rb +139 -0
- data/lib/bio/io/biosql/biodatabase.rb +64 -0
- data/lib/bio/io/biosql/bioentry.rb +29 -0
- data/lib/bio/io/biosql/bioentry_dbxref.rb +11 -0
- data/lib/bio/io/biosql/bioentry_path.rb +12 -0
- data/lib/bio/io/biosql/bioentry_qualifier_value.rb +10 -0
- data/lib/bio/io/biosql/bioentry_reference.rb +10 -0
- data/lib/bio/io/biosql/bioentry_relationship.rb +10 -0
- data/lib/bio/io/biosql/biosequence.rb +11 -0
- data/lib/bio/io/biosql/comment.rb +7 -0
- data/lib/bio/io/biosql/config/database.yml +20 -0
- data/lib/bio/io/biosql/dbxref.rb +13 -0
- data/lib/bio/io/biosql/dbxref_qualifier_value.rb +12 -0
- data/lib/bio/io/biosql/location.rb +32 -0
- data/lib/bio/io/biosql/location_qualifier_value.rb +11 -0
- data/lib/bio/io/biosql/ontology.rb +10 -0
- data/lib/bio/io/biosql/reference.rb +9 -0
- data/lib/bio/io/biosql/seqfeature.rb +32 -0
- data/lib/bio/io/biosql/seqfeature_dbxref.rb +11 -0
- data/lib/bio/io/biosql/seqfeature_path.rb +11 -0
- data/lib/bio/io/biosql/seqfeature_qualifier_value.rb +20 -0
- data/lib/bio/io/biosql/seqfeature_relationship.rb +11 -0
- data/lib/bio/io/biosql/taxon.rb +12 -0
- data/lib/bio/io/biosql/taxon_name.rb +9 -0
- data/lib/bio/io/biosql/term.rb +27 -0
- data/lib/bio/io/biosql/term_dbxref.rb +11 -0
- data/lib/bio/io/biosql/term_path.rb +12 -0
- data/lib/bio/io/biosql/term_relationship.rb +13 -0
- data/lib/bio/io/biosql/term_relationship_term.rb +11 -0
- data/lib/bio/io/biosql/term_synonym.rb +10 -0
- data/lib/bio/io/das.rb +461 -0
- data/lib/bio/io/dbget.rb +194 -0
- data/lib/bio/io/ddbjxml.rb +638 -0
- data/lib/bio/io/ebisoap.rb +158 -0
- data/lib/bio/io/ensembl.rb +229 -0
- data/lib/bio/io/fastacmd.rb +163 -0
- data/lib/bio/io/fetch.rb +195 -0
- data/lib/bio/io/flatfile.rb +482 -0
- data/lib/bio/io/flatfile/autodetection.rb +545 -0
- data/lib/bio/io/flatfile/bdb.rb +253 -0
- data/lib/bio/io/flatfile/buffer.rb +237 -0
- data/lib/bio/io/flatfile/index.rb +1381 -0
- data/lib/bio/io/flatfile/indexer.rb +805 -0
- data/lib/bio/io/flatfile/splitter.rb +297 -0
- data/lib/bio/io/higet.rb +73 -0
- data/lib/bio/io/hinv.rb +442 -0
- data/lib/bio/io/keggapi.rb +805 -0
- data/lib/bio/io/ncbirest.rb +733 -0
- data/lib/bio/io/ncbisoap.rb +155 -0
- data/lib/bio/io/pubmed.rb +307 -0
- data/lib/bio/io/registry.rb +292 -0
- data/lib/bio/io/soapwsdl.rb +119 -0
- data/lib/bio/io/sql.rb +186 -0
- data/lib/bio/location.rb +867 -0
- data/lib/bio/map.rb +410 -0
- data/lib/bio/pathway.rb +960 -0
- data/lib/bio/reference.rb +602 -0
- data/lib/bio/sequence.rb +456 -0
- data/lib/bio/sequence/aa.rb +152 -0
- data/lib/bio/sequence/adapter.rb +108 -0
- data/lib/bio/sequence/common.rb +310 -0
- data/lib/bio/sequence/compat.rb +123 -0
- data/lib/bio/sequence/dblink.rb +54 -0
- data/lib/bio/sequence/format.rb +358 -0
- data/lib/bio/sequence/format_raw.rb +23 -0
- data/lib/bio/sequence/generic.rb +24 -0
- data/lib/bio/sequence/na.rb +491 -0
- data/lib/bio/shell.rb +44 -0
- data/lib/bio/shell/core.rb +578 -0
- data/lib/bio/shell/demo.rb +146 -0
- data/lib/bio/shell/interface.rb +218 -0
- data/lib/bio/shell/irb.rb +95 -0
- data/lib/bio/shell/object.rb +71 -0
- data/lib/bio/shell/plugin/blast.rb +42 -0
- data/lib/bio/shell/plugin/codon.rb +218 -0
- data/lib/bio/shell/plugin/das.rb +58 -0
- data/lib/bio/shell/plugin/emboss.rb +23 -0
- data/lib/bio/shell/plugin/entry.rb +105 -0
- data/lib/bio/shell/plugin/flatfile.rb +101 -0
- data/lib/bio/shell/plugin/keggapi.rb +181 -0
- data/lib/bio/shell/plugin/midi.rb +430 -0
- data/lib/bio/shell/plugin/obda.rb +45 -0
- data/lib/bio/shell/plugin/psort.rb +56 -0
- data/lib/bio/shell/plugin/seq.rb +247 -0
- data/lib/bio/shell/plugin/soap.rb +87 -0
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/bioruby_generator.rb +29 -0
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/_classes.rhtml +4 -0
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/_log.rhtml +27 -0
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/_methods.rhtml +11 -0
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/_modules.rhtml +4 -0
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/_variables.rhtml +7 -0
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/bioruby-bg.gif +0 -0
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/bioruby-gem.png +0 -0
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/bioruby-link.gif +0 -0
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/bioruby.css +368 -0
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/bioruby.rhtml +47 -0
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/bioruby_controller.rb +144 -0
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/bioruby_helper.rb +47 -0
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/commands.rhtml +8 -0
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/history.rhtml +10 -0
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/index.rhtml +26 -0
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/spinner.gif +0 -0
- data/lib/bio/shell/script.rb +25 -0
- data/lib/bio/shell/setup.rb +109 -0
- data/lib/bio/shell/web.rb +102 -0
- data/lib/bio/tree.rb +852 -0
- data/lib/bio/util/color_scheme.rb +191 -0
- data/lib/bio/util/color_scheme/buried.rb +59 -0
- data/lib/bio/util/color_scheme/helix.rb +59 -0
- data/lib/bio/util/color_scheme/hydropathy.rb +64 -0
- data/lib/bio/util/color_scheme/nucleotide.rb +31 -0
- data/lib/bio/util/color_scheme/strand.rb +59 -0
- data/lib/bio/util/color_scheme/taylor.rb +50 -0
- data/lib/bio/util/color_scheme/turn.rb +59 -0
- data/lib/bio/util/color_scheme/zappo.rb +50 -0
- data/lib/bio/util/contingency_table.rb +370 -0
- data/lib/bio/util/restriction_enzyme.rb +228 -0
- data/lib/bio/util/restriction_enzyme/analysis.rb +249 -0
- data/lib/bio/util/restriction_enzyme/analysis_basic.rb +217 -0
- data/lib/bio/util/restriction_enzyme/cut_symbol.rb +107 -0
- data/lib/bio/util/restriction_enzyme/double_stranded.rb +321 -0
- data/lib/bio/util/restriction_enzyme/double_stranded/aligned_strands.rb +130 -0
- data/lib/bio/util/restriction_enzyme/double_stranded/cut_location_pair.rb +103 -0
- data/lib/bio/util/restriction_enzyme/double_stranded/cut_location_pair_in_enzyme_notation.rb +38 -0
- data/lib/bio/util/restriction_enzyme/double_stranded/cut_locations.rb +76 -0
- data/lib/bio/util/restriction_enzyme/double_stranded/cut_locations_in_enzyme_notation.rb +107 -0
- data/lib/bio/util/restriction_enzyme/enzymes.yaml +7061 -0
- data/lib/bio/util/restriction_enzyme/range/cut_range.rb +24 -0
- data/lib/bio/util/restriction_enzyme/range/cut_ranges.rb +47 -0
- data/lib/bio/util/restriction_enzyme/range/horizontal_cut_range.rb +67 -0
- data/lib/bio/util/restriction_enzyme/range/sequence_range.rb +257 -0
- data/lib/bio/util/restriction_enzyme/range/sequence_range/calculated_cuts.rb +242 -0
- data/lib/bio/util/restriction_enzyme/range/sequence_range/fragment.rb +51 -0
- data/lib/bio/util/restriction_enzyme/range/sequence_range/fragments.rb +41 -0
- data/lib/bio/util/restriction_enzyme/range/vertical_cut_range.rb +77 -0
- data/lib/bio/util/restriction_enzyme/single_strand.rb +200 -0
- data/lib/bio/util/restriction_enzyme/single_strand/cut_locations_in_enzyme_notation.rb +135 -0
- data/lib/bio/util/restriction_enzyme/single_strand_complement.rb +23 -0
- data/lib/bio/util/restriction_enzyme/string_formatting.rb +111 -0
- data/lib/bio/util/sirna.rb +288 -0
- data/test/data/HMMER/hmmpfam.out +64 -0
- data/test/data/HMMER/hmmsearch.out +88 -0
- data/test/data/SOSUI/sample.report +11 -0
- data/test/data/TMHMM/sample.report +21 -0
- data/test/data/aaindex/DAYM780301 +30 -0
- data/test/data/aaindex/PRAM900102 +20 -0
- data/test/data/bl2seq/cd8a_cd8b_blastp.bl2seq +53 -0
- data/test/data/bl2seq/cd8a_p53_e-5blastp.bl2seq +37 -0
- data/test/data/blast/2.2.15.blastp.m7 +876 -0
- data/test/data/blast/b0002.faa +15 -0
- data/test/data/blast/b0002.faa.m0 +128 -0
- data/test/data/blast/b0002.faa.m7 +65 -0
- data/test/data/blast/b0002.faa.m8 +1 -0
- data/test/data/blast/blastp-multi.m7 +188 -0
- data/test/data/command/echoarg2.bat +1 -0
- data/test/data/embl/AB090716.embl +65 -0
- data/test/data/embl/AB090716.embl.rel89 +63 -0
- data/test/data/fasta/example1.txt +75 -0
- data/test/data/fasta/example2.txt +21 -0
- data/test/data/genscan/sample.report +63 -0
- data/test/data/iprscan/merged.raw +32 -0
- data/test/data/iprscan/merged.txt +74 -0
- data/test/data/paml/codeml/control_file.txt +30 -0
- data/test/data/paml/codeml/output.txt +78 -0
- data/test/data/paml/codeml/rates +217 -0
- data/test/data/prosite/prosite.dat +2233 -0
- data/test/data/refseq/nm_126355.entret +64 -0
- data/test/data/rpsblast/misc.rpsblast +193 -0
- data/test/data/soft/GDS100_partial.soft +92 -0
- data/test/data/soft/GSE3457_family_partial.soft +874 -0
- data/test/data/uniprot/p53_human.uniprot +1456 -0
- data/test/functional/bio/appl/test_pts1.rb +115 -0
- data/test/functional/bio/io/test_ensembl.rb +229 -0
- data/test/functional/bio/io/test_soapwsdl.rb +52 -0
- data/test/functional/bio/sequence/test_output_embl.rb +51 -0
- data/test/functional/bio/test_command.rb +301 -0
- data/test/runner.rb +14 -0
- data/test/unit/bio/appl/bl2seq/test_report.rb +134 -0
- data/test/unit/bio/appl/blast/test_ncbioptions.rb +112 -0
- data/test/unit/bio/appl/blast/test_report.rb +1135 -0
- data/test/unit/bio/appl/blast/test_rpsblast.rb +398 -0
- data/test/unit/bio/appl/genscan/test_report.rb +182 -0
- data/test/unit/bio/appl/hmmer/test_report.rb +342 -0
- data/test/unit/bio/appl/iprscan/test_report.rb +338 -0
- data/test/unit/bio/appl/mafft/test_report.rb +63 -0
- data/test/unit/bio/appl/paml/codeml/test_rates.rb +45 -0
- data/test/unit/bio/appl/paml/codeml/test_report.rb +45 -0
- data/test/unit/bio/appl/paml/test_codeml.rb +174 -0
- data/test/unit/bio/appl/sosui/test_report.rb +81 -0
- data/test/unit/bio/appl/targetp/test_report.rb +146 -0
- data/test/unit/bio/appl/test_blast.rb +277 -0
- data/test/unit/bio/appl/test_fasta.rb +130 -0
- data/test/unit/bio/appl/test_psort.rb +57 -0
- data/test/unit/bio/appl/test_pts1.rb +77 -0
- data/test/unit/bio/appl/tmhmm/test_report.rb +126 -0
- data/test/unit/bio/data/test_aa.rb +90 -0
- data/test/unit/bio/data/test_codontable.rb +107 -0
- data/test/unit/bio/data/test_na.rb +80 -0
- data/test/unit/bio/db/embl/test_common.rb +117 -0
- data/test/unit/bio/db/embl/test_embl.rb +214 -0
- data/test/unit/bio/db/embl/test_embl_rel89.rb +219 -0
- data/test/unit/bio/db/embl/test_embl_to_bioseq.rb +203 -0
- data/test/unit/bio/db/embl/test_sptr.rb +1812 -0
- data/test/unit/bio/db/embl/test_uniprot.rb +31 -0
- data/test/unit/bio/db/kegg/test_genes.rb +45 -0
- data/test/unit/bio/db/pdb/test_pdb.rb +152 -0
- data/test/unit/bio/db/test_aaindex.rb +197 -0
- data/test/unit/bio/db/test_fasta.rb +250 -0
- data/test/unit/bio/db/test_gff.rb +1190 -0
- data/test/unit/bio/db/test_lasergene.rb +95 -0
- data/test/unit/bio/db/test_medline.rb +127 -0
- data/test/unit/bio/db/test_newick.rb +293 -0
- data/test/unit/bio/db/test_nexus.rb +364 -0
- data/test/unit/bio/db/test_prosite.rb +1437 -0
- data/test/unit/bio/db/test_rebase.rb +101 -0
- data/test/unit/bio/db/test_soft.rb +138 -0
- data/test/unit/bio/db/test_url.rb +36 -0
- data/test/unit/bio/io/flatfile/test_autodetection.rb +375 -0
- data/test/unit/bio/io/flatfile/test_buffer.rb +251 -0
- data/test/unit/bio/io/flatfile/test_splitter.rb +369 -0
- data/test/unit/bio/io/test_ddbjxml.rb +80 -0
- data/test/unit/bio/io/test_ensembl.rb +109 -0
- data/test/unit/bio/io/test_fastacmd.rb +42 -0
- data/test/unit/bio/io/test_flatfile.rb +505 -0
- data/test/unit/bio/io/test_soapwsdl.rb +32 -0
- data/test/unit/bio/sequence/test_aa.rb +115 -0
- data/test/unit/bio/sequence/test_common.rb +373 -0
- data/test/unit/bio/sequence/test_compat.rb +69 -0
- data/test/unit/bio/sequence/test_dblink.rb +58 -0
- data/test/unit/bio/sequence/test_na.rb +330 -0
- data/test/unit/bio/shell/plugin/test_seq.rb +185 -0
- data/test/unit/bio/test_alignment.rb +1025 -0
- data/test/unit/bio/test_command.rb +349 -0
- data/test/unit/bio/test_db.rb +96 -0
- data/test/unit/bio/test_feature.rb +144 -0
- data/test/unit/bio/test_location.rb +599 -0
- data/test/unit/bio/test_map.rb +230 -0
- data/test/unit/bio/test_pathway.rb +499 -0
- data/test/unit/bio/test_reference.rb +252 -0
- data/test/unit/bio/test_sequence.rb +329 -0
- data/test/unit/bio/test_shell.rb +18 -0
- data/test/unit/bio/test_tree.rb +593 -0
- data/test/unit/bio/util/restriction_enzyme/analysis/test_calculated_cuts.rb +299 -0
- data/test/unit/bio/util/restriction_enzyme/analysis/test_cut_ranges.rb +103 -0
- data/test/unit/bio/util/restriction_enzyme/analysis/test_sequence_range.rb +240 -0
- data/test/unit/bio/util/restriction_enzyme/double_stranded/test_aligned_strands.rb +101 -0
- data/test/unit/bio/util/restriction_enzyme/double_stranded/test_cut_location_pair.rb +75 -0
- data/test/unit/bio/util/restriction_enzyme/double_stranded/test_cut_location_pair_in_enzyme_notation.rb +73 -0
- data/test/unit/bio/util/restriction_enzyme/double_stranded/test_cut_locations.rb +53 -0
- data/test/unit/bio/util/restriction_enzyme/double_stranded/test_cut_locations_in_enzyme_notation.rb +104 -0
- data/test/unit/bio/util/restriction_enzyme/single_strand/test_cut_locations_in_enzyme_notation.rb +83 -0
- data/test/unit/bio/util/restriction_enzyme/test_analysis.rb +246 -0
- data/test/unit/bio/util/restriction_enzyme/test_cut_symbol.rb +44 -0
- data/test/unit/bio/util/restriction_enzyme/test_double_stranded.rb +115 -0
- data/test/unit/bio/util/restriction_enzyme/test_single_strand.rb +147 -0
- data/test/unit/bio/util/restriction_enzyme/test_single_strand_complement.rb +147 -0
- data/test/unit/bio/util/restriction_enzyme/test_string_formatting.rb +60 -0
- data/test/unit/bio/util/test_color_scheme.rb +33 -0
- data/test/unit/bio/util/test_contingency_table.rb +94 -0
- data/test/unit/bio/util/test_restriction_enzyme.rb +42 -0
- data/test/unit/bio/util/test_sirna.rb +245 -0
- metadata +543 -0
data/lib/bio/db/soft.rb
ADDED
@@ -0,0 +1,404 @@
|
|
1
|
+
#
|
2
|
+
# bio/db/soft.rb - Interface for SOFT formatted files
|
3
|
+
#
|
4
|
+
# Author:: Trevor Wennblom <mailto:trevor@corevx.com>
|
5
|
+
# Copyright:: Copyright (c) 2007 Midwinter Laboratories, LLC (http://midwinterlabs.com)
|
6
|
+
# License:: The Ruby License
|
7
|
+
#
|
8
|
+
# $Id: soft.rb,v 1.2 2007/04/05 23:35:40 trevor Exp $
|
9
|
+
#
|
10
|
+
|
11
|
+
module Bio #:nodoc:
|
12
|
+
|
13
|
+
#
|
14
|
+
# bio/db/soft.rb - Interface for SOFT formatted files
|
15
|
+
#
|
16
|
+
# Author:: Trevor Wennblom <mailto:trevor@corevx.com>
|
17
|
+
# Copyright:: Copyright (c) 2007 Midwinter Laboratories, LLC (http://midwinterlabs.com)
|
18
|
+
# License:: The Ruby License
|
19
|
+
#
|
20
|
+
#
|
21
|
+
# = Description
|
22
|
+
#
|
23
|
+
# "SOFT (Simple Omnibus in Text Format) is a compact, simple, line-based,
|
24
|
+
# ASCII text format that incorporates experimental data and metadata."
|
25
|
+
# -- <em>GEO, National Center for Biotechnology Information</em>
|
26
|
+
#
|
27
|
+
# The Bio::SOFT module reads SOFT Series or Platform formatted files that
|
28
|
+
# contain information
|
29
|
+
# describing one database, one series, one platform, and many samples (GEO
|
30
|
+
# accessions). The data from the file can then be viewed with Ruby methods.
|
31
|
+
#
|
32
|
+
# Bio::SOFT also supports the reading of SOFT DataSet files which contain
|
33
|
+
# one database, one dataset, and many subsets.
|
34
|
+
#
|
35
|
+
# Format specification is located here:
|
36
|
+
# * http://www.ncbi.nlm.nih.gov/projects/geo/info/soft2.html#SOFTformat
|
37
|
+
#
|
38
|
+
# SOFT data files may be directly downloaded here:
|
39
|
+
# * ftp://ftp.ncbi.nih.gov/pub/geo/DATA/SOFT
|
40
|
+
#
|
41
|
+
# NCBI's Gene Expression Omnibus (GEO) is here:
|
42
|
+
# * http://www.ncbi.nlm.nih.gov/geo
|
43
|
+
#
|
44
|
+
# = Usage
|
45
|
+
#
|
46
|
+
# If an attribute has more than one value then the values are stored in an
|
47
|
+
# Array of String objects. Otherwise the attribute is stored as a String.
|
48
|
+
#
|
49
|
+
# The platform and each sample may contain a table of data. A dataset from a
|
50
|
+
# DataSet file may also contain a table.
|
51
|
+
#
|
52
|
+
# Attributes are dynamically created based on the data in the file.
|
53
|
+
# Predefined keys have not been created in advance due to the variability of
|
54
|
+
# SOFT files in-the-wild.
|
55
|
+
#
|
56
|
+
# Keys are generally stored as Symbols. In the case of keys for samples and
|
57
|
+
# table headings may alternatively be accessed with Strings.
|
58
|
+
# The names of samples (geo accessions) are case sensitive. Table headers
|
59
|
+
# are case insensitive.
|
60
|
+
#
|
61
|
+
# require 'bio'
|
62
|
+
#
|
63
|
+
# lines = IO.readlines('GSE3457_family.soft')
|
64
|
+
# soft = Bio::SOFT.new(lines)
|
65
|
+
#
|
66
|
+
# soft.platform[:geo_accession] # => "GPL2092"
|
67
|
+
# soft.platform[:organism] # => "Populus"
|
68
|
+
# soft.platform[:contributor] # => ["Jingyi,,Li", "Olga,,Shevchenko", "Steve,H,Strauss", "Amy,M,Brunner"]
|
69
|
+
# soft.platform[:data_row_count] # => "240"
|
70
|
+
# soft.platform.keys.sort {|a,b| a.to_s <=> b.to_s}[0..2] # => [:contact_address, :contact_city, :contact_country]
|
71
|
+
# soft.platform[:"contact_zip/postal_code"] # => "97331"
|
72
|
+
# soft.platform[:table].header # => ["ID", "GB_ACC", "SPOT_ID", "Function/Family", "ORGANISM", "SEQUENCE"]
|
73
|
+
# soft.platform[:table].header_description # => {"ORGANISM"=>"sequence sources", "SEQUENCE"=>"oligo sequence used", "Function/Family"=>"gene functions and family", "ID"=>"", "SPOT_ID"=>"", "GB_ACC"=>"Gene bank accession number"}
|
74
|
+
# soft.platform[:table].rows.size # => 240
|
75
|
+
# soft.platform[:table].rows[5] # => ["A039P68U", "AI163321", "", "TF, flowering protein CONSTANS", "P. tremula x P. tremuloides", "AGAAAATTCGATATACTGTCCGTAAAGAGGTAGCACTTAGAATGCAACGGAATAAAGGGCAGTTCACCTC"]
|
76
|
+
# soft.platform[:table].rows[5][4] # => "P. tremula x P. tremuloides"
|
77
|
+
# soft.platform[:table].rows[5][:organism] # => "P. tremula x P. tremuloides"
|
78
|
+
# soft.platform[:table].rows[5]['ORGANISM'] # => "P. tremula x P. tremuloides"
|
79
|
+
#
|
80
|
+
# soft.series[:geo_accession] # => "GSE3457"
|
81
|
+
# soft.series[:contributor] # => ["Jingyi,,Li", "Olga,,Shevchenko", "Ove,,Nilsson", "Steve,H,Strauss", "Amy,M,Brunner"]
|
82
|
+
# soft.series[:platform_id] # => "GPL2092"
|
83
|
+
# soft.series[:sample_id].size # => 74
|
84
|
+
# soft.series[:sample_id][0..4] # => ["GSM77557", "GSM77558", "GSM77559", "GSM77560", "GSM77561"]
|
85
|
+
#
|
86
|
+
# soft.database[:name] # => "Gene Expression Omnibus (GEO)"
|
87
|
+
# soft.database[:ref] # => "Nucleic Acids Res. 2005 Jan 1;33 Database Issue:D562-6"
|
88
|
+
# soft.database[:institute] # => "NCBI NLM NIH"
|
89
|
+
#
|
90
|
+
# soft.samples.size # => 74
|
91
|
+
# soft.samples[:GSM77600][:series_id] # => "GSE3457"
|
92
|
+
# soft.samples['GSM77600'][:series_id] # => "GSE3457"
|
93
|
+
# soft.samples[:GSM77600][:platform_id] # => "GPL2092"
|
94
|
+
# soft.samples[:GSM77600][:type] # => "RNA"
|
95
|
+
# soft.samples[:GSM77600][:title] # => "jst2b2"
|
96
|
+
# soft.samples[:GSM77600][:table].header # => ["ID_REF", "VALUE"]
|
97
|
+
# soft.samples[:GSM77600][:table].header_description # => {"ID_REF"=>"", "VALUE"=>"normalized signal intensities"}
|
98
|
+
# soft.samples[:GSM77600][:table].rows.size # => 217
|
99
|
+
# soft.samples[:GSM77600][:table].rows[5] # => ["A039P68U", "8.19"]
|
100
|
+
# soft.samples[:GSM77600][:table].rows[5][0] # => "A039P68U"
|
101
|
+
# soft.samples[:GSM77600][:table].rows[5][:id_ref] # => "A039P68U"
|
102
|
+
# soft.samples[:GSM77600][:table].rows[5]['ID_REF'] # => "A039P68U"
|
103
|
+
#
|
104
|
+
#
|
105
|
+
# lines = IO.readlines('GDS100.soft')
|
106
|
+
# soft = Bio::SOFT.new(lines)
|
107
|
+
#
|
108
|
+
# soft.database[:name] # => "Gene Expression Omnibus (GEO)"
|
109
|
+
# soft.database[:ref] # => "Nucleic Acids Res. 2005 Jan 1;33 Database Issue:D562-6"
|
110
|
+
# soft.database[:institute] # => "NCBI NLM NIH"
|
111
|
+
#
|
112
|
+
# soft.subsets.size # => 8
|
113
|
+
# soft.subsets.keys # => ["GDS100_1", "GDS100_2", "GDS100_3", "GDS100_4", "GDS100_5", "GDS100_6", "GDS100_7", "GDS100_8"]
|
114
|
+
# soft.subsets[:GDS100_7] # => {:dataset_id=>"GDS100", :type=>"time", :sample_id=>"GSM548,GSM543", :description=>"60 minute"}
|
115
|
+
# soft.subsets['GDS100_7'][:sample_id] # => "GSM548,GSM543"
|
116
|
+
# soft.subsets[:GDS100_7][:sample_id] # => "GSM548,GSM543"
|
117
|
+
# soft.subsets[:GDS100_7][:dataset_id] # => "GDS100"
|
118
|
+
#
|
119
|
+
# soft.dataset[:order] # => "none"
|
120
|
+
# soft.dataset[:sample_organism] # => "Escherichia coli"
|
121
|
+
# soft.dataset[:table].header # => ["ID_REF", "IDENTIFIER", "GSM549", "GSM542", "GSM543", "GSM547", "GSM544", "GSM545", "GSM546", "GSM548"]
|
122
|
+
# soft.dataset[:table].rows.size # => 5764
|
123
|
+
# soft.dataset[:table].rows[5] # => ["6", "EMPTY", "0.097", "0.217", "0.242", "0.067", "0.104", "0.162", "0.104", "0.154"]
|
124
|
+
# soft.dataset[:table].rows[5][4] # => "0.242"
|
125
|
+
# soft.dataset[:table].rows[5][:gsm549] # => "0.097"
|
126
|
+
# soft.dataset[:table].rows[5][:GSM549] # => "0.097"
|
127
|
+
# soft.dataset[:table].rows[5]['GSM549'] # => "0.097"
|
128
|
+
#
|
129
|
+
class SOFT
|
130
|
+
attr_accessor :database
|
131
|
+
attr_accessor :series, :platform, :samples
|
132
|
+
attr_accessor :dataset, :subsets
|
133
|
+
|
134
|
+
LINE_TYPE_ENTITY_INDICATOR = '^'
|
135
|
+
LINE_TYPE_ENTITY_ATTRIBUTE = '!'
|
136
|
+
LINE_TYPE_TABLE_HEADER = '#'
|
137
|
+
# data table row defined by absence of line type character
|
138
|
+
|
139
|
+
TABLE_COLUMN_DELIMITER = "\t"
|
140
|
+
|
141
|
+
# Constructor
|
142
|
+
#
|
143
|
+
# ---
|
144
|
+
# *Arguments*
|
145
|
+
# * +lines+: (_required_) contents of SOFT formatted file
|
146
|
+
# *Returns*:: Bio::SOFT
|
147
|
+
def initialize(lines=nil)
|
148
|
+
@database = Database.new
|
149
|
+
|
150
|
+
@series = Series.new
|
151
|
+
@platform = Platform.new
|
152
|
+
@samples = Samples.new
|
153
|
+
|
154
|
+
@dataset = Dataset.new
|
155
|
+
@subsets = Subsets.new
|
156
|
+
|
157
|
+
process(lines)
|
158
|
+
end
|
159
|
+
|
160
|
+
# Classes for Platform and Series files
|
161
|
+
|
162
|
+
class Samples < Hash #:nodoc:
|
163
|
+
def [](x)
|
164
|
+
x = x.to_s if x.kind_of?( Symbol )
|
165
|
+
super(x)
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
class Entity < Hash #:nodoc:
|
170
|
+
end
|
171
|
+
|
172
|
+
class Sample < Entity #:nodoc:
|
173
|
+
end
|
174
|
+
|
175
|
+
class Platform < Entity #:nodoc:
|
176
|
+
end
|
177
|
+
|
178
|
+
class Series < Entity #:nodoc:
|
179
|
+
end
|
180
|
+
|
181
|
+
# Classes for DataSet files
|
182
|
+
|
183
|
+
class Subsets < Samples #:nodoc:
|
184
|
+
end
|
185
|
+
|
186
|
+
class Subset < Entity #:nodoc:
|
187
|
+
end
|
188
|
+
|
189
|
+
class Dataset < Entity #:nodoc:
|
190
|
+
end
|
191
|
+
|
192
|
+
# Classes important for all types
|
193
|
+
|
194
|
+
class Database < Entity #:nodoc:
|
195
|
+
end
|
196
|
+
|
197
|
+
class Table #:nodoc:
|
198
|
+
attr_accessor :header
|
199
|
+
attr_accessor :header_description
|
200
|
+
attr_accessor :rows
|
201
|
+
|
202
|
+
class Header < Array #:nodoc:
|
203
|
+
# @column_index contains column name => numerical index of column
|
204
|
+
attr_accessor :column_index
|
205
|
+
|
206
|
+
def initialize
|
207
|
+
@column_index = {}
|
208
|
+
end
|
209
|
+
end
|
210
|
+
|
211
|
+
class Row < Array #:nodoc:
|
212
|
+
attr_accessor :header_object
|
213
|
+
|
214
|
+
def initialize( n, header_object=nil )
|
215
|
+
@header_object = header_object
|
216
|
+
super(n)
|
217
|
+
end
|
218
|
+
|
219
|
+
def [](x)
|
220
|
+
if x.kind_of?( Fixnum )
|
221
|
+
super(x)
|
222
|
+
else
|
223
|
+
begin
|
224
|
+
x = x.to_s.downcase.to_sym
|
225
|
+
z = @header_object.column_index[x]
|
226
|
+
unless z.kind_of?( Fixnum )
|
227
|
+
raise IndexError, "#{x.inspect} is not a valid index. Contents of @header_object.column_index: #{@header_object.column_index.inspect}"
|
228
|
+
end
|
229
|
+
self[ z ]
|
230
|
+
rescue NoMethodError
|
231
|
+
unless @header_object
|
232
|
+
$stderr.puts "Table::Row @header_object undefined!"
|
233
|
+
end
|
234
|
+
raise
|
235
|
+
end
|
236
|
+
end
|
237
|
+
end
|
238
|
+
end
|
239
|
+
|
240
|
+
def initialize()
|
241
|
+
@header_description = {}
|
242
|
+
@header = Header.new
|
243
|
+
@rows = []
|
244
|
+
end
|
245
|
+
|
246
|
+
def add_header( line )
|
247
|
+
raise "Can only define one header" unless @header.empty?
|
248
|
+
@header = @header.concat( parse_row( line ) ) # beware of clobbering this into an Array
|
249
|
+
@header.each_with_index do |key, i|
|
250
|
+
@header.column_index[key.downcase.to_sym] = i
|
251
|
+
end
|
252
|
+
end
|
253
|
+
|
254
|
+
def add_row( line )
|
255
|
+
@rows << Row.new( parse_row( line ), @header )
|
256
|
+
end
|
257
|
+
|
258
|
+
def add_header_or_row( line )
|
259
|
+
@header.empty? ? add_header( line ) : add_row( line )
|
260
|
+
end
|
261
|
+
|
262
|
+
protected
|
263
|
+
def parse_row( line )
|
264
|
+
line.split( TABLE_COLUMN_DELIMITER )
|
265
|
+
end
|
266
|
+
end
|
267
|
+
|
268
|
+
#########
|
269
|
+
protected
|
270
|
+
#########
|
271
|
+
|
272
|
+
def process(lines)
|
273
|
+
current_indicator = nil
|
274
|
+
current_class_accessor = nil
|
275
|
+
in_table = false
|
276
|
+
|
277
|
+
lines.each_with_index do |line, line_number|
|
278
|
+
line.strip!
|
279
|
+
next if line.nil? or line.empty?
|
280
|
+
case line[0].chr
|
281
|
+
when LINE_TYPE_ENTITY_INDICATOR
|
282
|
+
current_indicator, value = split_label_value_in( line[1..-1] )
|
283
|
+
|
284
|
+
case current_indicator
|
285
|
+
when 'DATABASE'
|
286
|
+
current_class_accessor = @database
|
287
|
+
when 'DATASET'
|
288
|
+
current_class_accessor = @dataset
|
289
|
+
when 'PLATFORM'
|
290
|
+
current_class_accessor = @platform
|
291
|
+
when 'SERIES'
|
292
|
+
current_class_accessor = @series
|
293
|
+
when 'SAMPLE'
|
294
|
+
@samples[value] = Sample.new
|
295
|
+
current_class_accessor = @samples[value]
|
296
|
+
when 'SUBSET'
|
297
|
+
@subsets[value] = Subset.new
|
298
|
+
current_class_accessor = @subsets[value]
|
299
|
+
else
|
300
|
+
custom_raise( line_number, error_msg(40, line) )
|
301
|
+
end
|
302
|
+
|
303
|
+
when LINE_TYPE_ENTITY_ATTRIBUTE
|
304
|
+
if( current_indicator == nil )
|
305
|
+
custom_raise( line_number, error_msg(30) )
|
306
|
+
end
|
307
|
+
|
308
|
+
# Handle lines such as '!platform_table_begin' and '!platform_table_end'
|
309
|
+
if in_table
|
310
|
+
if line =~ %r{table_begin}
|
311
|
+
next
|
312
|
+
elsif line =~ %r{table_end}
|
313
|
+
in_table = false
|
314
|
+
next
|
315
|
+
end
|
316
|
+
end
|
317
|
+
|
318
|
+
key, value = split_label_value_in( line, true )
|
319
|
+
key_s = key.to_sym
|
320
|
+
|
321
|
+
if current_class_accessor.include?( key_s )
|
322
|
+
if current_class_accessor[ key_s ].class != Array
|
323
|
+
current_class_accessor[ key_s ] = [ current_class_accessor[ key_s ] ]
|
324
|
+
end
|
325
|
+
current_class_accessor[key.to_sym] << value
|
326
|
+
else
|
327
|
+
current_class_accessor[key.to_sym] = value
|
328
|
+
end
|
329
|
+
|
330
|
+
when LINE_TYPE_TABLE_HEADER
|
331
|
+
if( (current_indicator != 'SAMPLE') and (current_indicator != 'PLATFORM') and (current_indicator != 'DATASET') )
|
332
|
+
custom_raise( line_number, error_msg(20, current_indicator.inspect) )
|
333
|
+
end
|
334
|
+
|
335
|
+
in_table = true # may be redundant, computationally not worth checking
|
336
|
+
|
337
|
+
# We only expect one table per platform or sample
|
338
|
+
current_class_accessor[:table] ||= Table.new
|
339
|
+
key, value = split_label_value_in( line )
|
340
|
+
# key[1..-1] -- Remove first character which is the LINE_TYPE_TABLE_HEADER
|
341
|
+
current_class_accessor[:table].header_description[ key[1..-1] ] = value
|
342
|
+
|
343
|
+
else
|
344
|
+
# Type: No line type - should be a row in a table.
|
345
|
+
|
346
|
+
if( (current_indicator == nil) or (in_table == false) )
|
347
|
+
custom_raise( line_number, error_msg(10) )
|
348
|
+
end
|
349
|
+
current_class_accessor[:table].add_header_or_row( line )
|
350
|
+
end
|
351
|
+
end
|
352
|
+
end
|
353
|
+
|
354
|
+
def error_msg( i, extra_info=nil )
|
355
|
+
case i
|
356
|
+
when 10
|
357
|
+
x = ["Lines without line-type characters are rows in a table, but",
|
358
|
+
"a line containing an entity indicator such as",
|
359
|
+
"\"#{LINE_TYPE_ENTITY_INDICATOR}SAMPLE\",",
|
360
|
+
"\"#{LINE_TYPE_ENTITY_INDICATOR}PLATFORM\",",
|
361
|
+
"or \"#{LINE_TYPE_ENTITY_INDICATOR}DATASET\" has not been",
|
362
|
+
"previously encountered or it does not appear that this line is",
|
363
|
+
"in a table."]
|
364
|
+
when 20
|
365
|
+
# tables are allowed inside samples and platforms
|
366
|
+
x = ["Tables are only allowed inside SAMPLE and PLATFORM.",
|
367
|
+
"Current table information found inside #{extra_info}."]
|
368
|
+
when 30
|
369
|
+
x = ["Entity attribute line (\"#{LINE_TYPE_ENTITY_ATTRIBUTE}\")",
|
370
|
+
"found before entity indicator line (\"#{LINE_TYPE_ENTITY_INDICATOR}\")"]
|
371
|
+
when 40
|
372
|
+
x = ["Unkown entity indicator. Must be DATABASE, SAMPLE, PLATFORM,",
|
373
|
+
"SERIES, DATASET, or SUBSET."]
|
374
|
+
else
|
375
|
+
raise IndexError, "Unknown error message requested."
|
376
|
+
end
|
377
|
+
|
378
|
+
x.join(" ")
|
379
|
+
end
|
380
|
+
|
381
|
+
def custom_raise( line_number_with_0_based_indexing, msg )
|
382
|
+
raise ["Error processing input line: #{line_number_with_0_based_indexing+1}",
|
383
|
+
msg].join("\t")
|
384
|
+
end
|
385
|
+
|
386
|
+
def split_label_value_in( line, shift_key=false )
|
387
|
+
line =~ %r{\s*=\s*}
|
388
|
+
key, value = $`, $'
|
389
|
+
|
390
|
+
if shift_key
|
391
|
+
key =~ %r{_}
|
392
|
+
key = $'
|
393
|
+
end
|
394
|
+
|
395
|
+
if( (key == nil) or (value == nil) )
|
396
|
+
puts line.inspect
|
397
|
+
raise
|
398
|
+
end
|
399
|
+
|
400
|
+
[key, value]
|
401
|
+
end
|
402
|
+
|
403
|
+
end # SOFT
|
404
|
+
end # Bio
|
@@ -0,0 +1,375 @@
|
|
1
|
+
#
|
2
|
+
# = bio/db/transfac.rb - TRANSFAC database class
|
3
|
+
#
|
4
|
+
# Copyright:: Copyright (C) 2001
|
5
|
+
# Shuichi Kawashima <shuichi@hgc.jp>
|
6
|
+
# License:: The Ruby License
|
7
|
+
#
|
8
|
+
# $Id: transfac.rb,v 1.12 2007/04/05 23:35:40 trevor Exp $
|
9
|
+
#
|
10
|
+
|
11
|
+
require "bio/db"
|
12
|
+
require "matrix"
|
13
|
+
|
14
|
+
module Bio
|
15
|
+
|
16
|
+
class TRANSFAC < EMBLDB
|
17
|
+
|
18
|
+
DELIMITER = RS = "\n//\n"
|
19
|
+
TAGSIZE = 4
|
20
|
+
|
21
|
+
def initialize(entry)
|
22
|
+
super(entry, TAGSIZE)
|
23
|
+
end
|
24
|
+
|
25
|
+
# AC Accession number (1 per entry)
|
26
|
+
#
|
27
|
+
# AC T00001 in the case of FACTOR
|
28
|
+
# AC M00001 in the case of MATRIX
|
29
|
+
# AC R00001 in the case of SITE
|
30
|
+
# AC G000001 in the case of GENE
|
31
|
+
# AC C00001 in the case of CLASS
|
32
|
+
# AC 00001 in the case of CELL
|
33
|
+
#
|
34
|
+
def ac
|
35
|
+
unless @data['AC']
|
36
|
+
@data['AC'] = fetch('AC')
|
37
|
+
end
|
38
|
+
@data['AC']
|
39
|
+
end
|
40
|
+
alias entry_id ac
|
41
|
+
|
42
|
+
# DT Date (1 per entry)
|
43
|
+
#
|
44
|
+
# DT DD.MM.YYYY (created); ewi.
|
45
|
+
# DT DD.MM.YYYY (updated); mpr.
|
46
|
+
#
|
47
|
+
def dt
|
48
|
+
field_fetch('DT')
|
49
|
+
end
|
50
|
+
alias date dt
|
51
|
+
|
52
|
+
def cc
|
53
|
+
field_fetch('CC')
|
54
|
+
end
|
55
|
+
alias comment cc
|
56
|
+
|
57
|
+
def os
|
58
|
+
field_fetch('OS')
|
59
|
+
end
|
60
|
+
alias org_species os
|
61
|
+
|
62
|
+
def oc
|
63
|
+
field_fetch('OC')
|
64
|
+
end
|
65
|
+
alias org_class oc
|
66
|
+
|
67
|
+
def rn
|
68
|
+
field_fetch('RN')
|
69
|
+
end
|
70
|
+
alias ref_no rn
|
71
|
+
|
72
|
+
def ra
|
73
|
+
field_fetch('RA')
|
74
|
+
end
|
75
|
+
alias ref_authors ra
|
76
|
+
|
77
|
+
def rt
|
78
|
+
field_fetch('RT')
|
79
|
+
end
|
80
|
+
alias ref_title rt
|
81
|
+
|
82
|
+
def rl
|
83
|
+
field_fetch('RL')
|
84
|
+
end
|
85
|
+
alias ref_data rl
|
86
|
+
|
87
|
+
|
88
|
+
class MATRIX < TRANSFAC
|
89
|
+
|
90
|
+
def initialize(entry)
|
91
|
+
super(entry)
|
92
|
+
end
|
93
|
+
|
94
|
+
# NA Name of the binding factor
|
95
|
+
def na
|
96
|
+
field_fetch('NA')
|
97
|
+
end
|
98
|
+
|
99
|
+
# DE Short factor description
|
100
|
+
def de
|
101
|
+
field_fetch('DE')
|
102
|
+
end
|
103
|
+
|
104
|
+
# BF List of linked factor entries
|
105
|
+
def bf
|
106
|
+
field_fetch('bf')
|
107
|
+
end
|
108
|
+
|
109
|
+
|
110
|
+
def ma
|
111
|
+
ma_dat = {}
|
112
|
+
ma_ary = []
|
113
|
+
key = ''
|
114
|
+
@orig.each do |k, v|
|
115
|
+
if k =~ /^0*(\d+)/
|
116
|
+
key = $1.to_i
|
117
|
+
ma_dat[key] = fetch(k) unless ma_dat[key]
|
118
|
+
end
|
119
|
+
end
|
120
|
+
ma_dat.keys.sort.each_with_index do |k, i|
|
121
|
+
rep_nt = ma_dat[k].slice!(-1, 1)
|
122
|
+
ma_dat[k].slice!(-1, 1)
|
123
|
+
ma_ary[i] = ma_dat[k].split(/\s+/)
|
124
|
+
ma_ary[i].each_with_index do |x, j|
|
125
|
+
ma_ary[i][j] = x.to_i
|
126
|
+
end
|
127
|
+
end
|
128
|
+
Matrix[*ma_ary]
|
129
|
+
end
|
130
|
+
|
131
|
+
# BA Statistical basis
|
132
|
+
def ba
|
133
|
+
field_fetch('BA')
|
134
|
+
end
|
135
|
+
|
136
|
+
end
|
137
|
+
|
138
|
+
|
139
|
+
class SITE < TRANSFAC
|
140
|
+
|
141
|
+
def initialize(entry)
|
142
|
+
super(entry)
|
143
|
+
end
|
144
|
+
|
145
|
+
def ty
|
146
|
+
field_fetch('TY')
|
147
|
+
end
|
148
|
+
|
149
|
+
def de
|
150
|
+
field_fetch('DE')
|
151
|
+
end
|
152
|
+
|
153
|
+
def re
|
154
|
+
field_fetch('RE')
|
155
|
+
end
|
156
|
+
|
157
|
+
def sq
|
158
|
+
field_fetch('SQ')
|
159
|
+
end
|
160
|
+
|
161
|
+
def el
|
162
|
+
field_fetch('EL')
|
163
|
+
end
|
164
|
+
|
165
|
+
def sf
|
166
|
+
field_fetch('SF')
|
167
|
+
end
|
168
|
+
|
169
|
+
def st
|
170
|
+
field_fetch('ST')
|
171
|
+
end
|
172
|
+
|
173
|
+
def s1
|
174
|
+
field_fetch('S1')
|
175
|
+
end
|
176
|
+
|
177
|
+
def bf
|
178
|
+
field_fetch('BF')
|
179
|
+
end
|
180
|
+
|
181
|
+
def so
|
182
|
+
field_fetch('SO')
|
183
|
+
end
|
184
|
+
|
185
|
+
def mm
|
186
|
+
field_fetch('MM')
|
187
|
+
end
|
188
|
+
|
189
|
+
# DR Cross-references to other databases (>=0 per entry)
|
190
|
+
def dr
|
191
|
+
field_fetch('DR')
|
192
|
+
end
|
193
|
+
|
194
|
+
end
|
195
|
+
|
196
|
+
|
197
|
+
class FACTOR < TRANSFAC
|
198
|
+
|
199
|
+
def initialize(entry)
|
200
|
+
super(entry)
|
201
|
+
end
|
202
|
+
|
203
|
+
# FA Factor name
|
204
|
+
def fa
|
205
|
+
field_fetch('FA')
|
206
|
+
end
|
207
|
+
|
208
|
+
# SY Synonyms
|
209
|
+
def sy
|
210
|
+
field_fetch('SY')
|
211
|
+
end
|
212
|
+
|
213
|
+
# DR Cross-references to other databases (>=0 per entry)
|
214
|
+
def dr
|
215
|
+
field_fetch('DR')
|
216
|
+
end
|
217
|
+
|
218
|
+
# HO Homologs (suggested)
|
219
|
+
def ho
|
220
|
+
field_fetch('HO')
|
221
|
+
end
|
222
|
+
|
223
|
+
# CL Classification (class accession no.; class identifier; decimal
|
224
|
+
# CL classification number.)
|
225
|
+
def cl
|
226
|
+
field_fetch('CL')
|
227
|
+
end
|
228
|
+
|
229
|
+
# SZ Size (length (number of amino acids); calculated molecular mass
|
230
|
+
# SZ in kDa; experimental molecular mass (or range) in kDa
|
231
|
+
# SZ (experimental method) [Ref]
|
232
|
+
def sz
|
233
|
+
field_fetch('SZ')
|
234
|
+
end
|
235
|
+
|
236
|
+
# SQ Sequence
|
237
|
+
def sq
|
238
|
+
field_fetch('SQ')
|
239
|
+
end
|
240
|
+
|
241
|
+
# SC Sequence comment, i. e. source of the protein sequence
|
242
|
+
def sc
|
243
|
+
field_fetch('SC')
|
244
|
+
end
|
245
|
+
|
246
|
+
# FT Feature table (1st position last position feature)
|
247
|
+
def ft
|
248
|
+
field_fetch('FT')
|
249
|
+
end
|
250
|
+
|
251
|
+
# SF Structural features
|
252
|
+
def sf
|
253
|
+
field_fetch('SF')
|
254
|
+
end
|
255
|
+
|
256
|
+
# CP Cell specificity (positive)
|
257
|
+
def cp
|
258
|
+
field_fetch('CP')
|
259
|
+
end
|
260
|
+
|
261
|
+
# CN Cell specificity (negative)
|
262
|
+
def cn
|
263
|
+
field_fetch('CN')
|
264
|
+
end
|
265
|
+
|
266
|
+
# FF Functional features
|
267
|
+
def ff
|
268
|
+
field_fetch('FF')
|
269
|
+
end
|
270
|
+
|
271
|
+
# IN Interacting factors (factor accession no.; factor name;
|
272
|
+
# IN biological species.)
|
273
|
+
def in
|
274
|
+
field_fetch('IN')
|
275
|
+
end
|
276
|
+
|
277
|
+
# MX Matrix (matrix accession no.; matrix identifier)
|
278
|
+
def mx
|
279
|
+
field_fetch('MX')
|
280
|
+
end
|
281
|
+
|
282
|
+
# BS Bound sites (site accession no.; site ID; quality: N; biological
|
283
|
+
# BS species)
|
284
|
+
def bs
|
285
|
+
field_fetch('BS')
|
286
|
+
end
|
287
|
+
|
288
|
+
end
|
289
|
+
|
290
|
+
|
291
|
+
class CELL < TRANSFAC
|
292
|
+
|
293
|
+
def initialize(entry)
|
294
|
+
super(entry)
|
295
|
+
end
|
296
|
+
|
297
|
+
# CD Cell description
|
298
|
+
def cd
|
299
|
+
field_fetch('CD')
|
300
|
+
end
|
301
|
+
|
302
|
+
end
|
303
|
+
|
304
|
+
|
305
|
+
class CLASS < TRANSFAC
|
306
|
+
|
307
|
+
def initialize(entry)
|
308
|
+
super(entry)
|
309
|
+
end
|
310
|
+
|
311
|
+
# CL Class
|
312
|
+
def cl
|
313
|
+
field_fetch('CL')
|
314
|
+
end
|
315
|
+
|
316
|
+
# SD Structure description
|
317
|
+
def sd
|
318
|
+
field_fetch('SD')
|
319
|
+
end
|
320
|
+
|
321
|
+
# BF Factors belonging to this class
|
322
|
+
def bf
|
323
|
+
field_fetch('BF')
|
324
|
+
end
|
325
|
+
|
326
|
+
# DR PROSITE accession numbers
|
327
|
+
def dr
|
328
|
+
field_fetch('DR')
|
329
|
+
end
|
330
|
+
|
331
|
+
end
|
332
|
+
|
333
|
+
|
334
|
+
class GENE < TRANSFAC
|
335
|
+
|
336
|
+
def initialize(entry)
|
337
|
+
super(entry)
|
338
|
+
end
|
339
|
+
|
340
|
+
# SD Short description/name of the gene
|
341
|
+
def sd
|
342
|
+
field_fetch('SD')
|
343
|
+
end
|
344
|
+
|
345
|
+
# DE
|
346
|
+
def de
|
347
|
+
field_fetch('DE')
|
348
|
+
end
|
349
|
+
|
350
|
+
# BC Bucher promoter
|
351
|
+
def bc
|
352
|
+
field_fetch('BC')
|
353
|
+
end
|
354
|
+
|
355
|
+
# BS TRANSFAC SITE positions and accession numbers
|
356
|
+
def bs
|
357
|
+
field_fetch('BS')
|
358
|
+
end
|
359
|
+
|
360
|
+
# CO COMPEL accession number
|
361
|
+
def co
|
362
|
+
field_fetch('CO')
|
363
|
+
end
|
364
|
+
|
365
|
+
# TR TRRD accession number
|
366
|
+
def tr
|
367
|
+
field_fetch('TR')
|
368
|
+
end
|
369
|
+
|
370
|
+
end
|
371
|
+
|
372
|
+
end # class TRANSFAC
|
373
|
+
|
374
|
+
end # module Bio
|
375
|
+
|