bio 0.7.1 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/bioruby +71 -27
- data/bin/br_biofetch.rb +5 -17
- data/bin/br_bioflat.rb +14 -26
- data/bin/br_biogetseq.rb +6 -18
- data/bin/br_pmfetch.rb +6 -16
- data/doc/Changes-0.7.rd +35 -0
- data/doc/KEGG_API.rd +287 -172
- data/doc/KEGG_API.rd.ja +273 -160
- data/doc/Tutorial.rd +18 -9
- data/doc/Tutorial.rd.ja +656 -138
- data/lib/bio.rb +6 -24
- data/lib/bio/alignment.rb +5 -5
- data/lib/bio/appl/blast.rb +132 -98
- data/lib/bio/appl/blast/format0.rb +9 -19
- data/lib/bio/appl/blast/wublast.rb +5 -18
- data/lib/bio/appl/emboss.rb +40 -47
- data/lib/bio/appl/hmmer.rb +116 -82
- data/lib/bio/appl/hmmer/report.rb +509 -364
- data/lib/bio/appl/spidey/report.rb +7 -18
- data/lib/bio/data/na.rb +3 -21
- data/lib/bio/db.rb +3 -21
- data/lib/bio/db/aaindex.rb +147 -52
- data/lib/bio/db/embl/common.rb +27 -6
- data/lib/bio/db/embl/embl.rb +18 -10
- data/lib/bio/db/embl/sptr.rb +87 -67
- data/lib/bio/db/embl/swissprot.rb +32 -3
- data/lib/bio/db/embl/trembl.rb +32 -3
- data/lib/bio/db/embl/uniprot.rb +32 -3
- data/lib/bio/db/fasta.rb +327 -289
- data/lib/bio/db/medline.rb +25 -4
- data/lib/bio/db/nbrf.rb +12 -20
- data/lib/bio/db/pdb.rb +4 -1
- data/lib/bio/db/pdb/chemicalcomponent.rb +240 -0
- data/lib/bio/db/pdb/pdb.rb +13 -8
- data/lib/bio/db/rebase.rb +93 -97
- data/lib/bio/feature.rb +2 -31
- data/lib/bio/io/ddbjxml.rb +167 -139
- data/lib/bio/io/fastacmd.rb +89 -56
- data/lib/bio/io/flatfile.rb +994 -278
- data/lib/bio/io/flatfile/index.rb +257 -194
- data/lib/bio/io/flatfile/indexer.rb +37 -29
- data/lib/bio/reference.rb +147 -64
- data/lib/bio/sequence.rb +57 -417
- data/lib/bio/sequence/aa.rb +64 -0
- data/lib/bio/sequence/common.rb +175 -0
- data/lib/bio/sequence/compat.rb +68 -0
- data/lib/bio/sequence/format.rb +134 -0
- data/lib/bio/sequence/generic.rb +24 -0
- data/lib/bio/sequence/na.rb +189 -0
- data/lib/bio/shell.rb +9 -23
- data/lib/bio/shell/core.rb +130 -125
- data/lib/bio/shell/demo.rb +143 -0
- data/lib/bio/shell/{session.rb → interface.rb} +42 -40
- data/lib/bio/shell/object.rb +52 -0
- data/lib/bio/shell/plugin/codon.rb +4 -22
- data/lib/bio/shell/plugin/emboss.rb +23 -0
- data/lib/bio/shell/plugin/entry.rb +34 -25
- data/lib/bio/shell/plugin/flatfile.rb +5 -23
- data/lib/bio/shell/plugin/keggapi.rb +11 -24
- data/lib/bio/shell/plugin/midi.rb +5 -23
- data/lib/bio/shell/plugin/obda.rb +4 -22
- data/lib/bio/shell/plugin/seq.rb +6 -24
- data/lib/bio/shell/rails/Rakefile +10 -0
- data/lib/bio/shell/rails/app/controllers/application.rb +4 -0
- data/lib/bio/shell/rails/app/controllers/shell_controller.rb +94 -0
- data/lib/bio/shell/rails/app/helpers/application_helper.rb +3 -0
- data/lib/bio/shell/rails/app/models/shell_connection.rb +30 -0
- data/lib/bio/shell/rails/app/views/layouts/shell.rhtml +37 -0
- data/lib/bio/shell/rails/app/views/shell/history.rhtml +5 -0
- data/lib/bio/shell/rails/app/views/shell/index.rhtml +2 -0
- data/lib/bio/shell/rails/app/views/shell/show.rhtml +13 -0
- data/lib/bio/shell/rails/config/boot.rb +19 -0
- data/lib/bio/shell/rails/config/database.yml +85 -0
- data/lib/bio/shell/rails/config/environment.rb +53 -0
- data/lib/bio/shell/rails/config/environments/development.rb +19 -0
- data/lib/bio/shell/rails/config/environments/production.rb +19 -0
- data/lib/bio/shell/rails/config/environments/test.rb +19 -0
- data/lib/bio/shell/rails/config/routes.rb +19 -0
- data/lib/bio/shell/rails/doc/README_FOR_APP +2 -0
- data/lib/bio/shell/rails/public/404.html +8 -0
- data/lib/bio/shell/rails/public/500.html +8 -0
- data/lib/bio/shell/rails/public/dispatch.cgi +10 -0
- data/lib/bio/shell/rails/public/dispatch.fcgi +24 -0
- data/lib/bio/shell/rails/public/dispatch.rb +10 -0
- data/lib/bio/shell/rails/public/favicon.ico +0 -0
- data/lib/bio/shell/rails/public/images/icon.png +0 -0
- data/lib/bio/shell/rails/public/images/rails.png +0 -0
- data/lib/bio/shell/rails/public/index.html +277 -0
- data/lib/bio/shell/rails/public/javascripts/controls.js +750 -0
- data/lib/bio/shell/rails/public/javascripts/dragdrop.js +584 -0
- data/lib/bio/shell/rails/public/javascripts/effects.js +854 -0
- data/lib/bio/shell/rails/public/javascripts/prototype.js +1785 -0
- data/lib/bio/shell/rails/public/robots.txt +1 -0
- data/lib/bio/shell/rails/public/stylesheets/main.css +187 -0
- data/lib/bio/shell/rails/script/about +3 -0
- data/lib/bio/shell/rails/script/breakpointer +3 -0
- data/lib/bio/shell/rails/script/console +3 -0
- data/lib/bio/shell/rails/script/destroy +3 -0
- data/lib/bio/shell/rails/script/generate +3 -0
- data/lib/bio/shell/rails/script/performance/benchmarker +3 -0
- data/lib/bio/shell/rails/script/performance/profiler +3 -0
- data/lib/bio/shell/rails/script/plugin +3 -0
- data/lib/bio/shell/rails/script/process/reaper +3 -0
- data/lib/bio/shell/rails/script/process/spawner +3 -0
- data/lib/bio/shell/rails/script/process/spinner +3 -0
- data/lib/bio/shell/rails/script/runner +3 -0
- data/lib/bio/shell/rails/script/server +42 -0
- data/lib/bio/shell/rails/test/test_helper.rb +28 -0
- data/lib/bio/shell/web.rb +90 -0
- data/lib/bio/util/contingency_table.rb +231 -225
- data/sample/any2fasta.rb +59 -0
- data/test/data/HMMER/hmmpfam.out +64 -0
- data/test/data/HMMER/hmmsearch.out +88 -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/{eco:b0002.faa → b0002.faa} +0 -0
- data/test/data/blast/{eco:b0002.faa.m0 → b0002.faa.m0} +2 -2
- data/test/data/blast/{eco:b0002.faa.m7 → b0002.faa.m7} +1 -1
- data/test/data/blast/{eco:b0002.faa.m8 → b0002.faa.m8} +0 -0
- data/test/unit/bio/appl/bl2seq/test_report.rb +134 -0
- data/test/unit/bio/appl/blast/test_report.rb +15 -12
- data/test/unit/bio/appl/blast/test_xmlparser.rb +4 -4
- data/test/unit/bio/appl/hmmer/test_report.rb +355 -0
- data/test/unit/bio/appl/test_blast.rb +5 -5
- data/test/unit/bio/data/test_na.rb +9 -18
- data/test/unit/bio/db/pdb/test_pdb.rb +169 -0
- data/test/unit/bio/db/test_aaindex.rb +197 -0
- data/test/unit/bio/io/test_fastacmd.rb +55 -0
- data/test/unit/bio/sequence/test_aa.rb +102 -0
- data/test/unit/bio/sequence/test_common.rb +178 -0
- data/test/unit/bio/sequence/test_compat.rb +82 -0
- data/test/unit/bio/sequence/test_na.rb +242 -0
- data/test/unit/bio/shell/plugin/test_seq.rb +29 -19
- data/test/unit/bio/test_alignment.rb +15 -7
- data/test/unit/bio/test_reference.rb +198 -0
- data/test/unit/bio/test_sequence.rb +4 -49
- data/test/unit/bio/test_shell.rb +2 -2
- metadata +118 -15
- data/lib/bio/io/brdb.rb +0 -103
- data/lib/bioruby.rb +0 -34
data/lib/bio/db/medline.rb
CHANGED
|
@@ -1,7 +1,26 @@
|
|
|
1
1
|
#
|
|
2
|
-
# bio/db/medline.rb - NCBI PubMed/MEDLINE database class
|
|
2
|
+
# = bio/db/medline.rb - NCBI PubMed/MEDLINE database class
|
|
3
3
|
#
|
|
4
|
-
#
|
|
4
|
+
# Copyright:: Copyright (C) 2001, 2005
|
|
5
|
+
# KATAYAMA Toshiaki <k@bioruby.org>
|
|
6
|
+
# License:: LGPL
|
|
7
|
+
#
|
|
8
|
+
# == Description
|
|
9
|
+
#
|
|
10
|
+
# NCBI PubMed/MEDLINE database class.
|
|
11
|
+
#
|
|
12
|
+
# == Examples
|
|
13
|
+
#
|
|
14
|
+
# medline = Bio::MEDLINE.new(txt)
|
|
15
|
+
# medline.reference
|
|
16
|
+
# medline.pmid == medline.entry_id
|
|
17
|
+
# medilne.mesh
|
|
18
|
+
#
|
|
19
|
+
# == References
|
|
20
|
+
#
|
|
21
|
+
# $Id: medline.rb,v 1.13 2006/02/18 15:03:47 nakao Exp $
|
|
22
|
+
#
|
|
23
|
+
#++
|
|
5
24
|
#
|
|
6
25
|
# This library is free software; you can redistribute it and/or
|
|
7
26
|
# modify it under the terms of the GNU Lesser General Public
|
|
@@ -17,15 +36,17 @@
|
|
|
17
36
|
# License along with this library; if not, write to the Free Software
|
|
18
37
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
19
38
|
#
|
|
20
|
-
|
|
39
|
+
#--
|
|
21
40
|
#
|
|
22
41
|
|
|
23
42
|
require 'bio/db'
|
|
24
43
|
|
|
25
44
|
module Bio
|
|
26
45
|
|
|
46
|
+
# NCBI PubMed/MEDLINE database class.
|
|
27
47
|
class MEDLINE < NCBIDB
|
|
28
48
|
|
|
49
|
+
#
|
|
29
50
|
def initialize(entry)
|
|
30
51
|
@pubmed = Hash.new('')
|
|
31
52
|
|
|
@@ -39,7 +60,7 @@ module Bio
|
|
|
39
60
|
end
|
|
40
61
|
|
|
41
62
|
|
|
42
|
-
# Reference object
|
|
63
|
+
# returns a Reference object.
|
|
43
64
|
def reference
|
|
44
65
|
hash = Hash.new('')
|
|
45
66
|
|
data/lib/bio/db/nbrf.rb
CHANGED
|
@@ -1,27 +1,11 @@
|
|
|
1
1
|
#
|
|
2
2
|
# = bio/db/nbrf.rb - NBRF/PIR format sequence data class
|
|
3
3
|
#
|
|
4
|
-
# Copyright:: Copyright (C) 2001-2003
|
|
4
|
+
# Copyright:: Copyright (C) 2001-2003,2006 Naohisa Goto <ng@bioruby.org>
|
|
5
5
|
# Copyright (C) 2001-2002 KATAYAMA Toshiaki <k@bioruby.org>
|
|
6
|
-
# License::
|
|
6
|
+
# License:: Ruby's
|
|
7
7
|
#
|
|
8
|
-
|
|
9
|
-
# This library is free software; you can redistribute it and/or
|
|
10
|
-
# modify it under the terms of the GNU Lesser General Public
|
|
11
|
-
# License as published by the Free Software Foundation; either
|
|
12
|
-
# version 2 of the License, or (at your option) any later version.
|
|
13
|
-
#
|
|
14
|
-
# This library is distributed in the hope that it will be useful,
|
|
15
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
16
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
17
|
-
# Lesser General Public License for more details.
|
|
18
|
-
#
|
|
19
|
-
# You should have received a copy of the GNU Lesser General Public
|
|
20
|
-
# License along with this library; if not, write to the Free Software
|
|
21
|
-
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
22
|
-
#++
|
|
23
|
-
#
|
|
24
|
-
# $Id: nbrf.rb,v 1.7 2005/12/18 15:58:41 k Exp $
|
|
8
|
+
# $Id: nbrf.rb,v 1.8 2006/02/22 08:43:15 ngoto Exp $
|
|
25
9
|
#
|
|
26
10
|
# Sequence data class for NBRF/PIR flatfile format.
|
|
27
11
|
#
|
|
@@ -44,7 +28,15 @@ module Bio
|
|
|
44
28
|
#++
|
|
45
29
|
|
|
46
30
|
# Delimiter of each entry. Bio::FlatFile uses it.
|
|
47
|
-
DELIMITER = RS = "
|
|
31
|
+
DELIMITER = RS = "\n>"
|
|
32
|
+
|
|
33
|
+
# (Integer) excess read size included in DELIMITER.
|
|
34
|
+
DELIMITER_OVERRUN = 1 # '>'
|
|
35
|
+
|
|
36
|
+
#--
|
|
37
|
+
# Note: DELIMITER is changed due to the change of Bio::FlatFile.
|
|
38
|
+
# DELIMITER = RS = "*\n"
|
|
39
|
+
#++
|
|
48
40
|
|
|
49
41
|
# Creates a new NBRF object. It stores the comment and sequence
|
|
50
42
|
# information from one entry of the NBRF/PIR format string.
|
data/lib/bio/db/pdb.rb
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
# License along with this library; if not, write to the Free Software
|
|
18
18
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
19
19
|
#
|
|
20
|
-
# $Id: pdb.rb,v 1.
|
|
20
|
+
# $Id: pdb.rb,v 1.6 2006/01/29 06:54:13 ngoto Exp $
|
|
21
21
|
#
|
|
22
22
|
|
|
23
23
|
require 'bio/db'
|
|
@@ -25,6 +25,9 @@ require 'bio/db'
|
|
|
25
25
|
# definition of the PDB class
|
|
26
26
|
module Bio
|
|
27
27
|
class PDB #< DB
|
|
28
|
+
|
|
29
|
+
autoload :ChemicalComponent, 'bio/db/pdb/chemicalcomponent'
|
|
30
|
+
|
|
28
31
|
end #class PDB
|
|
29
32
|
end #module Bio
|
|
30
33
|
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
#
|
|
2
|
+
# = bio/db/pdb/chemicalcomponent.rb - PDB Chemical Component Dictionary parser
|
|
3
|
+
#
|
|
4
|
+
# Copyright:: Copyright (C) 2006
|
|
5
|
+
# GOTO Naohisa <ngoto@gen-info.osaka-u.ac.jp>
|
|
6
|
+
# License:: LGPL
|
|
7
|
+
#
|
|
8
|
+
# $Id: chemicalcomponent.rb,v 1.1 2006/01/29 06:54:13 ngoto Exp $
|
|
9
|
+
#
|
|
10
|
+
#--
|
|
11
|
+
# This library is free software; you can redistribute it and/or
|
|
12
|
+
# modify it under the terms of the GNU Lesser General Public
|
|
13
|
+
# License as published by the Free Software Foundation; either
|
|
14
|
+
# version 2 of the License, or (at your option) any later version.
|
|
15
|
+
#
|
|
16
|
+
# This library is distributed in the hope that it will be useful,
|
|
17
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
18
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
19
|
+
# Lesser General Public License for more details.
|
|
20
|
+
#
|
|
21
|
+
# You should have received a copy of the GNU Lesser General Public
|
|
22
|
+
# License along with this library; if not, write to the Free Software
|
|
23
|
+
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
24
|
+
#++
|
|
25
|
+
#
|
|
26
|
+
# = About Bio::PDB::ChemicalComponent
|
|
27
|
+
#
|
|
28
|
+
# Please refer Bio::PDB::ChemicalComponent.
|
|
29
|
+
#
|
|
30
|
+
# = References
|
|
31
|
+
#
|
|
32
|
+
# * ((<URL:http://deposit.pdb.org/cc_dict_tut.html>))
|
|
33
|
+
# * http://deposit.pdb.org/het_dictionary.txt
|
|
34
|
+
#
|
|
35
|
+
|
|
36
|
+
require 'bio/db/pdb/pdb'
|
|
37
|
+
|
|
38
|
+
module Bio
|
|
39
|
+
class PDB
|
|
40
|
+
|
|
41
|
+
# Bio::PDB::ChemicalComponet is a parser for a entry of
|
|
42
|
+
# the PDB Chemical Component Dictionary.
|
|
43
|
+
#
|
|
44
|
+
# The PDB Chemical Component Dictionary is available in
|
|
45
|
+
# http://deposit.pdb.org/het_dictionary.txt
|
|
46
|
+
class ChemicalComponent
|
|
47
|
+
|
|
48
|
+
# delimiter for reading via Bio::FlatFile
|
|
49
|
+
DELIMITER = RS = "\n\n"
|
|
50
|
+
|
|
51
|
+
# Single field (normally single line) of a entry
|
|
52
|
+
class Record < Bio::PDB::Record
|
|
53
|
+
|
|
54
|
+
# fetches record name
|
|
55
|
+
def fetch_record_name(str)
|
|
56
|
+
str[0..6].strip
|
|
57
|
+
end
|
|
58
|
+
private :fetch_record_name
|
|
59
|
+
|
|
60
|
+
# fetches record name
|
|
61
|
+
def self.fetch_record_name(str)
|
|
62
|
+
str[0..6].strip
|
|
63
|
+
end
|
|
64
|
+
private_class_method :fetch_record_name
|
|
65
|
+
|
|
66
|
+
# RESIDUE field.
|
|
67
|
+
# It would be wrong because the definition described in documents
|
|
68
|
+
# seems ambiguous.
|
|
69
|
+
RESIDUE =
|
|
70
|
+
def_rec([ 11, 13, Pdb_LString[3], :hetID ],
|
|
71
|
+
[ 16, 20, Pdb_Integer, :numHetAtoms ]
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
# CONECT field
|
|
75
|
+
# It would be wrong because the definition described in documents
|
|
76
|
+
# seems ambiguous.
|
|
77
|
+
CONECT =
|
|
78
|
+
def_rec([ 12, 15, Pdb_Atom, :name ],
|
|
79
|
+
[ 19, 20, Pdb_Integer, :num ],
|
|
80
|
+
[ 21, 24, Pdb_Atom, :other_atoms ],
|
|
81
|
+
[ 26, 29, Pdb_Atom, :other_atoms ],
|
|
82
|
+
[ 31, 34, Pdb_Atom, :other_atoms ],
|
|
83
|
+
[ 36, 39, Pdb_Atom, :other_atoms ],
|
|
84
|
+
[ 41, 44, Pdb_Atom, :other_atoms ],
|
|
85
|
+
[ 46, 49, Pdb_Atom, :other_atoms ],
|
|
86
|
+
[ 51, 54, Pdb_Atom, :other_atoms ],
|
|
87
|
+
[ 56, 59, Pdb_Atom, :other_atoms ],
|
|
88
|
+
[ 61, 64, Pdb_Atom, :other_atoms ],
|
|
89
|
+
[ 66, 69, Pdb_Atom, :other_atoms ],
|
|
90
|
+
[ 71, 74, Pdb_Atom, :other_atoms ],
|
|
91
|
+
[ 76, 79, Pdb_Atom, :other_atoms ]
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
# HET field.
|
|
95
|
+
# It is the same as Bio::PDB::Record::HET.
|
|
96
|
+
HET = Bio::PDB::Record::HET
|
|
97
|
+
|
|
98
|
+
#--
|
|
99
|
+
#HETSYN = Bio::PDB::Record::HETSYN
|
|
100
|
+
#++
|
|
101
|
+
|
|
102
|
+
# HETSYN field.
|
|
103
|
+
# It is very similar to Bio::PDB::Record::HETSYN.
|
|
104
|
+
HETSYN =
|
|
105
|
+
def_rec([ 9, 10, Pdb_Continuation, nil ],
|
|
106
|
+
[ 12, 14, Pdb_LString(3), :hetID ],
|
|
107
|
+
[ 16, 70, Pdb_String, :hetSynonyms ]
|
|
108
|
+
)
|
|
109
|
+
|
|
110
|
+
# HETNAM field.
|
|
111
|
+
# It is the same as Bio::PDB::Record::HETNAM.
|
|
112
|
+
HETNAM = Bio::PDB::Record::HETNAM
|
|
113
|
+
|
|
114
|
+
# FORMUL field.
|
|
115
|
+
# It is the same as Bio::PDB::Record::FORMUL.
|
|
116
|
+
FORMUL = Bio::PDB::Record::FORMUL
|
|
117
|
+
|
|
118
|
+
# default definition for unknown fields.
|
|
119
|
+
Default = Bio::PDB::Record::Default
|
|
120
|
+
|
|
121
|
+
# Hash to store allowed definitions.
|
|
122
|
+
Definition = create_definition_hash
|
|
123
|
+
|
|
124
|
+
# END record class.
|
|
125
|
+
#
|
|
126
|
+
# Because END is a reserved word of Ruby, it is separately
|
|
127
|
+
# added to the hash
|
|
128
|
+
End = Bio::PDB::Record::End
|
|
129
|
+
Definition['END'] = End
|
|
130
|
+
|
|
131
|
+
# Look up the class in Definition hash
|
|
132
|
+
def self.get_record_class(str)
|
|
133
|
+
t = fetch_record_name(str)
|
|
134
|
+
return Definition[t]
|
|
135
|
+
end
|
|
136
|
+
end #class Record
|
|
137
|
+
|
|
138
|
+
# Creates a new object.
|
|
139
|
+
def initialize(str)
|
|
140
|
+
@data = str.split(/[\r\n]+/)
|
|
141
|
+
@hash = {}
|
|
142
|
+
|
|
143
|
+
#Flag to say whether the current line is part of a continuation
|
|
144
|
+
cont = false
|
|
145
|
+
|
|
146
|
+
#Goes through each line and replace that line with a PDB::Record
|
|
147
|
+
@data.collect! do |line|
|
|
148
|
+
#Go to next if the previous line was contiunation able, and
|
|
149
|
+
#add_continuation returns true. Line is added by add_continuation
|
|
150
|
+
next if cont and cont = cont.add_continuation(line)
|
|
151
|
+
|
|
152
|
+
#Make the new record
|
|
153
|
+
f = Record.get_record_class(line).new.initialize_from_string(line)
|
|
154
|
+
#p f
|
|
155
|
+
#Set cont
|
|
156
|
+
cont = f if f.continue?
|
|
157
|
+
#Set the hash to point to this record either by adding to an
|
|
158
|
+
#array, or on it's own
|
|
159
|
+
key = f.record_name
|
|
160
|
+
if a = @hash[key] then
|
|
161
|
+
a << f
|
|
162
|
+
else
|
|
163
|
+
@hash[key] = [ f ]
|
|
164
|
+
end
|
|
165
|
+
f
|
|
166
|
+
end #each
|
|
167
|
+
#At the end we need to add the final model
|
|
168
|
+
@data.compact!
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
# all records in this entry as an array.
|
|
172
|
+
attr_reader :data
|
|
173
|
+
|
|
174
|
+
# all records in this entry as an hash accessed by record names.
|
|
175
|
+
attr_reader :hash
|
|
176
|
+
|
|
177
|
+
# Identifier written in the first line "RESIDUE" record. (e.g. CMP)
|
|
178
|
+
def entry_id
|
|
179
|
+
@data[0].hetID
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
# Synonyms for the comical component. Returns an array of strings.
|
|
183
|
+
def hetsyn
|
|
184
|
+
unless defined? @hetsyn
|
|
185
|
+
if r = @hash["HETSYN"]
|
|
186
|
+
@hetsyn = r[0].hetSynonyms.to_s.split(/\;\s*/)
|
|
187
|
+
else
|
|
188
|
+
return []
|
|
189
|
+
end
|
|
190
|
+
end
|
|
191
|
+
@hetsyn
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
# The name of the chemical component.
|
|
195
|
+
# Returns a string (or nil, if the entry is something wrong).
|
|
196
|
+
def hetnam
|
|
197
|
+
@hash["HETNAM"][0].text
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
# The chemical formula of the chemical component.
|
|
201
|
+
# Returns a string (or nil, if the entry is something wrong).
|
|
202
|
+
def formul
|
|
203
|
+
@hash["FORMUL"][0].text
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
# Returns an hash of bindings of atoms.
|
|
207
|
+
# Note that each white spaces are stripped for atom symbols.
|
|
208
|
+
def conect
|
|
209
|
+
unless defined? @conect
|
|
210
|
+
c = {}
|
|
211
|
+
@hash["CONECT"].each do |e|
|
|
212
|
+
key = e.name.to_s.strip
|
|
213
|
+
unless key.empty?
|
|
214
|
+
val = e.other_atoms.collect { |x| x.strip }
|
|
215
|
+
#warn "Warning: #{key}: atom name conflict?" if c[key]
|
|
216
|
+
c[key] = val
|
|
217
|
+
end
|
|
218
|
+
end
|
|
219
|
+
@conect = c
|
|
220
|
+
end
|
|
221
|
+
@conect
|
|
222
|
+
end
|
|
223
|
+
|
|
224
|
+
# Gets all records whose record type is _name_.
|
|
225
|
+
# Returns an array of <code>Bio::PDB::Record::*</code> objects.
|
|
226
|
+
#
|
|
227
|
+
# if _name_ is nil, returns hash storing all record data.
|
|
228
|
+
#
|
|
229
|
+
# Example:
|
|
230
|
+
# p pdb.record('CONECT')
|
|
231
|
+
# p pdb.record['CONECT']
|
|
232
|
+
#
|
|
233
|
+
def record(name = nil)
|
|
234
|
+
name ? @hash[name] : @hash
|
|
235
|
+
end
|
|
236
|
+
|
|
237
|
+
end #class ChemicalComponent
|
|
238
|
+
end #class PDB
|
|
239
|
+
end #module Bio
|
|
240
|
+
|
data/lib/bio/db/pdb/pdb.rb
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
# Alex Gutteridge <alexg@ebi.ac.uk>
|
|
7
7
|
# License:: LGPL
|
|
8
8
|
#
|
|
9
|
-
# $Id: pdb.rb,v 1.
|
|
9
|
+
# $Id: pdb.rb,v 1.15 2006/02/20 13:00:43 ngoto Exp $
|
|
10
10
|
#
|
|
11
11
|
#--
|
|
12
12
|
# This library is free software; you can redistribute it and/or
|
|
@@ -86,19 +86,19 @@ module Bio
|
|
|
86
86
|
|
|
87
87
|
module Pdb_SList
|
|
88
88
|
def self.new(str)
|
|
89
|
-
str.strip.split(/\;\s*/)
|
|
89
|
+
str.to_s.strip.split(/\;\s*/)
|
|
90
90
|
end
|
|
91
91
|
end
|
|
92
92
|
|
|
93
93
|
module Pdb_List
|
|
94
94
|
def self.new(str)
|
|
95
|
-
str.strip.split(/\,\s*/)
|
|
95
|
+
str.to_s.strip.split(/\,\s*/)
|
|
96
96
|
end
|
|
97
97
|
end
|
|
98
98
|
|
|
99
99
|
module Pdb_Specification_list
|
|
100
100
|
def self.new(str)
|
|
101
|
-
a = str.strip.split(/\;\s*/)
|
|
101
|
+
a = str.to_s.strip.split(/\;\s*/)
|
|
102
102
|
a.collect! { |x| x.split(/\:\s*/, 2) }
|
|
103
103
|
a
|
|
104
104
|
end
|
|
@@ -106,7 +106,7 @@ module Bio
|
|
|
106
106
|
|
|
107
107
|
module Pdb_String
|
|
108
108
|
def self.new(str)
|
|
109
|
-
str.gsub(/\s+\z/, '')
|
|
109
|
+
str.to_s.gsub(/\s+\z/, '')
|
|
110
110
|
end
|
|
111
111
|
|
|
112
112
|
#Creates a new module with a string left justified to the
|
|
@@ -116,7 +116,7 @@ module Bio
|
|
|
116
116
|
m.module_eval %Q{
|
|
117
117
|
@@nn = nn
|
|
118
118
|
def self.new(str)
|
|
119
|
-
str.gsub(/\s+\z/, '').ljust(@@nn)[0, @@nn]
|
|
119
|
+
str.to_s.gsub(/\s+\z/, '').ljust(@@nn)[0, @@nn]
|
|
120
120
|
end
|
|
121
121
|
}
|
|
122
122
|
m
|
|
@@ -129,7 +129,7 @@ module Bio
|
|
|
129
129
|
m.module_eval %Q{
|
|
130
130
|
@@nn = nn
|
|
131
131
|
def self.new(str)
|
|
132
|
-
str.ljust(@@nn)[0, @@nn]
|
|
132
|
+
str.to_s.ljust(@@nn)[0, @@nn]
|
|
133
133
|
end
|
|
134
134
|
}
|
|
135
135
|
m
|
|
@@ -157,7 +157,7 @@ module Bio
|
|
|
157
157
|
|
|
158
158
|
module Pdb_StringRJ
|
|
159
159
|
def self.new(str)
|
|
160
|
-
str.gsub(/\A\s+/, '')
|
|
160
|
+
str.to_s.gsub(/\A\s+/, '')
|
|
161
161
|
end
|
|
162
162
|
end
|
|
163
163
|
|
|
@@ -1807,6 +1807,11 @@ module Bio
|
|
|
1807
1807
|
self.record('HEADER').first.classification
|
|
1808
1808
|
end
|
|
1809
1809
|
|
|
1810
|
+
# Get authors in "AUTHOR".
|
|
1811
|
+
def authors
|
|
1812
|
+
self.record('AUTHOR').first.authorList
|
|
1813
|
+
end
|
|
1814
|
+
|
|
1810
1815
|
#--
|
|
1811
1816
|
# Bio::DB methods
|
|
1812
1817
|
#++
|
data/lib/bio/db/rebase.rb
CHANGED
|
@@ -1,15 +1,99 @@
|
|
|
1
|
-
require 'bio/reference'
|
|
2
|
-
module Bio
|
|
3
|
-
|
|
4
1
|
#
|
|
5
|
-
# bio/db/rebase.rb - Interface for EMBOSS formatted REBASE files
|
|
2
|
+
# = bio/db/rebase.rb - Interface for EMBOSS formatted REBASE files
|
|
6
3
|
#
|
|
7
4
|
# Copyright:: Copyright (C) 2005 Trevor Wennblom <trevor@corevx.com>
|
|
8
5
|
# License:: LGPL
|
|
9
6
|
#
|
|
10
|
-
# $Id: rebase.rb,v 1.
|
|
7
|
+
# $Id: rebase.rb,v 1.3 2006/02/27 13:22:05 k Exp $
|
|
11
8
|
#
|
|
12
9
|
#
|
|
10
|
+
# == Synopsis
|
|
11
|
+
#
|
|
12
|
+
# Bio::REBASE provides utilties for interacting with REBASE data in EMBOSS
|
|
13
|
+
# format. REBASE is the Restriction Enzyme Database, more information
|
|
14
|
+
# can be found here:
|
|
15
|
+
#
|
|
16
|
+
|
|
17
|
+
# * http://rebase.neb.com
|
|
18
|
+
#
|
|
19
|
+
# EMBOSS formatted files located at:
|
|
20
|
+
#
|
|
21
|
+
# * http://rebase.neb.com/rebase/rebase.f37.html
|
|
22
|
+
#
|
|
23
|
+
# These files are the same as the "emboss_?.???" files located at:
|
|
24
|
+
#
|
|
25
|
+
# * ftp://ftp.neb.com/pub/rebase/
|
|
26
|
+
#
|
|
27
|
+
# To easily get started with the data you can simply type this command
|
|
28
|
+
# at your shell prompt:
|
|
29
|
+
#
|
|
30
|
+
# % wget ftp://ftp.neb.com/pub/rebase/emboss*
|
|
31
|
+
#
|
|
32
|
+
#
|
|
33
|
+
# == Usage
|
|
34
|
+
#
|
|
35
|
+
# require 'bio/db/rebase'
|
|
36
|
+
# require 'pp'
|
|
37
|
+
#
|
|
38
|
+
# enz = File.read('emboss_e')
|
|
39
|
+
# ref = File.read('emboss_r')
|
|
40
|
+
# sup = File.read('emboss_s')
|
|
41
|
+
#
|
|
42
|
+
# # When creating a new instance of Bio::REBASE
|
|
43
|
+
# # the contents of the enzyme file must be passed.
|
|
44
|
+
# # The references and suppiers file contents
|
|
45
|
+
# # may also be passed.
|
|
46
|
+
# rebase = Bio::REBASE.new( enz )
|
|
47
|
+
# rebase = Bio::REBASE.new( enz, ref )
|
|
48
|
+
# rebase = Bio::REBASE.new( enz, ref, sup )
|
|
49
|
+
#
|
|
50
|
+
# # The 'read' class method allows you to read in files
|
|
51
|
+
# # that are REBASE EMBOSS formatted
|
|
52
|
+
# rebase = Bio::REBASE.read( 'emboss_e' )
|
|
53
|
+
# rebase = Bio::REBASE.read( 'emboss_e', 'emboss_r' )
|
|
54
|
+
# rebase = Bio::REBASE.read( 'emboss_e', 'emboss_r', 'emboss_s' )
|
|
55
|
+
#
|
|
56
|
+
# # The data loaded may be saved in YAML format
|
|
57
|
+
# rebase.save_yaml( 'enz.yaml' )
|
|
58
|
+
# rebase.save_yaml( 'enz.yaml', 'ref.yaml' )
|
|
59
|
+
# rebase.save_yaml( 'enz.yaml', 'ref.yaml', 'sup.yaml' )
|
|
60
|
+
#
|
|
61
|
+
# # YAML formatted files can also be read with the
|
|
62
|
+
# # class method 'load_yaml'
|
|
63
|
+
# rebase = Bio::REBASE.load_yaml( 'enz.yaml' )
|
|
64
|
+
# rebase = Bio::REBASE.load_yaml( 'enz.yaml', 'ref.yaml' )
|
|
65
|
+
# rebase = Bio::REBASE.load_yaml( 'enz.yaml', 'ref.yaml', 'sup.yaml' )
|
|
66
|
+
#
|
|
67
|
+
# pp rebase.enzymes[0..4] # ["AarI", "AasI", "AatI", "AatII", "Acc16I"]
|
|
68
|
+
# pp rebase['AarI'].pattern # "CACCTGC"
|
|
69
|
+
# pp rebase['AarI'].blunt? # false
|
|
70
|
+
# pp rebase['AarI'].organism # "Arthrobacter aurescens SS2-322"
|
|
71
|
+
# pp rebase['AarI'].source # "A. Janulaitis"
|
|
72
|
+
# pp rebase['AarI'].primary_strand_cut1 # 11
|
|
73
|
+
# pp rebase['AarI'].primary_strand_cut2 # 0
|
|
74
|
+
# pp rebase['AarI'].complementary_strand_cut1 # 15
|
|
75
|
+
# pp rebase['AarI'].complementary_strand_cut2 # 0
|
|
76
|
+
# pp rebase['AarI'].suppliers # ["F"]
|
|
77
|
+
# pp rebase['AarI'].supplier_names # ["Fermentas International Inc."]
|
|
78
|
+
#
|
|
79
|
+
# pp rebase['AarI'].isoschizomers # Currently none stored in the references file
|
|
80
|
+
# pp rebase['AarI'].methylation # ""
|
|
81
|
+
#
|
|
82
|
+
# pp rebase['EcoRII'].methylation # "2(5)"
|
|
83
|
+
# pp rebase['EcoRII'].suppliers # ["F", "J", "M", "O", "S"]
|
|
84
|
+
# pp rebase['EcoRII'].supplier_names # ["Fermentas International Inc.", "Nippon Gene Co., Ltd.",
|
|
85
|
+
# # "Roche Applied Science", "Toyobo Biochemicals",
|
|
86
|
+
# # "Sigma Chemical Corporation"]
|
|
87
|
+
#
|
|
88
|
+
# # Number of enzymes in the database
|
|
89
|
+
# pp rebase.size # 673
|
|
90
|
+
# pp rebase.enzymes.size # 673
|
|
91
|
+
#
|
|
92
|
+
# rebase.each do |name, info|
|
|
93
|
+
# pp "#{name}: #{info.methylation}" unless info.methylation.empty?
|
|
94
|
+
# end
|
|
95
|
+
#
|
|
96
|
+
#
|
|
13
97
|
#--
|
|
14
98
|
#
|
|
15
99
|
# This library is free software; you can redistribute it and/or
|
|
@@ -28,104 +112,15 @@ module Bio
|
|
|
28
112
|
#
|
|
29
113
|
#++
|
|
30
114
|
#
|
|
31
|
-
#
|
|
32
|
-
|
|
33
|
-
=begin rdoc
|
|
34
|
-
bio/db/rebase.rb - Interface for EMBOSS formatted REBASE files
|
|
35
|
-
|
|
36
|
-
== Synopsis
|
|
37
|
-
|
|
38
|
-
Bio::REBASE provides utilties for interacting with REBASE data in EMBOSS
|
|
39
|
-
format. REBASE is the Restriction Enzyme Database, more information
|
|
40
|
-
can be found here:
|
|
41
|
-
* http://rebase.neb.com
|
|
42
|
-
|
|
43
|
-
EMBOSS formatted files located at:
|
|
44
|
-
* http://rebase.neb.com/rebase/rebase.f37.html
|
|
45
|
-
|
|
46
|
-
These files are the same as the "emboss_?.???" files located at:
|
|
47
|
-
* ftp://ftp.neb.com/pub/rebase/
|
|
48
|
-
|
|
49
|
-
To easily get started with the data you can simply type this command at your shell prompt:
|
|
50
|
-
wget ftp://ftp.neb.com/pub/rebase/emboss*
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
== Usage
|
|
54
|
-
|
|
55
|
-
require 'bio/db/rebase'
|
|
56
|
-
require 'pp'
|
|
57
|
-
|
|
58
|
-
enz = File.read('emboss_e')
|
|
59
|
-
ref = File.read('emboss_r')
|
|
60
|
-
sup = File.read('emboss_s')
|
|
61
|
-
|
|
62
|
-
# When creating a new instance of Bio::REBASE
|
|
63
|
-
# the contents of the enzyme file must be passed.
|
|
64
|
-
# The references and suppiers file contents
|
|
65
|
-
# may also be passed.
|
|
66
|
-
rebase = Bio::REBASE.new( enz )
|
|
67
|
-
rebase = Bio::REBASE.new( enz, ref )
|
|
68
|
-
rebase = Bio::REBASE.new( enz, ref, sup )
|
|
69
|
-
|
|
70
|
-
# The 'read' class method allows you to read in files
|
|
71
|
-
# that are REBASE EMBOSS formatted
|
|
72
|
-
rebase = Bio::REBASE.read( 'emboss_e' )
|
|
73
|
-
rebase = Bio::REBASE.read( 'emboss_e', 'emboss_r' )
|
|
74
|
-
rebase = Bio::REBASE.read( 'emboss_e', 'emboss_r', 'emboss_s' )
|
|
75
|
-
|
|
76
|
-
# The data loaded may be saved in YAML format
|
|
77
|
-
rebase.save_yaml( 'enz.yaml' )
|
|
78
|
-
rebase.save_yaml( 'enz.yaml', 'ref.yaml' )
|
|
79
|
-
rebase.save_yaml( 'enz.yaml', 'ref.yaml', 'sup.yaml' )
|
|
80
|
-
|
|
81
|
-
# YAML formatted files can also be read with the
|
|
82
|
-
# class method 'load_yaml'
|
|
83
|
-
rebase = Bio::REBASE.load_yaml( 'enz.yaml' )
|
|
84
|
-
rebase = Bio::REBASE.load_yaml( 'enz.yaml', 'ref.yaml' )
|
|
85
|
-
rebase = Bio::REBASE.load_yaml( 'enz.yaml', 'ref.yaml', 'sup.yaml' )
|
|
86
|
-
|
|
87
|
-
pp rebase.enzymes[0..4] # ["AarI", "AasI", "AatI", "AatII", "Acc16I"]
|
|
88
|
-
pp rebase['AarI'].pattern # "CACCTGC"
|
|
89
|
-
pp rebase['AarI'].blunt? # false
|
|
90
|
-
pp rebase['AarI'].organism # "Arthrobacter aurescens SS2-322"
|
|
91
|
-
pp rebase['AarI'].source # "A. Janulaitis"
|
|
92
|
-
pp rebase['AarI'].primary_strand_cut1 # 11
|
|
93
|
-
pp rebase['AarI'].primary_strand_cut2 # 0
|
|
94
|
-
pp rebase['AarI'].complementary_strand_cut1 # 15
|
|
95
|
-
pp rebase['AarI'].complementary_strand_cut2 # 0
|
|
96
|
-
pp rebase['AarI'].suppliers # ["F"]
|
|
97
|
-
pp rebase['AarI'].supplier_names # ["Fermentas International Inc."]
|
|
98
|
-
|
|
99
|
-
pp rebase['AarI'].isoschizomers # Currently none stored in the references file
|
|
100
|
-
pp rebase['AarI'].methylation # ""
|
|
101
|
-
|
|
102
|
-
pp rebase['EcoRII'].methylation # "2(5)"
|
|
103
|
-
pp rebase['EcoRII'].suppliers # ["F", "J", "M", "O", "S"]
|
|
104
|
-
pp rebase['EcoRII'].supplier_names # ["Fermentas International Inc.", "Nippon Gene Co., Ltd.",
|
|
105
|
-
# "Roche Applied Science", "Toyobo Biochemicals",
|
|
106
|
-
# "Sigma Chemical Corporation"]
|
|
107
|
-
|
|
108
|
-
# Number of enzymes in the database
|
|
109
|
-
pp rebase.size # 673
|
|
110
|
-
pp rebase.enzymes.size # 673
|
|
111
|
-
|
|
112
|
-
rebase.each do |name, info|
|
|
113
|
-
pp "#{name}: #{info.methylation}" unless info.methylation.empty?
|
|
114
|
-
end
|
|
115
|
-
|
|
116
115
|
|
|
117
|
-
|
|
118
|
-
Trevor Wennblom <trevor@corevx.com>
|
|
116
|
+
autoload :YAML, 'yaml'
|
|
119
117
|
|
|
118
|
+
module Bio
|
|
120
119
|
|
|
121
|
-
|
|
122
|
-
Copyright (C) 2005 Trevor Wennblom
|
|
123
|
-
Licensed under the same terms as BioRuby.
|
|
120
|
+
autoload :Reference, 'reference'
|
|
124
121
|
|
|
125
|
-
=end
|
|
126
122
|
|
|
127
123
|
class REBASE
|
|
128
|
-
autoload(:YAML, 'yaml')
|
|
129
124
|
|
|
130
125
|
class DynamicMethod_Hash < Hash
|
|
131
126
|
# Define a writer or reader
|
|
@@ -414,4 +409,5 @@ class REBASE
|
|
|
414
409
|
end
|
|
415
410
|
|
|
416
411
|
end # REBASE
|
|
412
|
+
|
|
417
413
|
end # Bio
|