bio 1.2.1 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (259) hide show
  1. data/ChangeLog +3421 -0
  2. data/KNOWN_ISSUES.rdoc +88 -0
  3. data/README.rdoc +252 -0
  4. data/README_DEV.rdoc +285 -0
  5. data/Rakefile +143 -0
  6. data/bin/bioruby +0 -0
  7. data/bin/br_biofetch.rb +0 -0
  8. data/bin/br_bioflat.rb +12 -1
  9. data/bin/br_biogetseq.rb +0 -0
  10. data/bin/br_pmfetch.rb +4 -3
  11. data/bioruby.gemspec +477 -0
  12. data/bioruby.gemspec.erb +117 -0
  13. data/doc/Changes-0.7.rd +7 -0
  14. data/doc/Changes-1.3.rdoc +239 -0
  15. data/doc/Tutorial.rd +296 -184
  16. data/doc/Tutorial.rd.html +1031 -0
  17. data/doc/Tutorial.rd.ja +111 -45
  18. data/doc/Tutorial.rd.ja.html +2225 -0
  19. data/doc/bioruby.css +281 -0
  20. data/extconf.rb +2 -0
  21. data/lib/bio.rb +29 -4
  22. data/lib/bio/appl/blast.rb +306 -121
  23. data/lib/bio/appl/blast/ddbj.rb +142 -0
  24. data/lib/bio/appl/blast/format0.rb +35 -25
  25. data/lib/bio/appl/blast/format8.rb +2 -2
  26. data/lib/bio/appl/blast/genomenet.rb +263 -0
  27. data/lib/bio/appl/blast/ncbioptions.rb +220 -0
  28. data/lib/bio/appl/blast/remote.rb +106 -0
  29. data/lib/bio/appl/blast/report.rb +260 -9
  30. data/lib/bio/appl/blast/rexml.rb +12 -5
  31. data/lib/bio/appl/blast/rpsblast.rb +277 -0
  32. data/lib/bio/appl/blast/wublast.rb +133 -12
  33. data/lib/bio/appl/blast/xmlparser.rb +35 -18
  34. data/lib/bio/appl/blat/report.rb +46 -5
  35. data/lib/bio/appl/emboss.rb +62 -13
  36. data/lib/bio/appl/fasta.rb +9 -11
  37. data/lib/bio/appl/genscan/report.rb +3 -3
  38. data/lib/bio/appl/hmmer.rb +1 -1
  39. data/lib/bio/appl/hmmer/report.rb +10 -10
  40. data/lib/bio/appl/paml/baseml.rb +95 -0
  41. data/lib/bio/appl/paml/baseml/report.rb +32 -0
  42. data/lib/bio/appl/paml/codeml.rb +242 -0
  43. data/lib/bio/appl/paml/codeml/rates.rb +67 -0
  44. data/lib/bio/appl/paml/codeml/report.rb +67 -0
  45. data/lib/bio/appl/paml/common.rb +348 -0
  46. data/lib/bio/appl/paml/common_report.rb +38 -0
  47. data/lib/bio/appl/paml/yn00.rb +103 -0
  48. data/lib/bio/appl/paml/yn00/report.rb +32 -0
  49. data/lib/bio/appl/psort.rb +2 -2
  50. data/lib/bio/appl/pts1.rb +5 -5
  51. data/lib/bio/appl/tmhmm/report.rb +10 -1
  52. data/lib/bio/command.rb +297 -41
  53. data/lib/bio/compat/features.rb +157 -0
  54. data/lib/bio/compat/references.rb +128 -0
  55. data/lib/bio/db/biosql/biosql_to_biosequence.rb +67 -0
  56. data/lib/bio/db/biosql/sequence.rb +508 -0
  57. data/lib/bio/db/embl/common.rb +28 -12
  58. data/lib/bio/db/embl/embl.rb +107 -9
  59. data/lib/bio/db/embl/embl_to_biosequence.rb +85 -0
  60. data/lib/bio/db/embl/format_embl.rb +190 -0
  61. data/lib/bio/db/embl/sptr.rb +15 -16
  62. data/lib/bio/db/fantom.rb +6 -8
  63. data/lib/bio/db/fasta.rb +10 -507
  64. data/lib/bio/db/fasta/defline.rb +532 -0
  65. data/lib/bio/db/fasta/fasta_to_biosequence.rb +63 -0
  66. data/lib/bio/db/fasta/format_fasta.rb +97 -0
  67. data/lib/bio/db/genbank/common.rb +25 -8
  68. data/lib/bio/db/genbank/format_genbank.rb +187 -0
  69. data/lib/bio/db/genbank/genbank.rb +36 -1
  70. data/lib/bio/db/genbank/genbank_to_biosequence.rb +86 -0
  71. data/lib/bio/db/gff.rb +1791 -119
  72. data/lib/bio/db/kegg/glycan.rb +2 -6
  73. data/lib/bio/db/lasergene.rb +3 -3
  74. data/lib/bio/db/medline.rb +4 -1
  75. data/lib/bio/db/newick.rb +10 -10
  76. data/lib/bio/db/pdb/chain.rb +6 -2
  77. data/lib/bio/db/pdb/pdb.rb +12 -3
  78. data/lib/bio/db/rebase.rb +7 -8
  79. data/lib/bio/db/soft.rb +3 -3
  80. data/lib/bio/feature.rb +1 -88
  81. data/lib/bio/io/biosql/biodatabase.rb +64 -0
  82. data/lib/bio/io/biosql/bioentry.rb +29 -0
  83. data/lib/bio/io/biosql/bioentry_dbxref.rb +11 -0
  84. data/lib/bio/io/biosql/bioentry_path.rb +12 -0
  85. data/lib/bio/io/biosql/bioentry_qualifier_value.rb +10 -0
  86. data/lib/bio/io/biosql/bioentry_reference.rb +10 -0
  87. data/lib/bio/io/biosql/bioentry_relationship.rb +10 -0
  88. data/lib/bio/io/biosql/biosequence.rb +11 -0
  89. data/lib/bio/io/biosql/comment.rb +7 -0
  90. data/lib/bio/io/biosql/config/database.yml +20 -0
  91. data/lib/bio/io/biosql/dbxref.rb +13 -0
  92. data/lib/bio/io/biosql/dbxref_qualifier_value.rb +12 -0
  93. data/lib/bio/io/biosql/location.rb +32 -0
  94. data/lib/bio/io/biosql/location_qualifier_value.rb +11 -0
  95. data/lib/bio/io/biosql/ontology.rb +10 -0
  96. data/lib/bio/io/biosql/reference.rb +9 -0
  97. data/lib/bio/io/biosql/seqfeature.rb +32 -0
  98. data/lib/bio/io/biosql/seqfeature_dbxref.rb +11 -0
  99. data/lib/bio/io/biosql/seqfeature_path.rb +11 -0
  100. data/lib/bio/io/biosql/seqfeature_qualifier_value.rb +20 -0
  101. data/lib/bio/io/biosql/seqfeature_relationship.rb +11 -0
  102. data/lib/bio/io/biosql/taxon.rb +12 -0
  103. data/lib/bio/io/biosql/taxon_name.rb +9 -0
  104. data/lib/bio/io/biosql/term.rb +27 -0
  105. data/lib/bio/io/biosql/term_dbxref.rb +11 -0
  106. data/lib/bio/io/biosql/term_path.rb +12 -0
  107. data/lib/bio/io/biosql/term_relationship.rb +13 -0
  108. data/lib/bio/io/biosql/term_relationship_term.rb +11 -0
  109. data/lib/bio/io/biosql/term_synonym.rb +10 -0
  110. data/lib/bio/io/das.rb +7 -7
  111. data/lib/bio/io/ddbjxml.rb +57 -0
  112. data/lib/bio/io/ensembl.rb +2 -2
  113. data/lib/bio/io/fetch.rb +28 -14
  114. data/lib/bio/io/flatfile.rb +17 -853
  115. data/lib/bio/io/flatfile/autodetection.rb +545 -0
  116. data/lib/bio/io/flatfile/buffer.rb +237 -0
  117. data/lib/bio/io/flatfile/index.rb +17 -7
  118. data/lib/bio/io/flatfile/indexer.rb +30 -12
  119. data/lib/bio/io/flatfile/splitter.rb +297 -0
  120. data/lib/bio/io/hinv.rb +442 -0
  121. data/lib/bio/io/keggapi.rb +2 -2
  122. data/lib/bio/io/ncbirest.rb +733 -0
  123. data/lib/bio/io/pubmed.rb +34 -80
  124. data/lib/bio/io/registry.rb +2 -2
  125. data/lib/bio/io/sql.rb +178 -357
  126. data/lib/bio/io/togows.rb +458 -0
  127. data/lib/bio/location.rb +106 -11
  128. data/lib/bio/pathway.rb +120 -14
  129. data/lib/bio/reference.rb +115 -101
  130. data/lib/bio/sequence.rb +164 -183
  131. data/lib/bio/sequence/adapter.rb +108 -0
  132. data/lib/bio/sequence/common.rb +22 -45
  133. data/lib/bio/sequence/compat.rb +2 -2
  134. data/lib/bio/sequence/dblink.rb +54 -0
  135. data/lib/bio/sequence/format.rb +254 -77
  136. data/lib/bio/sequence/format_raw.rb +23 -0
  137. data/lib/bio/shell.rb +3 -1
  138. data/lib/bio/shell/core.rb +2 -2
  139. data/lib/bio/shell/plugin/entry.rb +33 -4
  140. data/lib/bio/shell/plugin/ncbirest.rb +64 -0
  141. data/lib/bio/shell/plugin/togows.rb +40 -0
  142. data/lib/bio/shell/rails/vendor/plugins/{generators → bioruby/generators}/bioruby/bioruby_generator.rb +0 -0
  143. data/lib/bio/shell/rails/vendor/plugins/{generators → bioruby/generators}/bioruby/templates/_classes.rhtml +0 -0
  144. data/lib/bio/shell/rails/vendor/plugins/{generators → bioruby/generators}/bioruby/templates/_log.rhtml +0 -0
  145. data/lib/bio/shell/rails/vendor/plugins/{generators → bioruby/generators}/bioruby/templates/_methods.rhtml +0 -0
  146. data/lib/bio/shell/rails/vendor/plugins/{generators → bioruby/generators}/bioruby/templates/_modules.rhtml +0 -0
  147. data/lib/bio/shell/rails/vendor/plugins/{generators → bioruby/generators}/bioruby/templates/_variables.rhtml +0 -0
  148. data/lib/bio/shell/rails/vendor/plugins/{generators → bioruby/generators}/bioruby/templates/bioruby-bg.gif +0 -0
  149. data/lib/bio/shell/rails/vendor/plugins/{generators → bioruby/generators}/bioruby/templates/bioruby-gem.png +0 -0
  150. data/lib/bio/shell/rails/vendor/plugins/{generators → bioruby/generators}/bioruby/templates/bioruby-link.gif +0 -0
  151. data/lib/bio/shell/rails/vendor/plugins/{generators → bioruby/generators}/bioruby/templates/bioruby.css +0 -0
  152. data/lib/bio/shell/rails/vendor/plugins/{generators → bioruby/generators}/bioruby/templates/bioruby.rhtml +0 -0
  153. data/lib/bio/shell/rails/vendor/plugins/{generators → bioruby/generators}/bioruby/templates/bioruby_controller.rb +0 -0
  154. data/lib/bio/shell/rails/vendor/plugins/{generators → bioruby/generators}/bioruby/templates/bioruby_helper.rb +0 -0
  155. data/lib/bio/shell/rails/vendor/plugins/{generators → bioruby/generators}/bioruby/templates/commands.rhtml +0 -0
  156. data/lib/bio/shell/rails/vendor/plugins/{generators → bioruby/generators}/bioruby/templates/history.rhtml +0 -0
  157. data/lib/bio/shell/rails/vendor/plugins/{generators → bioruby/generators}/bioruby/templates/index.rhtml +0 -0
  158. data/lib/bio/shell/rails/vendor/plugins/{generators → bioruby/generators}/bioruby/templates/spinner.gif +0 -0
  159. data/lib/bio/tree.rb +4 -2
  160. data/lib/bio/util/color_scheme.rb +2 -2
  161. data/lib/bio/util/contingency_table.rb +2 -2
  162. data/lib/bio/util/restriction_enzyme.rb +2 -2
  163. data/lib/bio/util/restriction_enzyme/single_strand.rb +6 -5
  164. data/lib/bio/version.rb +25 -0
  165. data/rdoc.zsh +8 -0
  166. data/sample/any2fasta.rb +0 -0
  167. data/sample/biofetch.rb +0 -0
  168. data/sample/dbget +0 -0
  169. data/sample/demo_sequence.rb +158 -0
  170. data/sample/enzymes.rb +0 -0
  171. data/sample/fasta2tab.rb +0 -0
  172. data/sample/fastagrep.rb +72 -0
  173. data/sample/fastasort.rb +54 -0
  174. data/sample/fsplit.rb +0 -0
  175. data/sample/gb2fasta.rb +2 -3
  176. data/sample/gb2tab.rb +0 -0
  177. data/sample/gbtab2mysql.rb +0 -0
  178. data/sample/genes2nuc.rb +0 -0
  179. data/sample/genes2pep.rb +0 -0
  180. data/sample/genes2tab.rb +0 -0
  181. data/sample/genome2rb.rb +0 -0
  182. data/sample/genome2tab.rb +0 -0
  183. data/sample/goslim.rb +0 -0
  184. data/sample/gt2fasta.rb +0 -0
  185. data/sample/na2aa.rb +34 -0
  186. data/sample/pmfetch.rb +0 -0
  187. data/sample/pmsearch.rb +0 -0
  188. data/sample/ssearch2tab.rb +0 -0
  189. data/sample/tfastx2tab.rb +0 -0
  190. data/sample/vs-genes.rb +0 -0
  191. data/setup.rb +1596 -0
  192. data/test/data/blast/blastp-multi.m7 +188 -0
  193. data/test/data/command/echoarg2.bat +1 -0
  194. data/test/data/paml/codeml/control_file.txt +30 -0
  195. data/test/data/paml/codeml/output.txt +78 -0
  196. data/test/data/paml/codeml/rates +217 -0
  197. data/test/data/rpsblast/misc.rpsblast +193 -0
  198. data/test/data/soft/GDS100_partial.soft +0 -0
  199. data/test/data/soft/GSE3457_family_partial.soft +0 -0
  200. data/test/functional/bio/appl/test_pts1.rb +115 -0
  201. data/test/functional/bio/io/test_ensembl.rb +123 -80
  202. data/test/functional/bio/io/test_togows.rb +267 -0
  203. data/test/functional/bio/sequence/test_output_embl.rb +51 -0
  204. data/test/functional/bio/test_command.rb +301 -0
  205. data/test/runner.rb +17 -1
  206. data/test/unit/bio/appl/blast/test_ncbioptions.rb +112 -0
  207. data/test/unit/bio/appl/blast/test_report.rb +753 -35
  208. data/test/unit/bio/appl/blast/test_rpsblast.rb +398 -0
  209. data/test/unit/bio/appl/paml/codeml/test_rates.rb +45 -0
  210. data/test/unit/bio/appl/paml/codeml/test_report.rb +45 -0
  211. data/test/unit/bio/appl/paml/test_codeml.rb +174 -0
  212. data/test/unit/bio/appl/test_blast.rb +135 -4
  213. data/test/unit/bio/appl/test_fasta.rb +2 -2
  214. data/test/unit/bio/appl/test_pts1.rb +1 -64
  215. data/test/unit/bio/db/embl/test_common.rb +15 -15
  216. data/test/unit/bio/db/embl/test_embl.rb +4 -4
  217. data/test/unit/bio/db/embl/test_embl_rel89.rb +5 -5
  218. data/test/unit/bio/db/embl/test_embl_to_bioseq.rb +203 -0
  219. data/test/unit/bio/db/embl/test_sptr.rb +38 -1
  220. data/test/unit/bio/db/pdb/test_pdb.rb +2 -2
  221. data/test/unit/bio/db/test_gff.rb +1151 -25
  222. data/test/unit/bio/db/test_medline.rb +127 -0
  223. data/test/unit/bio/db/test_nexus.rb +5 -1
  224. data/test/unit/bio/db/test_prosite.rb +4 -4
  225. data/test/unit/bio/io/flatfile/test_autodetection.rb +375 -0
  226. data/test/unit/bio/io/flatfile/test_buffer.rb +251 -0
  227. data/test/unit/bio/io/flatfile/test_splitter.rb +369 -0
  228. data/test/unit/bio/io/test_ddbjxml.rb +8 -3
  229. data/test/unit/bio/io/test_fastacmd.rb +5 -5
  230. data/test/unit/bio/io/test_flatfile.rb +357 -106
  231. data/test/unit/bio/io/test_soapwsdl.rb +2 -2
  232. data/test/unit/bio/io/test_togows.rb +161 -0
  233. data/test/unit/bio/sequence/test_common.rb +210 -11
  234. data/test/unit/bio/sequence/test_compat.rb +3 -3
  235. data/test/unit/bio/sequence/test_dblink.rb +58 -0
  236. data/test/unit/bio/sequence/test_na.rb +2 -2
  237. data/test/unit/bio/test_command.rb +111 -50
  238. data/test/unit/bio/test_feature.rb +29 -1
  239. data/test/unit/bio/test_location.rb +566 -6
  240. data/test/unit/bio/test_pathway.rb +91 -65
  241. data/test/unit/bio/test_reference.rb +67 -13
  242. data/test/unit/bio/util/restriction_enzyme/analysis/test_calculated_cuts.rb +3 -3
  243. data/test/unit/bio/util/restriction_enzyme/analysis/test_cut_ranges.rb +3 -3
  244. data/test/unit/bio/util/restriction_enzyme/analysis/test_sequence_range.rb +3 -3
  245. data/test/unit/bio/util/restriction_enzyme/double_stranded/test_aligned_strands.rb +4 -3
  246. data/test/unit/bio/util/restriction_enzyme/double_stranded/test_cut_location_pair.rb +3 -3
  247. data/test/unit/bio/util/restriction_enzyme/double_stranded/test_cut_location_pair_in_enzyme_notation.rb +3 -3
  248. data/test/unit/bio/util/restriction_enzyme/double_stranded/test_cut_locations.rb +3 -3
  249. data/test/unit/bio/util/restriction_enzyme/double_stranded/test_cut_locations_in_enzyme_notation.rb +3 -3
  250. data/test/unit/bio/util/restriction_enzyme/single_strand/test_cut_locations_in_enzyme_notation.rb +3 -3
  251. data/test/unit/bio/util/restriction_enzyme/test_analysis.rb +3 -3
  252. data/test/unit/bio/util/restriction_enzyme/test_cut_symbol.rb +4 -4
  253. data/test/unit/bio/util/restriction_enzyme/test_double_stranded.rb +3 -3
  254. data/test/unit/bio/util/restriction_enzyme/test_single_strand.rb +3 -3
  255. data/test/unit/bio/util/restriction_enzyme/test_single_strand_complement.rb +3 -3
  256. data/test/unit/bio/util/restriction_enzyme/test_string_formatting.rb +3 -3
  257. data/test/unit/bio/util/test_restriction_enzyme.rb +3 -3
  258. metadata +202 -167
  259. data/test/unit/bio/appl/blast/test_xmlparser.rb +0 -388
@@ -0,0 +1,23 @@
1
+ #
2
+ # = bio/sequence/format_raw.rb - Raw sequence formatter
3
+ #
4
+ # Copyright:: Copyright (C) 2008 Naohisa Goto <ng@bioruby.org>
5
+ # License:: The Ruby License
6
+ #
7
+ # $Id: format_raw.rb,v 1.1.2.1 2008/03/04 11:28:46 ngoto Exp $
8
+ #
9
+
10
+ require 'bio/sequence/format'
11
+
12
+ module Bio::Sequence::Format::Formatter
13
+
14
+ # Raw sequence output formatter class
15
+ class Raw < Bio::Sequence::Format::FormatterBase
16
+
17
+ # output raw sequence data
18
+ def output
19
+ "#{@sequence.seq}"
20
+ end
21
+ end #class Raw
22
+
23
+ end #module Bio::Sequence::Format::Formatter
@@ -5,7 +5,7 @@
5
5
  # Toshiaki Katayama <k@bioruby.org>
6
6
  # License:: The Ruby License
7
7
  #
8
- # $Id: shell.rb,v 1.20 2007/07/09 11:17:09 k Exp $
8
+ # $Id:$
9
9
  #
10
10
 
11
11
  require 'bio'
@@ -36,6 +36,8 @@ module Bio::Shell
36
36
  require 'bio/shell/plugin/emboss'
37
37
  require 'bio/shell/plugin/blast'
38
38
  require 'bio/shell/plugin/psort'
39
+ require 'bio/shell/plugin/ncbirest'
40
+ require 'bio/shell/plugin/togows'
39
41
 
40
42
  extend Ghost
41
43
 
@@ -5,7 +5,7 @@
5
5
  # Toshiaki Katayama <k@bioruby.org>
6
6
  # License:: The Ruby License
7
7
  #
8
- # $Id: core.rb,v 1.27 2007/06/28 11:21:40 k Exp $
8
+ # $Id:$
9
9
  #
10
10
 
11
11
  module Bio::Shell::Core
@@ -556,7 +556,7 @@ module Bio::Shell::Ghost
556
556
  end
557
557
  STDERR.puts
558
558
  STDERR.puts
559
- STDERR.print " Version : BioRuby #{Bio::BIORUBY_VERSION.join(".")}"
559
+ STDERR.print " Version : BioRuby #{Bio::BIORUBY_VERSION_ID}"
560
560
  STDERR.print " / Ruby #{RUBY_VERSION}"
561
561
  STDERR.puts
562
562
  STDERR.puts
@@ -5,7 +5,7 @@
5
5
  # Toshiaki Katayama <k@bioruby.org>
6
6
  # License:: The Ruby License
7
7
  #
8
- # $Id: entry.rb,v 1.10 2007/04/05 23:35:41 trevor Exp $
8
+ # $Id:$
9
9
  #
10
10
 
11
11
  module Bio::Shell
@@ -86,10 +86,39 @@ module Bio::Shell
86
86
  puts "Retrieving entry from EMBOSS (#{arg})"
87
87
  entry = str
88
88
 
89
- # KEGG API at http://www.genome.jp/kegg/soap/
89
+ # via Internet
90
90
  else
91
- puts "Retrieving entry from KEGG API (#{arg})"
92
- entry = bget(arg)
91
+ case db.to_s.downcase
92
+ when 'genbank', 'gb', 'nuccore', 'indsc'
93
+ # NCBI
94
+ puts "Retrieving entry from NCBI eUtils"
95
+ entry = efetch(entry_id)
96
+
97
+ when 'embl', 'emb', /\Aembl/, /\Auni/, 'sp', /\Aensembl/
98
+ # EBI
99
+ puts "Retrieving entry from EBI Dbfetch"
100
+ db = 'embl' if db == 'emb'
101
+ db = 'uniprotkb' if db == 'uniprot' or db == 'sp'
102
+ entry = biofetch(db, entry_id)
103
+
104
+ when 'ddbj', 'dbj', 'dad'
105
+ # TogoWS REST
106
+ puts "Retrieving entry from TogoWS"
107
+ db = 'ddbj' if db == 'dbj'
108
+ entry = togowsentry(db, entry_id)
109
+
110
+ else
111
+ togodblist = Bio::TogoWS::REST.entry_database_list rescue []
112
+ if togodblist.include?(db) then
113
+ # TogoWS REST
114
+ puts "Retrieving entry from TogoWS"
115
+ entry = togowsentry(db, entry_id)
116
+ else
117
+ # KEGG API at http://www.genome.jp/kegg/soap/
118
+ puts "Retrieving entry from KEGG API (#{arg})"
119
+ entry = bget(arg)
120
+ end
121
+ end
93
122
  end
94
123
  end
95
124
 
@@ -0,0 +1,64 @@
1
+ #
2
+ # = bio/shell/plugin/ncbirest.rb - plugin for NCBI eUtils
3
+ #
4
+ # Copyright:: Copyright (C) 2009
5
+ # Naohisa Goto <ng@bioruby.org>
6
+ # License:: The Ruby License
7
+ #
8
+ # $Id:$
9
+ #
10
+
11
+ module Bio::Shell
12
+
13
+ private
14
+
15
+ # NCBI eUtils EFetch service.
16
+ #
17
+ # With 1 argument, it gets sequence(s) by using
18
+ # Bio::NCBI::REST::EFetch.sequence.
19
+ # Nucleotide or protein database is automatically selected for each id.
20
+ #
21
+ # Example:
22
+ # efetch('AF237819')
23
+ #
24
+ # With two or more arguments, and when the 2nd argument is Symbol,
25
+ # it calls the corresponding Bio::NCBI::REST::EFetch class method.
26
+ #
27
+ # Example:
28
+ # efetch('13054692', :pubmed)
29
+ # # the same as Bio::NCBI::REST::EFetch.pubmed('13054692')
30
+ #
31
+ # Otherwise, it acts the same as Bio::NCBI::REST.efetch.
32
+ def efetch(ids, *arg)
33
+ if arg.empty? then
34
+ Bio::NCBI::REST::EFetch.sequence(ids)
35
+ elsif arg[0].kind_of?(Symbol)
36
+ meth = arg[0]
37
+ case meth.to_s
38
+ when /\A(journal|omim|pmc|pubmed|sequence|taxonomy)\z/
39
+ Bio::NCBI::REST::EFetch.__send__(meth, ids, *(arg[1..-1]))
40
+ else
41
+ nil
42
+ end
43
+ else
44
+ Bio::NCBI::REST.efetch(ids, *arg)
45
+ end
46
+ end
47
+
48
+ # NCBI eUtils EInfo
49
+ def einfo
50
+ Bio::NCBI::REST.einfo
51
+ end
52
+
53
+ # NCBI eUtils ESearch
54
+ def esearch(str, *arg)
55
+ Bio::NCBI::REST.esearch(str, *arg)
56
+ end
57
+
58
+ # Same as Bio::NCBI::REST.esearch_count
59
+ def esearch_count(str, *arg)
60
+ Bio::NCBI::REST.esearch_count(str, *arg)
61
+ end
62
+
63
+ end
64
+
@@ -0,0 +1,40 @@
1
+ #
2
+ # = bio/shell/plugin/togows.rb - plugin for TogoWS REST service
3
+ #
4
+ # Copyright:: Copyright (C) 2009
5
+ # Naohisa Goto <ng@bioruby.org>
6
+ # License:: The Ruby License
7
+ #
8
+ # $Id:$
9
+ #
10
+
11
+ module Bio::Shell
12
+
13
+ private
14
+
15
+ # Shortcut method to fetch entry(entries) by using TogoWS REST "entry"
16
+ # service. Multiple databases may be used.
17
+ #
18
+ def togows(ids, *arg)
19
+ Bio::TogoWS::REST.retrieve(ids, *arg)
20
+ end
21
+
22
+ # Fetches entry(entries) by using TogoWS REST "entry" service.
23
+ # Same as Bio::TogoWS::REST.entry(database, ids, *arg).
24
+ def togowsentry(database, ids, *arg)
25
+ Bio::TogoWS::REST.entry(database, ids, *arg)
26
+ end
27
+
28
+ # Database search by using TogoWS REST "search" service.
29
+ # Same as Bio::TogoWS::REST.search(database, term, *arg).
30
+ def togowssearch(database, term, *arg)
31
+ Bio::TogoWS::REST.search(database, term, *arg)
32
+ end
33
+
34
+ # Data format conversion by using TogoWS REST "convert" service.
35
+ # Same as Bio::TogoWS::REST.convert(data, format_from, format_to).
36
+ def togowsconvert(data, format_from, format_to)
37
+ Bio::TogoWS::REST.convert(data, format_from, format_to)
38
+ end
39
+
40
+ end
@@ -5,7 +5,7 @@
5
5
  # Naohisa Goto <ng@bioruby.org>
6
6
  # License:: The Ruby License
7
7
  #
8
- # $Id: tree.rb,v 1.8 2007/04/05 23:35:39 trevor Exp $
8
+ # $Id:$
9
9
  #
10
10
 
11
11
  require 'matrix'
@@ -176,7 +176,9 @@ module Bio
176
176
  else
177
177
  str = sprintf('(Node:%x', (self.__id__ << 1) & 0xffffffff)
178
178
  end
179
- str += " bootstrap=#{@bootstrap.inspect}" if @bootstrap
179
+ if defined?(@bootstrap) and @bootstrap then
180
+ str += " bootstrap=#{@bootstrap.inspect}"
181
+ end
180
182
  str += ")"
181
183
  str
182
184
  end
@@ -5,10 +5,10 @@
5
5
  # Copyright:: Copyright (c) 2005-2007 Midwinter Laboratories, LLC (http://midwinterlabs.com)
6
6
  # License:: The Ruby License
7
7
  #
8
- # $Id: color_scheme.rb,v 1.4 2007/04/05 23:35:41 trevor Exp $
8
+ # $Id:$
9
9
  #
10
10
 
11
- module Bio #:nodoc:
11
+ module Bio
12
12
 
13
13
  #
14
14
  # bio/util/color_scheme.rb - Popular color codings for nucleic and amino acids
@@ -5,10 +5,10 @@
5
5
  # Copyright:: Copyright (c) 2005-2007 Midwinter Laboratories, LLC (http://midwinterlabs.com)
6
6
  # License:: The Ruby License
7
7
  #
8
- # $Id: contingency_table.rb,v 1.7 2007/04/05 23:35:41 trevor Exp $
8
+ # $Id:$
9
9
  #
10
10
 
11
- module Bio #:nodoc:
11
+ module Bio
12
12
 
13
13
  #
14
14
  # bio/util/contingency_table.rb - Statistical contingency table analysis for aligned sequences
@@ -5,10 +5,10 @@
5
5
  # Copyright:: Copyright (c) 2005-2007 Midwinter Laboratories, LLC (http://midwinterlabs.com)
6
6
  # License:: The Ruby License
7
7
  #
8
- # $Id: restriction_enzyme.rb,v 1.16 2007/07/16 19:28:48 k Exp $
8
+ # $Id:$
9
9
  #
10
10
 
11
- module Bio #:nodoc:
11
+ module Bio
12
12
 
13
13
  autoload :REBASE, 'bio/db/rebase'
14
14
 
@@ -5,7 +5,7 @@
5
5
  # Copyright:: Copyright (c) 2005-2007 Midwinter Laboratories, LLC (http://midwinterlabs.com)
6
6
  # License:: The Ruby License
7
7
  #
8
- # $Id: single_strand.rb,v 1.7 2007/07/16 19:28:48 k Exp $
8
+ # $Id:$
9
9
  #
10
10
 
11
11
  require 'bio/util/restriction_enzyme'
@@ -133,7 +133,7 @@ class SingleStrand < Bio::Sequence::NA
133
133
 
134
134
  # Add one more 'n' if a cut is at the last position
135
135
  right = ( (@cut_locations_in_enzyme_notation.max >= @stripped.length) ? ('n' * (@cut_locations_in_enzyme_notation.max - @stripped.length + 1)) : '')
136
- [left, stripped, right].to_s
136
+ [left, stripped, right].join('')
137
137
  end
138
138
 
139
139
  # The sequence with 'n' pads, cut symbols, and spacing for alignment.
@@ -183,14 +183,15 @@ class SingleStrand < Bio::Sequence::NA
183
183
  def self.once(*ids)
184
184
  for id in ids
185
185
  module_eval <<-"end;"
186
- alias_method :__#{id.to_i}__, :#{id.to_s}
187
- private :__#{id.to_i}__
186
+ alias_method :__#{id.__id__}__, :#{id.to_s}
187
+ private :__#{id.__id__}__
188
188
  def #{id.to_s}(*args, &block)
189
- (@__#{id.to_i}__ ||= [__#{id.to_i}__(*args, &block)])[0]
189
+ (@__#{id.__id__}__ ||= [__#{id.__id__}__(*args, &block)])[0]
190
190
  end
191
191
  end;
192
192
  end
193
193
  end
194
+ private_class_method :once
194
195
 
195
196
  once :pattern, :with_cut_symbols, :with_spaces, :to_re
196
197
 
@@ -0,0 +1,25 @@
1
+ #
2
+ # = bio/version.rb - BioRuby version information
3
+ #
4
+ # Copyright:: Copyright (C) 2001-2009
5
+ # Toshiaki Katayama <k@bioruby.org>,
6
+ # Naohisa Goto <ng@bioruby.org>
7
+ # License:: The Ruby License
8
+ #
9
+
10
+ module Bio
11
+
12
+ # BioRuby version (Array containing Integer)
13
+ BIORUBY_VERSION = [1, 3, 0].extend(Comparable).freeze
14
+
15
+ # Extra version specifier (String or nil).
16
+ # Existance of the value indicates pre-release version or modified version.
17
+ BIORUBY_EXTRA_VERSION = nil
18
+
19
+ # Version identifier, including extra version string (String)
20
+ # Unlike BIORUBY_VERSION, it is not comparable.
21
+ BIORUBY_VERSION_ID =
22
+ (BIORUBY_VERSION.join('.') + BIORUBY_EXTRA_VERSION.to_s).freeze
23
+
24
+ end #module Bio
25
+
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env zsh
2
+
3
+ #DIAGRAM='--diagram'
4
+ WEBCVS='http://cvs.open-bio.org/cgi-bin/viewcvs/viewcvs.cgi'
5
+
6
+ rdoc ${DIAGRAM} --op rdoc --inline-source \
7
+ --webcvs "${WEBCVS}/bioruby/\%s?cvsroot=bioruby" \
8
+ bin/*(.) lib/**/*.rb [A-Z]*(.) doc/*rd etc/bioinformatics/*(.)
File without changes
File without changes
File without changes
@@ -0,0 +1,158 @@
1
+ #
2
+ # = sample/demo_sequence.rb - demonstration of sequence manipulation
3
+ #
4
+ # Copyright:: Copyright (C) 2000-2006
5
+ # Toshiaki Katayama <k@bioruby.org>,
6
+ # Mitsuteru C. Nakao <n@bioruby.org>
7
+ # License:: The Ruby License
8
+ #
9
+ # $Id:$
10
+ #
11
+ # == Description
12
+ #
13
+ # Demonstration of biological sequence manipulation.
14
+ #
15
+ # == Usage
16
+ #
17
+ # Simply run this script.
18
+ #
19
+ # $ ruby demo_sequence.rb
20
+ #
21
+ # == Development information
22
+ #
23
+ # The code was moved from lib/bio/sequence.rb.
24
+ #
25
+
26
+ require 'bio'
27
+
28
+ #if __FILE__ == $0
29
+
30
+ puts "== Test Bio::Sequence::NA.new"
31
+ p Bio::Sequence::NA.new('')
32
+ p na = Bio::Sequence::NA.new('atgcatgcATGCATGCAAAA')
33
+ p rna = Bio::Sequence::NA.new('augcaugcaugcaugcaaaa')
34
+
35
+ puts "\n== Test Bio::Sequence::AA.new"
36
+ p Bio::Sequence::AA.new('')
37
+ p aa = Bio::Sequence::AA.new('ACDEFGHIKLMNPQRSTVWYU')
38
+
39
+ puts "\n== Test Bio::Sequence#to_s"
40
+ p na.to_s
41
+ p aa.to_s
42
+
43
+ puts "\n== Test Bio::Sequence#subseq(2,6)"
44
+ p na
45
+ p na.subseq(2,6)
46
+
47
+ puts "\n== Test Bio::Sequence#[2,6]"
48
+ p na
49
+ p na[2,6]
50
+
51
+ puts "\n== Test Bio::Sequence#to_fasta('hoge', 8)"
52
+ puts na.to_fasta('hoge', 8)
53
+
54
+ puts "\n== Test Bio::Sequence#window_search(15)"
55
+ p na
56
+ na.window_search(15) {|x| p x}
57
+
58
+ puts "\n== Test Bio::Sequence#total({'a'=>0.1,'t'=>0.2,'g'=>0.3,'c'=>0.4})"
59
+ p na.total({'a'=>0.1,'t'=>0.2,'g'=>0.3,'c'=>0.4})
60
+
61
+ puts "\n== Test Bio::Sequence#composition"
62
+ p na
63
+ p na.composition
64
+ p rna
65
+ p rna.composition
66
+
67
+ puts "\n== Test Bio::Sequence::NA#splicing('complement(join(1..5,16..20))')"
68
+ p na
69
+ p na.splicing("complement(join(1..5,16..20))")
70
+ p rna
71
+ p rna.splicing("complement(join(1..5,16..20))")
72
+
73
+ puts "\n== Test Bio::Sequence::NA#complement"
74
+ p na.complement
75
+ p rna.complement
76
+ p Bio::Sequence::NA.new('tacgyrkmhdbvswn').complement
77
+ p Bio::Sequence::NA.new('uacgyrkmhdbvswn').complement
78
+
79
+ puts "\n== Test Bio::Sequence::NA#translate"
80
+ p na
81
+ p na.translate
82
+ p rna
83
+ p rna.translate
84
+
85
+ puts "\n== Test Bio::Sequence::NA#gc_percent"
86
+ p na.gc_percent
87
+ p rna.gc_percent
88
+
89
+ puts "\n== Test Bio::Sequence::NA#illegal_bases"
90
+ p na.illegal_bases
91
+ p Bio::Sequence::NA.new('tacgyrkmhdbvswn').illegal_bases
92
+ p Bio::Sequence::NA.new('abcdefghijklmnopqrstuvwxyz-!%#$@').illegal_bases
93
+
94
+ puts "\n== Test Bio::Sequence::NA#molecular_weight"
95
+ p na
96
+ p na.molecular_weight
97
+ p rna
98
+ p rna.molecular_weight
99
+
100
+ puts "\n== Test Bio::Sequence::NA#to_re"
101
+ p Bio::Sequence::NA.new('atgcrymkdhvbswn')
102
+ p Bio::Sequence::NA.new('atgcrymkdhvbswn').to_re
103
+ p Bio::Sequence::NA.new('augcrymkdhvbswn')
104
+ p Bio::Sequence::NA.new('augcrymkdhvbswn').to_re
105
+
106
+ puts "\n== Test Bio::Sequence::NA#names"
107
+ p na.names
108
+
109
+ puts "\n== Test Bio::Sequence::NA#pikachu"
110
+ p na.pikachu
111
+
112
+ puts "\n== Test Bio::Sequence::NA#randomize"
113
+ print "Orig : "; p na
114
+ print "Rand : "; p na.randomize
115
+ print "Rand : "; p na.randomize
116
+ print "Rand : "; p na.randomize.randomize
117
+ print "Block : "; na.randomize do |x| print x end; puts
118
+
119
+ print "Orig : "; p rna
120
+ print "Rand : "; p rna.randomize
121
+ print "Rand : "; p rna.randomize
122
+ print "Rand : "; p rna.randomize.randomize
123
+ print "Block : "; rna.randomize do |x| print x end; puts
124
+
125
+ puts "\n== Test Bio::Sequence::NA.randomize(counts)"
126
+ print "Count : "; p counts = {'a'=>10,'c'=>20,'g'=>30,'t'=>40}
127
+ print "Rand : "; p Bio::Sequence::NA.randomize(counts)
128
+ print "Count : "; p counts = {'a'=>10,'c'=>20,'g'=>30,'u'=>40}
129
+ print "Rand : "; p Bio::Sequence::NA.randomize(counts)
130
+ print "Block : "; Bio::Sequence::NA.randomize(counts) {|x| print x}; puts
131
+
132
+ puts "\n== Test Bio::Sequence::AA#codes"
133
+ p aa
134
+ p aa.codes
135
+
136
+ puts "\n== Test Bio::Sequence::AA#names"
137
+ p aa
138
+ p aa.names
139
+
140
+ puts "\n== Test Bio::Sequence::AA#molecular_weight"
141
+ p aa.subseq(1,20)
142
+ p aa.subseq(1,20).molecular_weight
143
+
144
+ puts "\n== Test Bio::Sequence::AA#randomize"
145
+ aaseq = 'MRVLKFGGTSVANAERFLRVADILESNARQGQVATVLSAPAKITNHLVAMIEKTISGQDA'
146
+ s = Bio::Sequence::AA.new(aaseq)
147
+ print "Orig : "; p s
148
+ print "Rand : "; p s.randomize
149
+ print "Rand : "; p s.randomize
150
+ print "Rand : "; p s.randomize.randomize
151
+ print "Block : "; s.randomize {|x| print x}; puts
152
+
153
+ puts "\n== Test Bio::Sequence::AA.randomize(counts)"
154
+ print "Count : "; p counts = s.composition
155
+ print "Rand : "; puts Bio::Sequence::AA.randomize(counts)
156
+ print "Block : "; Bio::Sequence::AA.randomize(counts) {|x| print x}; puts
157
+
158
+ #end