bio 1.2.1 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +3421 -0
- data/KNOWN_ISSUES.rdoc +88 -0
- data/README.rdoc +252 -0
- data/README_DEV.rdoc +285 -0
- data/Rakefile +143 -0
- data/bin/bioruby +0 -0
- data/bin/br_biofetch.rb +0 -0
- data/bin/br_bioflat.rb +12 -1
- data/bin/br_biogetseq.rb +0 -0
- data/bin/br_pmfetch.rb +4 -3
- data/bioruby.gemspec +477 -0
- data/bioruby.gemspec.erb +117 -0
- data/doc/Changes-0.7.rd +7 -0
- data/doc/Changes-1.3.rdoc +239 -0
- data/doc/Tutorial.rd +296 -184
- data/doc/Tutorial.rd.html +1031 -0
- data/doc/Tutorial.rd.ja +111 -45
- data/doc/Tutorial.rd.ja.html +2225 -0
- data/doc/bioruby.css +281 -0
- data/extconf.rb +2 -0
- data/lib/bio.rb +29 -4
- data/lib/bio/appl/blast.rb +306 -121
- data/lib/bio/appl/blast/ddbj.rb +142 -0
- data/lib/bio/appl/blast/format0.rb +35 -25
- data/lib/bio/appl/blast/format8.rb +2 -2
- 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 +106 -0
- data/lib/bio/appl/blast/report.rb +260 -9
- data/lib/bio/appl/blast/rexml.rb +12 -5
- data/lib/bio/appl/blast/rpsblast.rb +277 -0
- data/lib/bio/appl/blast/wublast.rb +133 -12
- data/lib/bio/appl/blast/xmlparser.rb +35 -18
- data/lib/bio/appl/blat/report.rb +46 -5
- data/lib/bio/appl/emboss.rb +62 -13
- data/lib/bio/appl/fasta.rb +9 -11
- data/lib/bio/appl/genscan/report.rb +3 -3
- data/lib/bio/appl/hmmer.rb +1 -1
- data/lib/bio/appl/hmmer/report.rb +10 -10
- 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/psort.rb +2 -2
- data/lib/bio/appl/pts1.rb +5 -5
- data/lib/bio/appl/tmhmm/report.rb +10 -1
- data/lib/bio/command.rb +297 -41
- data/lib/bio/compat/features.rb +157 -0
- data/lib/bio/compat/references.rb +128 -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 +28 -12
- data/lib/bio/db/embl/embl.rb +107 -9
- 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 +15 -16
- data/lib/bio/db/fantom.rb +6 -8
- data/lib/bio/db/fasta.rb +10 -507
- 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 +25 -8
- data/lib/bio/db/genbank/format_genbank.rb +187 -0
- data/lib/bio/db/genbank/genbank.rb +36 -1
- data/lib/bio/db/genbank/genbank_to_biosequence.rb +86 -0
- data/lib/bio/db/gff.rb +1791 -119
- data/lib/bio/db/kegg/glycan.rb +2 -6
- data/lib/bio/db/lasergene.rb +3 -3
- data/lib/bio/db/medline.rb +4 -1
- data/lib/bio/db/newick.rb +10 -10
- data/lib/bio/db/pdb/chain.rb +6 -2
- data/lib/bio/db/pdb/pdb.rb +12 -3
- data/lib/bio/db/rebase.rb +7 -8
- data/lib/bio/db/soft.rb +3 -3
- data/lib/bio/feature.rb +1 -88
- 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 +7 -7
- data/lib/bio/io/ddbjxml.rb +57 -0
- data/lib/bio/io/ensembl.rb +2 -2
- data/lib/bio/io/fetch.rb +28 -14
- data/lib/bio/io/flatfile.rb +17 -853
- data/lib/bio/io/flatfile/autodetection.rb +545 -0
- data/lib/bio/io/flatfile/buffer.rb +237 -0
- data/lib/bio/io/flatfile/index.rb +17 -7
- data/lib/bio/io/flatfile/indexer.rb +30 -12
- data/lib/bio/io/flatfile/splitter.rb +297 -0
- data/lib/bio/io/hinv.rb +442 -0
- data/lib/bio/io/keggapi.rb +2 -2
- data/lib/bio/io/ncbirest.rb +733 -0
- data/lib/bio/io/pubmed.rb +34 -80
- data/lib/bio/io/registry.rb +2 -2
- data/lib/bio/io/sql.rb +178 -357
- data/lib/bio/io/togows.rb +458 -0
- data/lib/bio/location.rb +106 -11
- data/lib/bio/pathway.rb +120 -14
- data/lib/bio/reference.rb +115 -101
- data/lib/bio/sequence.rb +164 -183
- data/lib/bio/sequence/adapter.rb +108 -0
- data/lib/bio/sequence/common.rb +22 -45
- data/lib/bio/sequence/compat.rb +2 -2
- data/lib/bio/sequence/dblink.rb +54 -0
- data/lib/bio/sequence/format.rb +254 -77
- data/lib/bio/sequence/format_raw.rb +23 -0
- data/lib/bio/shell.rb +3 -1
- data/lib/bio/shell/core.rb +2 -2
- data/lib/bio/shell/plugin/entry.rb +33 -4
- data/lib/bio/shell/plugin/ncbirest.rb +64 -0
- data/lib/bio/shell/plugin/togows.rb +40 -0
- data/lib/bio/shell/rails/vendor/plugins/{generators → bioruby/generators}/bioruby/bioruby_generator.rb +0 -0
- data/lib/bio/shell/rails/vendor/plugins/{generators → bioruby/generators}/bioruby/templates/_classes.rhtml +0 -0
- data/lib/bio/shell/rails/vendor/plugins/{generators → bioruby/generators}/bioruby/templates/_log.rhtml +0 -0
- data/lib/bio/shell/rails/vendor/plugins/{generators → bioruby/generators}/bioruby/templates/_methods.rhtml +0 -0
- data/lib/bio/shell/rails/vendor/plugins/{generators → bioruby/generators}/bioruby/templates/_modules.rhtml +0 -0
- data/lib/bio/shell/rails/vendor/plugins/{generators → bioruby/generators}/bioruby/templates/_variables.rhtml +0 -0
- data/lib/bio/shell/rails/vendor/plugins/{generators → bioruby/generators}/bioruby/templates/bioruby-bg.gif +0 -0
- data/lib/bio/shell/rails/vendor/plugins/{generators → bioruby/generators}/bioruby/templates/bioruby-gem.png +0 -0
- data/lib/bio/shell/rails/vendor/plugins/{generators → bioruby/generators}/bioruby/templates/bioruby-link.gif +0 -0
- data/lib/bio/shell/rails/vendor/plugins/{generators → bioruby/generators}/bioruby/templates/bioruby.css +0 -0
- data/lib/bio/shell/rails/vendor/plugins/{generators → bioruby/generators}/bioruby/templates/bioruby.rhtml +0 -0
- data/lib/bio/shell/rails/vendor/plugins/{generators → bioruby/generators}/bioruby/templates/bioruby_controller.rb +0 -0
- data/lib/bio/shell/rails/vendor/plugins/{generators → bioruby/generators}/bioruby/templates/bioruby_helper.rb +0 -0
- data/lib/bio/shell/rails/vendor/plugins/{generators → bioruby/generators}/bioruby/templates/commands.rhtml +0 -0
- data/lib/bio/shell/rails/vendor/plugins/{generators → bioruby/generators}/bioruby/templates/history.rhtml +0 -0
- data/lib/bio/shell/rails/vendor/plugins/{generators → bioruby/generators}/bioruby/templates/index.rhtml +0 -0
- data/lib/bio/shell/rails/vendor/plugins/{generators → bioruby/generators}/bioruby/templates/spinner.gif +0 -0
- data/lib/bio/tree.rb +4 -2
- data/lib/bio/util/color_scheme.rb +2 -2
- data/lib/bio/util/contingency_table.rb +2 -2
- data/lib/bio/util/restriction_enzyme.rb +2 -2
- data/lib/bio/util/restriction_enzyme/single_strand.rb +6 -5
- data/lib/bio/version.rb +25 -0
- data/rdoc.zsh +8 -0
- data/sample/any2fasta.rb +0 -0
- data/sample/biofetch.rb +0 -0
- data/sample/dbget +0 -0
- data/sample/demo_sequence.rb +158 -0
- data/sample/enzymes.rb +0 -0
- data/sample/fasta2tab.rb +0 -0
- data/sample/fastagrep.rb +72 -0
- data/sample/fastasort.rb +54 -0
- data/sample/fsplit.rb +0 -0
- data/sample/gb2fasta.rb +2 -3
- data/sample/gb2tab.rb +0 -0
- data/sample/gbtab2mysql.rb +0 -0
- data/sample/genes2nuc.rb +0 -0
- data/sample/genes2pep.rb +0 -0
- data/sample/genes2tab.rb +0 -0
- data/sample/genome2rb.rb +0 -0
- data/sample/genome2tab.rb +0 -0
- data/sample/goslim.rb +0 -0
- data/sample/gt2fasta.rb +0 -0
- data/sample/na2aa.rb +34 -0
- data/sample/pmfetch.rb +0 -0
- data/sample/pmsearch.rb +0 -0
- data/sample/ssearch2tab.rb +0 -0
- data/sample/tfastx2tab.rb +0 -0
- data/sample/vs-genes.rb +0 -0
- data/setup.rb +1596 -0
- data/test/data/blast/blastp-multi.m7 +188 -0
- data/test/data/command/echoarg2.bat +1 -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/rpsblast/misc.rpsblast +193 -0
- data/test/data/soft/GDS100_partial.soft +0 -0
- data/test/data/soft/GSE3457_family_partial.soft +0 -0
- data/test/functional/bio/appl/test_pts1.rb +115 -0
- data/test/functional/bio/io/test_ensembl.rb +123 -80
- data/test/functional/bio/io/test_togows.rb +267 -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 +17 -1
- data/test/unit/bio/appl/blast/test_ncbioptions.rb +112 -0
- data/test/unit/bio/appl/blast/test_report.rb +753 -35
- data/test/unit/bio/appl/blast/test_rpsblast.rb +398 -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/test_blast.rb +135 -4
- data/test/unit/bio/appl/test_fasta.rb +2 -2
- data/test/unit/bio/appl/test_pts1.rb +1 -64
- data/test/unit/bio/db/embl/test_common.rb +15 -15
- data/test/unit/bio/db/embl/test_embl.rb +4 -4
- data/test/unit/bio/db/embl/test_embl_rel89.rb +5 -5
- data/test/unit/bio/db/embl/test_embl_to_bioseq.rb +203 -0
- data/test/unit/bio/db/embl/test_sptr.rb +38 -1
- data/test/unit/bio/db/pdb/test_pdb.rb +2 -2
- data/test/unit/bio/db/test_gff.rb +1151 -25
- data/test/unit/bio/db/test_medline.rb +127 -0
- data/test/unit/bio/db/test_nexus.rb +5 -1
- data/test/unit/bio/db/test_prosite.rb +4 -4
- 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 +8 -3
- data/test/unit/bio/io/test_fastacmd.rb +5 -5
- data/test/unit/bio/io/test_flatfile.rb +357 -106
- data/test/unit/bio/io/test_soapwsdl.rb +2 -2
- data/test/unit/bio/io/test_togows.rb +161 -0
- data/test/unit/bio/sequence/test_common.rb +210 -11
- data/test/unit/bio/sequence/test_compat.rb +3 -3
- data/test/unit/bio/sequence/test_dblink.rb +58 -0
- data/test/unit/bio/sequence/test_na.rb +2 -2
- data/test/unit/bio/test_command.rb +111 -50
- data/test/unit/bio/test_feature.rb +29 -1
- data/test/unit/bio/test_location.rb +566 -6
- data/test/unit/bio/test_pathway.rb +91 -65
- data/test/unit/bio/test_reference.rb +67 -13
- data/test/unit/bio/util/restriction_enzyme/analysis/test_calculated_cuts.rb +3 -3
- data/test/unit/bio/util/restriction_enzyme/analysis/test_cut_ranges.rb +3 -3
- data/test/unit/bio/util/restriction_enzyme/analysis/test_sequence_range.rb +3 -3
- data/test/unit/bio/util/restriction_enzyme/double_stranded/test_aligned_strands.rb +4 -3
- data/test/unit/bio/util/restriction_enzyme/double_stranded/test_cut_location_pair.rb +3 -3
- data/test/unit/bio/util/restriction_enzyme/double_stranded/test_cut_location_pair_in_enzyme_notation.rb +3 -3
- data/test/unit/bio/util/restriction_enzyme/double_stranded/test_cut_locations.rb +3 -3
- data/test/unit/bio/util/restriction_enzyme/double_stranded/test_cut_locations_in_enzyme_notation.rb +3 -3
- data/test/unit/bio/util/restriction_enzyme/single_strand/test_cut_locations_in_enzyme_notation.rb +3 -3
- data/test/unit/bio/util/restriction_enzyme/test_analysis.rb +3 -3
- data/test/unit/bio/util/restriction_enzyme/test_cut_symbol.rb +4 -4
- data/test/unit/bio/util/restriction_enzyme/test_double_stranded.rb +3 -3
- data/test/unit/bio/util/restriction_enzyme/test_single_strand.rb +3 -3
- data/test/unit/bio/util/restriction_enzyme/test_single_strand_complement.rb +3 -3
- data/test/unit/bio/util/restriction_enzyme/test_string_formatting.rb +3 -3
- data/test/unit/bio/util/test_restriction_enzyme.rb +3 -3
- metadata +202 -167
- data/test/unit/bio/appl/blast/test_xmlparser.rb +0 -388
data/lib/bio/db/kegg/glycan.rb
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
# Copyright:: Copyright (C) 2004 Toshiaki Katayama <k@bioruby.org>
|
5
5
|
# License:: The Ruby License
|
6
6
|
#
|
7
|
-
# $Id
|
7
|
+
# $Id:$
|
8
8
|
#
|
9
9
|
|
10
10
|
require 'bio/db'
|
@@ -46,11 +46,7 @@ class GLYCAN < KEGGDB
|
|
46
46
|
# MASS
|
47
47
|
def mass
|
48
48
|
unless @data['MASS']
|
49
|
-
|
50
|
-
fetch('MASS').scan(/(\S+)\s+\((\S+)\)/).each do |val, key|
|
51
|
-
hash[key] = val.to_f
|
52
|
-
end
|
53
|
-
@data['MASS'] = hash
|
49
|
+
@data['MASS'] = field_fetch('MASS')[/[\d\.]+/].to_f
|
54
50
|
end
|
55
51
|
@data['MASS']
|
56
52
|
end
|
data/lib/bio/db/lasergene.rb
CHANGED
@@ -5,10 +5,10 @@
|
|
5
5
|
# Copyright:: Copyright (c) 2007 Center for Biomedical Research Informatics, University of Minnesota (http://cbri.umn.edu)
|
6
6
|
# License:: The Ruby License
|
7
7
|
#
|
8
|
-
# $Id
|
8
|
+
# $Id:$
|
9
9
|
#
|
10
10
|
|
11
|
-
module Bio
|
11
|
+
module Bio
|
12
12
|
|
13
13
|
#
|
14
14
|
# bio/db/lasergene.rb - Interface for DNAStar Lasergene sequence file format
|
@@ -206,4 +206,4 @@ class Lasergene
|
|
206
206
|
@sequence = Bio::Sequence.auto( lines[ (delimiter_2_indices[0] + 1) .. -1 ].join('') )
|
207
207
|
end
|
208
208
|
end # Lasergene
|
209
|
-
end # Bio
|
209
|
+
end # Bio
|
data/lib/bio/db/medline.rb
CHANGED
@@ -153,7 +153,10 @@ class MEDLINE < NCBIDB
|
|
153
153
|
au.split(/\n/).each do |author|
|
154
154
|
if author =~ / /
|
155
155
|
name = author.split(/\s+/)
|
156
|
-
suffix =
|
156
|
+
suffix = nil
|
157
|
+
if name.length > 2 && name[-2] =~ /^[A-Z]+$/ # second to last are the initials
|
158
|
+
suffix = name.pop
|
159
|
+
end
|
157
160
|
initial = name.pop.split(//).join('. ')
|
158
161
|
author = "#{name.join(' ')}, #{initial}."
|
159
162
|
end
|
data/lib/bio/db/newick.rb
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
# Daniel Amelang <dan@amelang.net>
|
7
7
|
# License:: The Ruby License
|
8
8
|
#
|
9
|
-
# $Id
|
9
|
+
# $Id:$
|
10
10
|
#
|
11
11
|
# == Description
|
12
12
|
#
|
@@ -606,9 +606,9 @@ module Bio
|
|
606
606
|
# If all of the internal node's names are numeric,
|
607
607
|
# the names are regarded as bootstrap values.
|
608
608
|
flag = false
|
609
|
-
internal_nodes.each do |
|
610
|
-
if
|
611
|
-
if /\A[\+\-]?\d*\.?\d*\z/ =~
|
609
|
+
internal_nodes.each do |inode|
|
610
|
+
if inode.name and !inode.name.to_s.strip.empty? then
|
611
|
+
if /\A[\+\-]?\d*\.?\d*\z/ =~ inode.name
|
612
612
|
flag = true
|
613
613
|
else
|
614
614
|
flag = false
|
@@ -619,17 +619,17 @@ module Bio
|
|
619
619
|
if flag then
|
620
620
|
@options[:bootstrap_style] = :traditional
|
621
621
|
@options[:original_format] = :traditional
|
622
|
-
internal_nodes.each do |
|
623
|
-
if
|
624
|
-
|
625
|
-
|
622
|
+
internal_nodes.each do |inode|
|
623
|
+
if inode.name then
|
624
|
+
inode.bootstrap_string = inode.name
|
625
|
+
inode.name = nil
|
626
626
|
end
|
627
627
|
end
|
628
628
|
end
|
629
629
|
end
|
630
630
|
# Sets nodes order numbers
|
631
|
-
nodes.each_with_index do |
|
632
|
-
|
631
|
+
nodes.each_with_index do |xnode, i|
|
632
|
+
xnode.order_number = i
|
633
633
|
end
|
634
634
|
# If the root implicitly prepared by the program is a leaf and
|
635
635
|
# there are no additional information for the edge from the root to
|
data/lib/bio/db/pdb/chain.rb
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
# Naohisa Goto <ng@bioruby.org>
|
7
7
|
# License:: The Ruby License
|
8
8
|
#
|
9
|
-
# $Id: chain.rb,v 1.
|
9
|
+
# $Id: chain.rb,v 1.10 2008/04/01 10:36:44 ngoto Exp $
|
10
10
|
#
|
11
11
|
# = Bio::PDB::Chain
|
12
12
|
#
|
@@ -189,7 +189,11 @@ module Bio
|
|
189
189
|
x.times { string << 'X' }
|
190
190
|
end
|
191
191
|
tlc = residue.resName.capitalize
|
192
|
-
olc = (
|
192
|
+
olc = (begin
|
193
|
+
Bio::AminoAcid.three2one(tlc)
|
194
|
+
rescue ArgumentError
|
195
|
+
nil
|
196
|
+
end || 'X')
|
193
197
|
string << olc
|
194
198
|
end
|
195
199
|
@aaseq = Bio::Sequence::AA.new(string)
|
data/lib/bio/db/pdb/pdb.rb
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
# Alex Gutteridge <alexg@ebi.ac.uk>
|
7
7
|
# License:: The Ruby License
|
8
8
|
#
|
9
|
-
# $Id: pdb.rb,v 1.
|
9
|
+
# $Id: pdb.rb,v 1.28 2008/04/01 10:36:44 ngoto Exp $
|
10
10
|
#
|
11
11
|
# = About Bio::PDB
|
12
12
|
#
|
@@ -1497,6 +1497,9 @@ module Bio
|
|
1497
1497
|
cChain = newChain
|
1498
1498
|
chain = newChain
|
1499
1499
|
end
|
1500
|
+
# chain might be changed, clearing cResidue and cLigand
|
1501
|
+
cResidue = nil
|
1502
|
+
cLigand = nil
|
1500
1503
|
end
|
1501
1504
|
end
|
1502
1505
|
|
@@ -1550,6 +1553,8 @@ module Bio
|
|
1550
1553
|
when 'MODEL'
|
1551
1554
|
c_atom = nil
|
1552
1555
|
cChain = nil
|
1556
|
+
cResidue = nil
|
1557
|
+
cLigand = nil
|
1553
1558
|
if cModel.model_serial or cModel.chains.size > 0 then
|
1554
1559
|
self.addModel(cModel)
|
1555
1560
|
end
|
@@ -1809,13 +1814,17 @@ module Bio
|
|
1809
1814
|
#aa is three letter code: i.e. ALA
|
1810
1815
|
#need to look up with Ala
|
1811
1816
|
aa = aa.capitalize
|
1812
|
-
(
|
1817
|
+
(begin
|
1818
|
+
Bio::AminoAcid.three2one(aa)
|
1819
|
+
rescue ArgumentError
|
1820
|
+
nil
|
1821
|
+
end || 'X')
|
1813
1822
|
end
|
1814
1823
|
seq = Bio::Sequence::AA.new(a.to_s)
|
1815
1824
|
else
|
1816
1825
|
# nucleic acid sequence
|
1817
1826
|
a.collect! do |na|
|
1818
|
-
na = na.
|
1827
|
+
na = na.delete('^a-zA-Z')
|
1819
1828
|
na.size == 1 ? na : 'n'
|
1820
1829
|
end
|
1821
1830
|
seq = Bio::Sequence::NA.new(a.to_s)
|
data/lib/bio/db/rebase.rb
CHANGED
@@ -5,14 +5,13 @@
|
|
5
5
|
# Copyright:: Copyright (c) 2005-2007 Midwinter Laboratories, LLC (http://midwinterlabs.com)
|
6
6
|
# License:: The Ruby License
|
7
7
|
#
|
8
|
-
# $Id
|
8
|
+
# $Id:$
|
9
9
|
#
|
10
10
|
|
11
|
-
|
11
|
+
require 'yaml'
|
12
|
+
require 'bio/reference'
|
12
13
|
|
13
|
-
module Bio
|
14
|
-
|
15
|
-
autoload :Reference, 'bio/reference'
|
14
|
+
module Bio
|
16
15
|
|
17
16
|
#
|
18
17
|
# bio/db/rebase.rb - Interface for EMBOSS formatted REBASE files
|
@@ -316,7 +315,7 @@ class REBASE
|
|
316
315
|
def parse_enzymes( lines )
|
317
316
|
data = {}
|
318
317
|
return data if lines == nil
|
319
|
-
lines.
|
318
|
+
lines.each_line do |line|
|
320
319
|
next if line[0].chr == '#'
|
321
320
|
line.chomp!
|
322
321
|
|
@@ -347,7 +346,7 @@ class REBASE
|
|
347
346
|
h = {}
|
348
347
|
references_left = 0
|
349
348
|
|
350
|
-
lines.
|
349
|
+
lines.each_line do |line|
|
351
350
|
next if line[0].chr == '#' # Comment
|
352
351
|
next if line[0..1] == '//' # End of entry marker
|
353
352
|
line.chomp!
|
@@ -389,7 +388,7 @@ class REBASE
|
|
389
388
|
def parse_suppliers( lines )
|
390
389
|
data = {}
|
391
390
|
return data if lines == nil
|
392
|
-
lines.
|
391
|
+
lines.each_line do |line|
|
393
392
|
next if line[0].chr == '#'
|
394
393
|
data[$1] = $2 if line =~ %r{(.+?)\s(.+)}
|
395
394
|
end
|
data/lib/bio/db/soft.rb
CHANGED
@@ -5,10 +5,10 @@
|
|
5
5
|
# Copyright:: Copyright (c) 2007 Midwinter Laboratories, LLC (http://midwinterlabs.com)
|
6
6
|
# License:: The Ruby License
|
7
7
|
#
|
8
|
-
# $Id
|
8
|
+
# $Id:$
|
9
9
|
#
|
10
10
|
|
11
|
-
module Bio
|
11
|
+
module Bio
|
12
12
|
|
13
13
|
#
|
14
14
|
# bio/db/soft.rb - Interface for SOFT formatted files
|
@@ -401,4 +401,4 @@ class SOFT
|
|
401
401
|
end
|
402
402
|
|
403
403
|
end # SOFT
|
404
|
-
end # Bio
|
404
|
+
end # Bio
|
data/lib/bio/feature.rb
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
# 2006 Jan Aerts <jan.aerts@bbsrc.ac.uk>
|
6
6
|
# License:: The Ruby License
|
7
7
|
#
|
8
|
-
# $Id: feature.rb,v 1.13
|
8
|
+
# $Id: feature.rb,v 1.13.2.1 2008/03/04 10:12:22 ngoto Exp $
|
9
9
|
|
10
10
|
require 'bio/location'
|
11
11
|
|
@@ -135,92 +135,5 @@ class Feature
|
|
135
135
|
|
136
136
|
end #Feature
|
137
137
|
|
138
|
-
|
139
|
-
# = DESCRIPTION
|
140
|
-
# Container for a list of Feature objects.
|
141
|
-
#
|
142
|
-
# = USAGE
|
143
|
-
# # First, create some Bio::Feature objects
|
144
|
-
# feature1 = Bio::Feature.new('intron','3627..4059')
|
145
|
-
# feature2 = Bio::Feature.new('exon','4060..4236')
|
146
|
-
# feature3 = Bio::Feature.new('intron','4237..4426')
|
147
|
-
# feature4 = Bio::Feature.new('CDS','join(2538..3626,4060..4236)',
|
148
|
-
# [ Bio::Feature::Qualifier.new('gene', 'CYP2D6'),
|
149
|
-
# Bio::Feature::Qualifier.new('translation','MGXXTVMHLL...')
|
150
|
-
# ])
|
151
|
-
#
|
152
|
-
# # And create a container for them
|
153
|
-
# feature_container = Bio::Features.new([ feature1, feature2, feature3, feature4 ])
|
154
|
-
#
|
155
|
-
# # Iterate over all features and print
|
156
|
-
# feature_container.each do |feature|
|
157
|
-
# puts feature.feature + "\t" + feature.position
|
158
|
-
# feature.each do |qualifier|
|
159
|
-
# puts "- " + qualifier.qualifier + ": " + qualifier.value
|
160
|
-
# end
|
161
|
-
# end
|
162
|
-
#
|
163
|
-
# # Iterate only over CDS features and extract translated amino acid sequences
|
164
|
-
# features.each("CDS") do |feature|
|
165
|
-
# hash = feature.to_hash
|
166
|
-
# name = hash["gene"] || hash["product"] || hash["note"]
|
167
|
-
# aaseq = hash["translation"]
|
168
|
-
# pos = feature.position
|
169
|
-
# if name and seq
|
170
|
-
# puts ">#{gene} #{feature.position}"
|
171
|
-
# puts aaseq
|
172
|
-
# end
|
173
|
-
# end
|
174
|
-
class Features
|
175
|
-
# Create a new Bio::Features object.
|
176
|
-
#
|
177
|
-
# *Arguments*:
|
178
|
-
# * (optional) _list of features_: list of Bio::Feature objects
|
179
|
-
# *Returns*:: Bio::Features object
|
180
|
-
def initialize(ary = [])
|
181
|
-
@features = ary
|
182
|
-
end
|
183
|
-
|
184
|
-
# Returns an Array of Feature objects.
|
185
|
-
attr_accessor :features
|
186
|
-
|
187
|
-
# Appends a Feature object to Features.
|
188
|
-
#
|
189
|
-
# *Arguments*:
|
190
|
-
# * (required) _feature_: Bio::Feature object
|
191
|
-
# *Returns*:: Bio::Features object
|
192
|
-
def append(a)
|
193
|
-
@features.push(a) if a.is_a? Feature
|
194
|
-
return self
|
195
|
-
end
|
196
|
-
|
197
|
-
# Iterates on each feature object.
|
198
|
-
#
|
199
|
-
# *Arguments*:
|
200
|
-
# * (optional) _key_: if specified, only iterates over features with this key
|
201
|
-
def each(arg = nil)
|
202
|
-
@features.each do |x|
|
203
|
-
next if arg and x.feature != arg
|
204
|
-
yield x
|
205
|
-
end
|
206
|
-
end
|
207
|
-
|
208
|
-
# Short cut for the Features#features[n]
|
209
|
-
def [](*arg)
|
210
|
-
@features[*arg]
|
211
|
-
end
|
212
|
-
|
213
|
-
# Short cut for the Features#features.first
|
214
|
-
def first
|
215
|
-
@features.first
|
216
|
-
end
|
217
|
-
|
218
|
-
# Short cut for the Features#features.last
|
219
|
-
def last
|
220
|
-
@features.last
|
221
|
-
end
|
222
|
-
|
223
|
-
end # Features
|
224
|
-
|
225
138
|
end # Bio
|
226
139
|
|
@@ -0,0 +1,64 @@
|
|
1
|
+
module Bio
|
2
|
+
class SQL
|
3
|
+
class Biodatabase < DummyBase
|
4
|
+
has_many :bioentries, :class_name =>"Bioentry", :foreign_key => "biodatabase_id"
|
5
|
+
validates_uniqueness_of :name
|
6
|
+
end
|
7
|
+
end #SQL
|
8
|
+
end #Bio
|
9
|
+
|
10
|
+
|
11
|
+
if __FILE__ == $0
|
12
|
+
require 'rubygems'
|
13
|
+
require 'composite_primary_keys'
|
14
|
+
require 'bio'
|
15
|
+
require 'pp'
|
16
|
+
|
17
|
+
# pp connection = Bio::SQL.establish_connection('bio/io/biosql/config/database.yml','development')
|
18
|
+
pp connection = Bio::SQL.establish_connection({'test'=>{'database'=>"bio_test", 'adapter'=>"postgresql", 'username'=>"rails", 'password'=>nil}},'test')
|
19
|
+
#pp YAML::load(ERB.new(IO.read('bio/io/biosql/config/database.yml')).result)
|
20
|
+
if true
|
21
|
+
pp Bio::SQL.list_entries
|
22
|
+
|
23
|
+
puts "### GenBank"
|
24
|
+
if ARGV.size > 0
|
25
|
+
gb = Bio::GenBank.new(ARGF.read)
|
26
|
+
else
|
27
|
+
require 'bio/io/fetch'
|
28
|
+
gb = Bio::GenBank.new(Bio::Fetch.query('gb', 'AJ224122'))
|
29
|
+
end
|
30
|
+
|
31
|
+
biosequence = gb.to_biosequence
|
32
|
+
db=Bio::SQL::Biodatabase.new(:biodatabase_id=>3,:name=>"JEFF", :authority=>"ME", :description=>"YOU")
|
33
|
+
db.save!
|
34
|
+
|
35
|
+
#sqlseq = Bio::SQL::Sequence.new(:biosequence=>biosequence,:biodatabase_id=>db.id)
|
36
|
+
|
37
|
+
# bioseq = Bio::SQL.fetch_accession('AJ224122')
|
38
|
+
# pp bioseq
|
39
|
+
# pp bioseq.entry_id
|
40
|
+
#TODO create a test only for tables not sequence here
|
41
|
+
# pp bioseq.molecule_type
|
42
|
+
#pp bioseq.molecule_type.class
|
43
|
+
#bioseq.molecule_type_update('dna', 1)
|
44
|
+
pp Bio::SQL::Taxon.find(8121).taxon_names
|
45
|
+
|
46
|
+
#sqlseq.to_biosequence
|
47
|
+
|
48
|
+
#sqlseq.delete
|
49
|
+
end
|
50
|
+
#pp bioseq.molecule_type
|
51
|
+
#term = Bio::SQL::Term.find_by_name('mol_type')
|
52
|
+
#pp term
|
53
|
+
#pp bioseq.entry.bioentry_qualifier_values.create(:term=>term, :rank=>2, :value=>'pippo')
|
54
|
+
#pp bioseq.entry.bioentry_qualifier_values.inspect
|
55
|
+
#pp bioseq.entry.bioentry_qualifier_values.find_all_by_term_id(26)
|
56
|
+
#pp primo.class
|
57
|
+
# pp primo.value='dna'
|
58
|
+
# pp primo.save
|
59
|
+
#pp bioseq.molecule_type= 'prova'
|
60
|
+
|
61
|
+
#Bio::SQL::BioentryQualifierValue.delete(delete.bioentry_id,delete.term_id,delete.rank)
|
62
|
+
|
63
|
+
|
64
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Bio
|
2
|
+
class SQL
|
3
|
+
class Bioentry < DummyBase
|
4
|
+
belongs_to :biodatabase, :class_name => "Biodatabase"
|
5
|
+
belongs_to :taxon, :class_name => "Taxon"
|
6
|
+
has_one :biosequence
|
7
|
+
#, :class_name => "Biosequence", :foreign_key => "bioentry_id"
|
8
|
+
has_many :comments, :class_name =>"Comment", :order =>'rank'
|
9
|
+
has_many :seqfeatures, :class_name => "Seqfeature", :order=>'rank'
|
10
|
+
has_many :bioentry_references, :class_name=>"BioentryReference" #, :foreign_key => "bioentry_id"
|
11
|
+
has_many :bioentry_dbxrefs, :class_name => "BioentryDbxref"
|
12
|
+
has_many :object_bioentry_relationships, :class_name=>"BioentryRelationship", :foreign_key=>"object_bioentry_id" #non mi convince molto credo non funzioni nel modo corretto
|
13
|
+
has_many :subject_bioentry_relationships, :class_name=>"BioentryRelationship", :foreign_key=>"subject_bioentry_id" #non mi convince molto credo non funzioni nel modo corretto
|
14
|
+
|
15
|
+
has_many :cdsfeatures, :class_name=>"Seqfeature", :foreign_key =>"bioentry_id", :conditions=>["term.name='CDS'"], :include=>"type_term"
|
16
|
+
|
17
|
+
has_many :terms, :through=>:bioentry_qualifier_values, :class_name => "Term"
|
18
|
+
#NOTE: added order_by for multiple hit and manage ranks correctly
|
19
|
+
has_many :bioentry_qualifier_values, :order=>"bioentry_id,term_id,rank", :class_name => "BioentryQualifierValue"
|
20
|
+
|
21
|
+
#per la creazione richiesti:
|
22
|
+
#name, accession, version
|
23
|
+
# validates_uniqueness_of :accession, :scope=>[:biodatabase_id]
|
24
|
+
# validates_uniqueness_of :name, :scope=>[:biodatabase_id]
|
25
|
+
# validates_uniqueness_of :identifier, :scope=>[:biodatabase_id]
|
26
|
+
|
27
|
+
end
|
28
|
+
end #SQL
|
29
|
+
end #Bio
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module Bio
|
2
|
+
class SQL
|
3
|
+
class BioentryDbxref < DummyBase
|
4
|
+
#delete set_sequence_name nil
|
5
|
+
set_primary_key nil #bioentry_id,dbxref_id
|
6
|
+
belongs_to :bioentry, :class_name => "Bioentry"
|
7
|
+
belongs_to :dbxref, :class_name => "Dbxref"
|
8
|
+
end
|
9
|
+
end #SQL
|
10
|
+
end #Bio
|
11
|
+
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module Bio
|
2
|
+
class SQL
|
3
|
+
class BioentryPath < DummyBase
|
4
|
+
set_primary_key nil
|
5
|
+
#delete set_sequence_name nil
|
6
|
+
belongs_to :term, :class_name => "Term"
|
7
|
+
#da sistemare per poter procedere.
|
8
|
+
belongs_to :object_bioentry, :class_name=>"Bioentry"
|
9
|
+
belongs_to :subject_bioentry, :class_name=>"Bioentry"
|
10
|
+
end #BioentryPath
|
11
|
+
end #SQL
|
12
|
+
end #Bio
|