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,349 @@
|
|
1
|
+
#
|
2
|
+
# test/unit/bio/test_command.rb - Unit test for Bio::Command
|
3
|
+
#
|
4
|
+
# Copyright:: Copyright (C) 2005-2008
|
5
|
+
# Mitsuteru Nakao <n@bioruby.org>,
|
6
|
+
# Naohisa Goto <ng@bioruby.org>,
|
7
|
+
# Toshiaki Katayama <k@bioruby.org>
|
8
|
+
# License:: The Ruby License
|
9
|
+
#
|
10
|
+
# $Id:$
|
11
|
+
#
|
12
|
+
|
13
|
+
require 'pathname'
|
14
|
+
libpath = Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 3, 'lib')).cleanpath.to_s
|
15
|
+
$:.unshift(libpath) unless $:.include?(libpath)
|
16
|
+
|
17
|
+
|
18
|
+
require 'test/unit'
|
19
|
+
require 'bio/command'
|
20
|
+
|
21
|
+
module Bio
|
22
|
+
class TestCommand < Test::Unit::TestCase
|
23
|
+
|
24
|
+
def test_command_constants
|
25
|
+
assert(Bio::Command::UNSAFE_CHARS_UNIX)
|
26
|
+
assert(Bio::Command::QUOTE_CHARS_WINDOWS)
|
27
|
+
assert(Bio::Command::UNESCAPABLE_CHARS)
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_escape_shell_windows
|
31
|
+
str = "bio_ruby.123@456:789"
|
32
|
+
assert_equal("bio_ruby.123@456:789",
|
33
|
+
Bio::Command.escape_shell_windows(str))
|
34
|
+
str = "bio\'\"r u\"b\\y123@456:789"
|
35
|
+
assert_equal("\"bio'\"\"r u\"\"b\\y123@456:789\"",
|
36
|
+
Bio::Command.escape_shell_windows(str))
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_escape_shell_unix
|
40
|
+
str = "bio_ruby.123@456:789"
|
41
|
+
assert_equal("bio_ruby.123@456:789",
|
42
|
+
Bio::Command.escape_shell_unix(str))
|
43
|
+
str = "bio\'\"r u\"b\\y123@456:789"
|
44
|
+
assert_equal("bio\\'\\\"r\\ u\\\"b\\\\y123@456:789",
|
45
|
+
Bio::Command.escape_shell_unix(str))
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_escape_shell
|
49
|
+
str = "bio_ruby.123@456:789"
|
50
|
+
assert_equal("bio_ruby.123@456:789",
|
51
|
+
Bio::Command.escape_shell(str))
|
52
|
+
str = "bio\'\"r u\"b\\y123@456:789"
|
53
|
+
case RUBY_PLATFORM
|
54
|
+
when /mswin32|bccwin32/
|
55
|
+
assert_equal("\"bio'\"\"r u\"\"b\\y123@456:789\"",
|
56
|
+
Bio::Command.escape_shell(str))
|
57
|
+
else
|
58
|
+
assert_equal("bio\\'\\\"r\\ u\\\"b\\\\y123@456:789",
|
59
|
+
Bio::Command.escape_shell(str))
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def test_make_command_line
|
64
|
+
ary = [ "ruby",
|
65
|
+
"test.rb", "atgcatgc", "bio\'\"r u\"b\\y123@456:789" ]
|
66
|
+
case RUBY_PLATFORM
|
67
|
+
when /mswin32|bccwin32/
|
68
|
+
assert_equal("ruby" +
|
69
|
+
" test.rb atgcatgc" +
|
70
|
+
" \"bio'\"\"r u\"\"b\\y123@456:789\"",
|
71
|
+
Bio::Command.make_command_line(ary))
|
72
|
+
else
|
73
|
+
assert_equal("ruby" +
|
74
|
+
" test.rb atgcatgc" +
|
75
|
+
" bio\\'\\\"r\\ u\\\"b\\\\y123@456:789",
|
76
|
+
Bio::Command.make_command_line(ary))
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
def test_make_command_line_windows
|
81
|
+
ary = [ "C:\\Program Files\\Ruby\\bin\\ruby.exe",
|
82
|
+
"test.rb", "atgcatgc", "bio\'\"r u\"b\\y123@456:789" ]
|
83
|
+
assert_equal("\"C:\\Program Files\\Ruby\\bin\\ruby.exe\"" +
|
84
|
+
" test.rb atgcatgc" +
|
85
|
+
" \"bio'\"\"r u\"\"b\\y123@456:789\"",
|
86
|
+
Bio::Command.make_command_line_windows(ary))
|
87
|
+
end
|
88
|
+
|
89
|
+
def test_make_command_line_unix
|
90
|
+
ary = [ "/usr/local/bin/ruby",
|
91
|
+
"test.rb", "atgcatgc", "bio\'\"r u\"b\\y123@456:789" ]
|
92
|
+
assert_equal("/usr/local/bin/ruby" +
|
93
|
+
" test.rb atgcatgc" +
|
94
|
+
" bio\\'\\\"r\\ u\\\"b\\\\y123@456:789",
|
95
|
+
Bio::Command.make_command_line_unix(ary))
|
96
|
+
end
|
97
|
+
|
98
|
+
def test_safe_command_line_array
|
99
|
+
ary1 = [ 'test' ]
|
100
|
+
assert_equal([ [ 'test', 'test' ] ],
|
101
|
+
Bio::Command.safe_command_line_array(ary1))
|
102
|
+
ary1a = [ [ 'test/test1a', 'test' ] ]
|
103
|
+
assert_equal(ary1a,
|
104
|
+
Bio::Command.safe_command_line_array(ary1a))
|
105
|
+
end
|
106
|
+
|
107
|
+
def test_safe_command_line_array_passthrough
|
108
|
+
ary0 = []
|
109
|
+
assert_equal(ary0,
|
110
|
+
Bio::Command.safe_command_line_array(ary0))
|
111
|
+
ary2 = [ 'cmd', 'arg0' ]
|
112
|
+
assert_equal(ary2,
|
113
|
+
Bio::Command.safe_command_line_array(ary2))
|
114
|
+
ary2a = [ [ 'cmd', 'display name' ], 'arg0' ]
|
115
|
+
assert_equal(ary2a,
|
116
|
+
Bio::Command.safe_command_line_array(ary2a))
|
117
|
+
ary3 = [ 'cmd', 'arg0', 'arg1' ]
|
118
|
+
assert_equal(ary3,
|
119
|
+
Bio::Command.safe_command_line_array(ary3))
|
120
|
+
end
|
121
|
+
|
122
|
+
def test_make_cgi_params_by_hash_in_symbol
|
123
|
+
ary = [
|
124
|
+
"type1=bp",
|
125
|
+
"type2=bp",
|
126
|
+
"downstream=",
|
127
|
+
"upstream=",
|
128
|
+
"format=fasta",
|
129
|
+
"options=similarity",
|
130
|
+
"options=gene",
|
131
|
+
"action=export",
|
132
|
+
"_format=Text",
|
133
|
+
"output=txt",
|
134
|
+
"submit=Continue+%3E%3E",
|
135
|
+
"ab%3Dcd%26ef%3Dgh%23ij=pq%3D12%26rs%3D34%23tu",
|
136
|
+
]
|
137
|
+
hash = {
|
138
|
+
:type1 => 'bp',
|
139
|
+
:type2 => 'bp',
|
140
|
+
:downstream => '',
|
141
|
+
:upstream => '',
|
142
|
+
:format => 'fasta',
|
143
|
+
:options => ['similarity', 'gene'],
|
144
|
+
:action => 'export',
|
145
|
+
:_format => 'Text',
|
146
|
+
:output => 'txt',
|
147
|
+
:submit => 'Continue >>',
|
148
|
+
:"ab=cd&ef=gh#ij" => 'pq=12&rs=34#tu',
|
149
|
+
}
|
150
|
+
result = Bio::Command.make_cgi_params(hash)
|
151
|
+
ary.each do |str|
|
152
|
+
assert_match(Regexp.new(Regexp.escape(str)), result)
|
153
|
+
end
|
154
|
+
|
155
|
+
# round-trip test
|
156
|
+
result_hash = {}
|
157
|
+
CGI.parse(result).each do |k, v|
|
158
|
+
v = case v.size
|
159
|
+
when 0
|
160
|
+
''
|
161
|
+
when 1
|
162
|
+
v[0]
|
163
|
+
else
|
164
|
+
v
|
165
|
+
end
|
166
|
+
result_hash[k.intern] = v
|
167
|
+
end
|
168
|
+
assert_equal(hash, result_hash)
|
169
|
+
end
|
170
|
+
|
171
|
+
def test_make_cgi_params_by_hash_in_string
|
172
|
+
ary = [
|
173
|
+
"type1=bp",
|
174
|
+
"type2=bp",
|
175
|
+
"downstream=",
|
176
|
+
"upstream=",
|
177
|
+
"format=fasta",
|
178
|
+
"options=similarity",
|
179
|
+
"options=gene",
|
180
|
+
"action=export",
|
181
|
+
"_format=Text",
|
182
|
+
"output=txt",
|
183
|
+
"submit=Continue+%3E%3E",
|
184
|
+
"ab%3Dcd%26ef%3Dgh%23ij=pq%3D12%26rs%3D34%23tu",
|
185
|
+
]
|
186
|
+
hash = {
|
187
|
+
"type1" => 'bp',
|
188
|
+
"type2" => 'bp',
|
189
|
+
"downstream" => '',
|
190
|
+
"upstream" => '',
|
191
|
+
"format" => 'fasta',
|
192
|
+
"options" => ['similarity', 'gene'],
|
193
|
+
"action" => 'export',
|
194
|
+
"_format" => 'Text',
|
195
|
+
"output" => 'txt',
|
196
|
+
"submit" => 'Continue >>',
|
197
|
+
'ab=cd&ef=gh#ij' => 'pq=12&rs=34#tu',
|
198
|
+
}
|
199
|
+
result = Bio::Command.make_cgi_params(hash)
|
200
|
+
ary.each do |str|
|
201
|
+
assert_match(Regexp.new(Regexp.escape(str)), result)
|
202
|
+
end
|
203
|
+
|
204
|
+
# round-trip test
|
205
|
+
result_hash = {}
|
206
|
+
CGI.parse(result).each do |k, v|
|
207
|
+
v = case v.size
|
208
|
+
when 0
|
209
|
+
''
|
210
|
+
when 1
|
211
|
+
v[0]
|
212
|
+
else
|
213
|
+
v
|
214
|
+
end
|
215
|
+
result_hash[k] = v
|
216
|
+
end
|
217
|
+
assert_equal(hash, result_hash)
|
218
|
+
end
|
219
|
+
|
220
|
+
def test_make_cgi_params_by_array_of_array
|
221
|
+
ary = [
|
222
|
+
"type1=bp",
|
223
|
+
"type2=bp",
|
224
|
+
"downstream=",
|
225
|
+
"upstream=",
|
226
|
+
"format=fasta",
|
227
|
+
"options=similarity",
|
228
|
+
"options=gene",
|
229
|
+
"action=export",
|
230
|
+
"_format=Text",
|
231
|
+
"output=txt",
|
232
|
+
"submit=Continue+%3E%3E",
|
233
|
+
"ab%3Dcd%26ef%3Dgh%23ij=pq%3D12%26rs%3D34%23tu",
|
234
|
+
]
|
235
|
+
array_of_array = [
|
236
|
+
["type1", 'bp'],
|
237
|
+
["type2", 'bp'],
|
238
|
+
["downstream", ''],
|
239
|
+
["upstream", ''],
|
240
|
+
["format", 'fasta'],
|
241
|
+
["options", ['similarity', 'gene']],
|
242
|
+
["action", 'export'],
|
243
|
+
["_format", 'Text'],
|
244
|
+
["output", 'txt'],
|
245
|
+
["submit", 'Continue >>'],
|
246
|
+
[ 'ab=cd&ef=gh#ij', 'pq=12&rs=34#tu' ],
|
247
|
+
]
|
248
|
+
result = Bio::Command.make_cgi_params(array_of_array)
|
249
|
+
# When array of array, order is guaranteed.
|
250
|
+
assert_equal(ary.join('&'), result)
|
251
|
+
|
252
|
+
# round-trip test
|
253
|
+
result_array = []
|
254
|
+
CGI.parse(result).each do |k, v|
|
255
|
+
v = case v.size
|
256
|
+
when 0
|
257
|
+
''
|
258
|
+
when 1
|
259
|
+
v[0]
|
260
|
+
else
|
261
|
+
v
|
262
|
+
end
|
263
|
+
result_array.push([ k, v ])
|
264
|
+
end
|
265
|
+
assert_equal(array_of_array.sort, result_array.sort)
|
266
|
+
end
|
267
|
+
|
268
|
+
def test_make_cgi_params_by_array_of_hash
|
269
|
+
ary = [
|
270
|
+
"type1=bp",
|
271
|
+
"type2=bp",
|
272
|
+
"downstream=",
|
273
|
+
"upstream=",
|
274
|
+
"format=fasta",
|
275
|
+
"options=similarity",
|
276
|
+
"options=gene",
|
277
|
+
"action=export",
|
278
|
+
"_format=Text",
|
279
|
+
"output=txt",
|
280
|
+
"submit=Continue+%3E%3E",
|
281
|
+
"ab%3Dcd%26ef%3Dgh%23ij=pq%3D12%26rs%3D34%23tu",
|
282
|
+
]
|
283
|
+
array_of_hash = [
|
284
|
+
{"type1" => 'bp'},
|
285
|
+
{"type2" => 'bp'},
|
286
|
+
{"downstream" => ''},
|
287
|
+
{"upstream" => ''},
|
288
|
+
{"format" => 'fasta'},
|
289
|
+
{"options" => ['similarity', 'gene']},
|
290
|
+
{"action" => 'export'},
|
291
|
+
{"_format" => 'Text'},
|
292
|
+
{"output" => 'txt'},
|
293
|
+
{"submit" => 'Continue >>'},
|
294
|
+
{'ab=cd&ef=gh#ij' => 'pq=12&rs=34#tu'},
|
295
|
+
]
|
296
|
+
result = Bio::Command.make_cgi_params(array_of_hash)
|
297
|
+
# When array of hash, order is guaranteed.
|
298
|
+
assert_equal(ary.join('&'), result)
|
299
|
+
|
300
|
+
# round-trip test
|
301
|
+
result_array = []
|
302
|
+
CGI.parse(result).each do |k, v|
|
303
|
+
v = case v.size
|
304
|
+
when 0
|
305
|
+
''
|
306
|
+
when 1
|
307
|
+
v[0]
|
308
|
+
else
|
309
|
+
v
|
310
|
+
end
|
311
|
+
result_array.push({ k => v })
|
312
|
+
end
|
313
|
+
assert_equal(array_of_hash.sort { |x,y| x.keys[0] <=> y.keys[0] },
|
314
|
+
result_array.sort { |x,y| x.keys[0] <=> y.keys[0] })
|
315
|
+
end
|
316
|
+
|
317
|
+
def test_make_cgi_params_by_array_of_string
|
318
|
+
str = "type1=bp&type2=bp&downstream=&upstream=&format=fasta&options=similarity&options=gene&action=export&_format=Text&output=txt&submit=Continue+%3E%3E&ab=cd%26ef%3Dgh%23ij%3Dpq%3D12%26rs%3D34%23tu"
|
319
|
+
array_of_string = [
|
320
|
+
"type1=bp",
|
321
|
+
"type2=bp",
|
322
|
+
"downstream=",
|
323
|
+
"upstream=",
|
324
|
+
"format=fasta",
|
325
|
+
"options=similarity",
|
326
|
+
"options=gene",
|
327
|
+
"action=export",
|
328
|
+
"_format=Text",
|
329
|
+
"output=txt",
|
330
|
+
"submit=Continue >>",
|
331
|
+
# In the following case, 'ab' is regarded as
|
332
|
+
# the form key, and rest of the string is
|
333
|
+
# regarded as the value.
|
334
|
+
'ab=cd&ef=gh#ij=pq=12&rs=34#tu',
|
335
|
+
]
|
336
|
+
result = Bio::Command.make_cgi_params(array_of_string)
|
337
|
+
assert_equal(str, result)
|
338
|
+
end
|
339
|
+
|
340
|
+
def test_make_cgi_params_by_string
|
341
|
+
string = "type1=bp&type2=bp&downstream=&upstream=&format=fasta&options=similarity&options=gene&action=export&_format=Text&output=txt&submit=Continue%20%3E%3E"
|
342
|
+
# In this case, only URI escaping is performed.
|
343
|
+
query = " type1=bp&type2=bp&downstream=&upstream=&format=fasta&options=similarity&options=gene&action=export&_format=Text&output=txt&submit=Continue >> "
|
344
|
+
result = Bio::Command.make_cgi_params(query)
|
345
|
+
assert_equal(string, result)
|
346
|
+
end
|
347
|
+
|
348
|
+
end
|
349
|
+
end
|
@@ -0,0 +1,96 @@
|
|
1
|
+
#
|
2
|
+
# test/unit/bio/test_db.rb - Unit test for Bio::DB
|
3
|
+
#
|
4
|
+
# Copyright:: Copyright (C) 2005 Mitsuteru Nakao <n@bioruby.org>
|
5
|
+
# License:: The Ruby License
|
6
|
+
#
|
7
|
+
# $Id: test_db.rb,v 1.4 2007/04/05 23:35:42 trevor Exp $
|
8
|
+
#
|
9
|
+
|
10
|
+
require 'pathname'
|
11
|
+
libpath = Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 3, 'lib')).cleanpath.to_s
|
12
|
+
$:.unshift(libpath) unless $:.include?(libpath)
|
13
|
+
|
14
|
+
require 'test/unit'
|
15
|
+
require 'bio/db'
|
16
|
+
|
17
|
+
module Bio
|
18
|
+
class TestDB < Test::Unit::TestCase
|
19
|
+
def setup
|
20
|
+
|
21
|
+
@obj = Bio::DB.new
|
22
|
+
@obj.instance_eval { @orig = {"TAG" => "TAG value1\n value2"} }
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_open
|
26
|
+
assert(Bio::DB.respond_to?(:open))
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_entry_id
|
30
|
+
assert_raises(NotImplementedError) { @obj.entry_id }
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_tags
|
34
|
+
assert_equal(["TAG"], @obj.tags)
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_exists
|
38
|
+
assert_equal(true, @obj.exists?("TAG"))
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_get
|
42
|
+
assert_equal("TAG value1\n value2", @obj.get("TAG"))
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_fetch
|
46
|
+
assert(@obj.fetch("TAG"))
|
47
|
+
assert(@obj.fetch("TAG", 1))
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
|
52
|
+
class TestNCBIDB < Test::Unit::TestCase
|
53
|
+
def setup
|
54
|
+
entry =<<END
|
55
|
+
LOCUS locus
|
56
|
+
END
|
57
|
+
@obj = Bio::NCBIDB.new(entry, 10)
|
58
|
+
end
|
59
|
+
|
60
|
+
def test_fetch
|
61
|
+
assert_equal('locus', @obj.fetch("LOCUS"))
|
62
|
+
end
|
63
|
+
|
64
|
+
def test_p_toptag2array
|
65
|
+
end
|
66
|
+
|
67
|
+
def test_p_subtag2array
|
68
|
+
end
|
69
|
+
|
70
|
+
def test_p_entry2hash
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
# class TestKEGGDB < Test::Unit::TestCase
|
75
|
+
# end
|
76
|
+
|
77
|
+
class TestEMBLDB < Test::Unit::TestCase
|
78
|
+
def setup
|
79
|
+
@entry =<<END
|
80
|
+
ID id
|
81
|
+
XX
|
82
|
+
CC cc1
|
83
|
+
CC cc2
|
84
|
+
END
|
85
|
+
@obj = Bio::EMBLDB.new(@entry, 2)
|
86
|
+
end
|
87
|
+
|
88
|
+
def test_fetch
|
89
|
+
assert_equal('id', @obj.fetch("ID"))
|
90
|
+
assert_equal('cc1 cc2', @obj.fetch("CC"))
|
91
|
+
end
|
92
|
+
|
93
|
+
def test_p_entry2hash
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
@@ -0,0 +1,144 @@
|
|
1
|
+
#
|
2
|
+
# test/unit/bio/test_feature.rb - Unit test for Features/Feature classes
|
3
|
+
#
|
4
|
+
# Copyright:: Copyright (C) 2005
|
5
|
+
# Mitsuteru Nakao <n@bioruby.org>
|
6
|
+
# License:: The Ruby License
|
7
|
+
#
|
8
|
+
# $Id: test_feature.rb,v 1.5.2.1 2008/05/08 05:38:01 ngoto Exp $
|
9
|
+
#
|
10
|
+
|
11
|
+
require 'pathname'
|
12
|
+
libpath = Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 3 , 'lib')).cleanpath.to_s
|
13
|
+
$:.unshift(libpath) unless $:.include?(libpath)
|
14
|
+
|
15
|
+
require 'test/unit'
|
16
|
+
require 'bio/feature'
|
17
|
+
require 'bio/compat/features'
|
18
|
+
|
19
|
+
|
20
|
+
module Bio
|
21
|
+
|
22
|
+
class TestQualifier < Test::Unit::TestCase
|
23
|
+
def setup
|
24
|
+
qualifier = 'gene'
|
25
|
+
value = 'CDS'
|
26
|
+
@obj = Bio::Feature::Qualifier.new(qualifier, value)
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_qualifier
|
30
|
+
assert_equal('gene', @obj.qualifier)
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_value
|
34
|
+
assert_equal('CDS', @obj.value)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
|
39
|
+
class TestFeature < Test::Unit::TestCase
|
40
|
+
def setup
|
41
|
+
@qualifier = Bio::Feature::Qualifier.new('organism', 'Arabidopsis thaliana')
|
42
|
+
feature = "source"
|
43
|
+
position = '1..615'
|
44
|
+
qualifiers = [@qualifier]
|
45
|
+
@obj = Bio::Feature.new(feature, position, qualifiers)
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_new
|
49
|
+
assert(Bio::Feature.new)
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_feature
|
53
|
+
assert_equal("source", @obj.feature)
|
54
|
+
end
|
55
|
+
|
56
|
+
def test_position
|
57
|
+
assert_equal('1..615', @obj.position)
|
58
|
+
end
|
59
|
+
|
60
|
+
def test_qualifiers
|
61
|
+
assert_equal([@qualifier], @obj.qualifiers)
|
62
|
+
end
|
63
|
+
|
64
|
+
def test_locations
|
65
|
+
assert_equal(1, @obj.locations.first.from)
|
66
|
+
assert_equal(615, @obj.locations.first.to)
|
67
|
+
end
|
68
|
+
|
69
|
+
def test_append_nil
|
70
|
+
assert(@obj.append(nil))
|
71
|
+
assert_equal(1, @obj.qualifiers.size)
|
72
|
+
end
|
73
|
+
|
74
|
+
def test_append
|
75
|
+
qualifier = Bio::Feature::Qualifier.new('db_xref', 'taxon:3702')
|
76
|
+
assert(@obj.append(qualifier))
|
77
|
+
assert_equal('db_xref', @obj.qualifiers.last.qualifier)
|
78
|
+
end
|
79
|
+
|
80
|
+
def test_each
|
81
|
+
@obj.each do |qua|
|
82
|
+
assert_equal('Arabidopsis thaliana', qua.value)
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
def test_assoc
|
87
|
+
@obj.append(Bio::Feature::Qualifier.new("organism", "Arabidopsis thaliana"))
|
88
|
+
assert_equal({"organism" => "Arabidopsis thaliana"}, @obj.assoc)
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
class NullStderr
|
93
|
+
def initialize
|
94
|
+
@log = []
|
95
|
+
end
|
96
|
+
|
97
|
+
def write(*arg)
|
98
|
+
#p arg
|
99
|
+
@log.push([ :write, *arg ])
|
100
|
+
nil
|
101
|
+
end
|
102
|
+
|
103
|
+
def method_missing(*arg)
|
104
|
+
#p arg
|
105
|
+
@log.push arg
|
106
|
+
nil
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
class TestFeatures < Test::Unit::TestCase
|
111
|
+
def setup
|
112
|
+
# To suppress warning messages, $stderr is replaced by dummy object.
|
113
|
+
@stderr_orig = $stderr
|
114
|
+
$stderr = NullStderr.new
|
115
|
+
|
116
|
+
@obj = Bio::Features.new([Bio::Feature.new('gene', '1..615', [])])
|
117
|
+
end
|
118
|
+
|
119
|
+
def teardown
|
120
|
+
# bring back $stderr
|
121
|
+
$stderr = @stderr_orig
|
122
|
+
end
|
123
|
+
|
124
|
+
def test_features
|
125
|
+
assert_equal(1, @obj.features.size)
|
126
|
+
end
|
127
|
+
|
128
|
+
def test_append
|
129
|
+
assert(@obj.append(Bio::Feature.new('gene', '1..615', [])))
|
130
|
+
assert_equal(2, @obj.features.size)
|
131
|
+
end
|
132
|
+
|
133
|
+
def test_each
|
134
|
+
@obj.each do |feature|
|
135
|
+
assert_equal('gene', feature.feature)
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
def test_arg # def [](*arg)
|
140
|
+
assert_equal('gene', @obj[0].feature)
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
end
|