From k at pub.open-bio.org Sun Aug 7 04:13:45 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sun Aug 7 04:59:23 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/db medline.rb,1.10,1.11 Message-ID: <200508070813.j778DjdZ018033@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/db In directory pub.open-bio.org:/tmp/cvs-serv18029/lib/bio/db Modified Files: medline.rb Log Message: * publication_type method is added Index: medline.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/medline.rb,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** medline.rb 8 Feb 2004 00:30:54 -0000 1.10 --- medline.rb 7 Aug 2005 08:13:42 -0000 1.11 *************** *** 2,6 **** # bio/db/medline.rb - NCBI PubMed/MEDLINE database class # ! # Copyright (C) 2001 KATAYAMA Toshiaki # # This library is free software; you can redistribute it and/or --- 2,6 ---- # bio/db/medline.rb - NCBI PubMed/MEDLINE database class # ! # Copyright (C) 2001, 2005 KATAYAMA Toshiaki # # This library is free software; you can redistribute it and/or *************** *** 262,265 **** --- 262,269 ---- # PT - Publication Type # The type of material the article represents. + def pt + @pubmed['PT'].strip.split(/\n/) + end + alias publication_type pt # RF - Number of References From k at pub.open-bio.org Sun Aug 7 04:19:30 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sun Aug 7 05:06:07 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/data aa.rb,0.7,0.8 na.rb,0.8,0.9 Message-ID: <200508070819.j778JUdZ018085@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/data In directory pub.open-bio.org:/tmp/cvs-serv18079/lib/bio/data Modified Files: aa.rb na.rb Log Message: * Bio::NucleicAcid, Bio::AminoAcid classes are refactored to have Data module and this module is included and extended to make methods as both of instance methods and extend methods * Bio::Sequence::NA class is rewrited (molecular_weight, to_re methods) to use Bio::NucleicAcid * molecular_weight method is fixed to subtract two hydrogens for each base Index: aa.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/data/aa.rb,v retrieving revision 0.7 retrieving revision 0.8 diff -C2 -d -r0.7 -r0.8 *** aa.rb 14 May 2004 03:03:40 -0000 0.7 --- aa.rb 7 Aug 2005 08:19:28 -0000 0.8 *************** *** 2,6 **** # bio/data/aa.rb - Amino Acids # ! # Copyright (C) 2001 KATAYAMA Toshiaki # # This library is free software; you can redistribute it and/or --- 2,6 ---- # bio/data/aa.rb - Amino Acids # ! # Copyright (C) 2001, 2005 KATAYAMA Toshiaki # # This library is free software; you can redistribute it and/or *************** *** 25,81 **** class AminoAcid ! # IUPAC code ! # * http://www.iupac.org/ ! # * http://www.chem.qmw.ac.uk/iubmb/newsletter/1999/item3.html ! ! Names= { ! 'A' => 'Ala', ! 'C' => 'Cys', ! 'D' => 'Asp', ! 'E' => 'Glu', ! 'F' => 'Phe', ! 'G' => 'Gly', ! 'H' => 'His', ! 'I' => 'Ile', ! 'K' => 'Lys', ! 'L' => 'Leu', ! 'M' => 'Met', ! 'N' => 'Asn', ! 'P' => 'Pro', ! 'Q' => 'Gln', ! 'R' => 'Arg', ! 'S' => 'Ser', ! 'T' => 'Thr', ! 'V' => 'Val', ! 'W' => 'Trp', ! 'Y' => 'Tyr', ! 'U' => 'Sec', ! 'Ala' => 'alanine', ! 'Cys' => 'cysteine', ! 'Asp' => 'aspartic acid', ! 'Glu' => 'glutamic acid', ! 'Phe' => 'phenylalanine', ! 'Gly' => 'glycine', ! 'His' => 'histidine', ! 'Ile' => 'isoleucine', ! 'Lys' => 'lysine', ! 'Leu' => 'leucine', ! 'Met' => 'methionine', ! 'Asn' => 'asparagine', ! 'Pro' => 'proline', ! 'Gln' => 'glutamine', ! 'Arg' => 'arginine', ! 'Ser' => 'serine', ! 'Thr' => 'threonine', ! 'Val' => 'valine', ! 'Trp' => 'tryptophan', ! 'Tyr' => 'tyrosine', ! 'Sec' => 'selenocysteine', ! } ! Weight = { # AAindex FASG760101 - Molecular weight (Fasman, 1976) --- 25,87 ---- class AminoAcid ! module Data ! # IUPAC code ! # * http://www.iupac.org/ ! # * http://www.chem.qmw.ac.uk/iubmb/newsletter/1999/item3.html ! Names= { ! 'A' => 'Ala', ! 'C' => 'Cys', ! 'D' => 'Asp', ! 'E' => 'Glu', ! 'F' => 'Phe', ! 'G' => 'Gly', ! 'H' => 'His', ! 'I' => 'Ile', ! 'K' => 'Lys', ! 'L' => 'Leu', ! 'M' => 'Met', ! 'N' => 'Asn', ! 'P' => 'Pro', ! 'Q' => 'Gln', ! 'R' => 'Arg', ! 'S' => 'Ser', ! 'T' => 'Thr', ! 'V' => 'Val', ! 'W' => 'Trp', ! 'Y' => 'Tyr', ! 'B' => 'Asx', # D/N ! 'Z' => 'Glx', # E/Q ! 'U' => 'Sec', # 'uga' (stop) ! '?' => 'Pyl', # 'uag' (stop) ! ! 'Ala' => 'alanine', ! 'Cys' => 'cysteine', ! 'Asp' => 'aspartic acid', ! 'Glu' => 'glutamic acid', ! 'Phe' => 'phenylalanine', ! 'Gly' => 'glycine', ! 'His' => 'histidine', ! 'Ile' => 'isoleucine', ! 'Lys' => 'lysine', ! 'Leu' => 'leucine', ! 'Met' => 'methionine', ! 'Asn' => 'asparagine', ! 'Pro' => 'proline', ! 'Gln' => 'glutamine', ! 'Arg' => 'arginine', ! 'Ser' => 'serine', ! 'Thr' => 'threonine', ! 'Val' => 'valine', ! 'Trp' => 'tryptophan', ! 'Tyr' => 'tyrosine', ! 'Asx' => 'asparagine/aspartic acid', ! 'Glx' => 'glutamine/glutamic acid', ! 'Sec' => 'selenocysteine', ! 'Pyl' => 'pyrrolysine', ! } # AAindex FASG760101 - Molecular weight (Fasman, 1976) *************** *** 84,109 **** # Proteins - Volume 1, CRC Press, Cleveland (1976) ! 'A' => 89.09, ! 'C' => 121.15, ! 'D' => 133.10, ! 'E' => 147.13, ! 'F' => 165.19, ! 'G' => 75.07, ! 'H' => 155.16, ! 'I' => 131.17, ! 'K' => 146.19, ! 'L' => 131.17, ! 'M' => 149.21, ! 'N' => 132.12, ! 'P' => 115.13, ! 'Q' => 146.15, ! 'R' => 174.20, ! 'S' => 105.09, ! 'T' => 119.12, ! 'U' => 168.06, ! 'V' => 117.15, ! 'W' => 204.23, ! 'Y' => 181.19, ! } def aa --- 90,229 ---- # Proteins - Volume 1, CRC Press, Cleveland (1976) ! Weight = { ! ! 'A' => 89.09, ! 'C' => 121.15, # 121.16 according to the Wikipedia ! 'D' => 133.10, ! 'E' => 147.13, ! 'F' => 165.19, ! 'G' => 75.07, ! 'H' => 155.16, ! 'I' => 131.17, ! 'K' => 146.19, ! 'L' => 131.17, ! 'M' => 149.21, ! 'N' => 132.12, ! 'P' => 115.13, ! 'Q' => 146.15, ! 'R' => 174.20, ! 'S' => 105.09, ! 'T' => 119.12, ! 'U' => 168.06, ! 'V' => 117.15, ! 'W' => 204.23, ! 'Y' => 181.19, ! } ! ! def weight(x = nil) ! if x ! Weight[x] ! else ! Weight ! end ! end ! ! def [](x) ! Names[x] ! end ! ! def name(x) ! str = Names[x] ! if str and str.length == 3 ! Names[str] ! else ! str ! end ! end ! ! def to_1(x) ! case x.to_s.length ! when 1 ! x ! when 3 ! three2one(x) ! else ! name2one(x) ! end ! end ! ! def to_3(x) ! case x.to_s.length ! when 1 ! one2three(x) ! when 3 ! x ! else ! name2three(x) ! end ! end ! ! def one2three(x) ! if x and x.length != 1 ! raise ArgumentError ! else ! Names[x] ! end ! end ! ! def three2one(x) ! if x and x.length != 3 ! raise ArgumentError ! else ! reverse[x] ! end ! end ! ! def one2name(x) ! if x and x.length != 1 ! raise ArgumentError ! else ! Names[x] ! end ! end ! ! def name2one(x) ! str = reverse[x.to_s.downcase] ! if str and str.length == 3 ! reverse[str] ! else ! str ! end ! end ! ! def three2name(x) ! if x and x.length != 3 ! raise ArgumentError ! else ! Names[x] ! end ! end ! ! def name2three(x) ! reverse[x.downcase] ! end ! ! private ! ! def reverse ! hash = Hash.new ! Names.each do |k, v| ! hash[v] = k ! end ! hash ! end ! ! end ! ! ! # as instance methods ! include Data ! ! # as class methods ! extend Data ! ! ! # backward compatibility ! Names = Data::Names ! Weight = Data::Weight def aa *************** *** 115,123 **** end ! def self.weight ! Weight end end end --- 235,324 ---- end ! private ! ! alias :orig_reverse :reverse ! def reverse ! unless @reverse ! @reverse = orig_reverse ! end ! @reverse end end + + end + + + if __FILE__ == $0 + + puts "### aa = Bio::AminoAcid.new" + aa = Bio::AminoAcid.new + + puts "# Bio::AminoAcid['A']" + p Bio::AminoAcid['A'] + puts "# aa['A']" + p aa['A'] + + puts "# Bio::AminoAcid.name('A')" + p Bio::AminoAcid.name('A') + puts "# aa.name('A')" + p aa.name('A') + + puts "# Bio::AminoAcid.to_1('alanine')" + p Bio::AminoAcid.to_1('alanine') + puts "# aa.to_1('alanine')" + p aa.to_1('alanine') + puts "# Bio::AminoAcid.to_1('Ala')" + p Bio::AminoAcid.to_1('Ala') + puts "# aa.to_1('Ala')" + p aa.to_1('Ala') + puts "# Bio::AminoAcid.to_1('A')" + p Bio::AminoAcid.to_1('A') + puts "# aa.to_1('A')" + p aa.to_1('A') + + puts "# Bio::AminoAcid.to_3('alanine')" + p Bio::AminoAcid.to_3('alanine') + puts "# aa.to_3('alanine')" + p aa.to_3('alanine') + puts "# Bio::AminoAcid.to_3('Ala')" + p Bio::AminoAcid.to_3('Ala') + puts "# aa.to_3('Ala')" + p aa.to_3('Ala') + puts "# Bio::AminoAcid.to_3('A')" + p Bio::AminoAcid.to_3('A') + puts "# aa.to_3('A')" + p aa.to_3('A') + + + puts "# Bio::AminoAcid.one2three('A')" + p Bio::AminoAcid.one2three('A') + puts "# aa.one2three('A')" + p aa.one2three('A') + + puts "# Bio::AminoAcid.three2one('Ala')" + p Bio::AminoAcid.three2one('Ala') + puts "# aa.three2one('Ala')" + p aa.three2one('Ala') + + puts "# Bio::AminoAcid.one2name('A')" + p Bio::AminoAcid.one2name('A') + puts "# aa.one2name('A')" + p aa.one2name('A') + + puts "# Bio::AminoAcid.name2one('alanine')" + p Bio::AminoAcid.name2one('alanine') + puts "# aa.name2one('alanine')" + p aa.name2one('alanine') + + puts "# Bio::AminoAcid.three2name('Ala')" + p Bio::AminoAcid.three2name('Ala') + puts "# aa.three2name('Ala')" + p aa.three2name('Ala') + + puts "# Bio::AminoAcid.name2three('alanine')" + p Bio::AminoAcid.name2three('alanine') + puts "# aa.name2three('alanine')" + p aa.name2three('alanine') end Index: na.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/data/na.rb,v retrieving revision 0.8 retrieving revision 0.9 diff -C2 -d -r0.8 -r0.9 *** na.rb 22 Nov 2002 23:10:12 -0000 0.8 --- na.rb 7 Aug 2005 08:19:28 -0000 0.9 *************** *** 25,78 **** class NucleicAcid ! # IUPAC code ! # * Faisst and Meyer (Nucleic Acids Res. 20:3-26, 1992) ! # * http://www.ncbi.nlm.nih.gov/collab/FT/ ! Names = { ! 'y' => '[tc]', # pYrimidine ! 'r' => '[ag]', # puRine ! 'w' => '[at]', # Weak ! 's' => '[gc]', # Strong ! 'k' => '[tg]', # Keto ! 'm' => '[ac]', # aMino ! 'b' => '[tgc]', # not A ! 'd' => '[atg]', # not C ! 'h' => '[atc]', # not G ! 'v' => '[agc]', # not T ! 'n' => '[atgc]', ! 'a' => 'a', ! 't' => 't', ! 'g' => 'g', ! 'c' => 'c', ! 'u' => 'u', ! 'A' => 'adenine', ! 'T' => 'thymine', ! 'G' => 'guanine', ! 'C' => 'cytosine', ! 'U' => 'uracil', ! } ! Weight = { ! # Calculated by BioPerl's Bio::Tools::SeqStats.pm :-) ! :adenine => 135.15, ! :thymine => 126.13, ! :guanine => 151.15, ! :cytosine => 111.12, ! :uracil => 112.10, ! :deoxyribose_phosphate => 196.11, ! :ribose_phosphate => 212.11, ! :water => 18.015, ! } def na --- 25,146 ---- class NucleicAcid ! module Data ! # IUPAC code ! # * Faisst and Meyer (Nucleic Acids Res. 20:3-26, 1992) ! # * http://www.ncbi.nlm.nih.gov/collab/FT/ ! Names = { ! 'y' => '[tc]', # pYrimidine ! 'r' => '[ag]', # puRine ! 'w' => '[at]', # Weak ! 's' => '[gc]', # Strong ! 'k' => '[tg]', # Keto ! 'm' => '[ac]', # aMino ! 'b' => '[tgc]', # not A ! 'd' => '[atg]', # not C ! 'h' => '[atc]', # not G ! 'v' => '[agc]', # not T ! 'n' => '[atgc]', ! 'a' => 'a', ! 't' => 't', ! 'g' => 'g', ! 'c' => 'c', ! 'u' => 'u', ! 'A' => 'adenine', ! 'T' => 'thymine', ! 'G' => 'guanine', ! 'C' => 'cytosine', ! 'U' => 'uracil', ! } ! Weight = { ! # Calculated by BioPerl's Bio::Tools::SeqStats.pm :-) ! 'a' => 135.15, ! 't' => 126.13, ! 'g' => 151.15, ! 'c' => 111.12, ! 'u' => 112.10, ! :adenine => 135.15, ! :thymine => 126.13, ! :guanine => 151.15, ! :cytosine => 111.12, ! :uracil => 112.10, ! :deoxyribose_phosphate => 196.11, ! :ribose_phosphate => 212.11, ! ! :hydrogen => 1.00, ! :water => 18.015, ! ! } ! ! def weight(x = nil, rna = nil) ! if x ! if x.length > 1 ! if rna ! phosphate = Weight[:ribose_phosphate] ! else ! phosphate = Weight[:deoxyribose_phosphate] ! end ! hydrogen = Weight[:hydrogen] ! water = Weight[:water] ! ! total = 0.0 ! x.each_byte do |byte| ! base = byte.chr.downcase ! total += Weight[base] + phosphate - hydrogen * 2 ! end ! total -= water * (x.length - 1) ! else ! Weight[x.to_s.downcase] ! end ! else ! Weight ! end ! end ! ! def [](x) ! Names[x] ! end ! ! def name(x) ! Names[x.to_s.upcase] ! end ! ! def to_re(seq) ! str = "" ! seq.to_s.downcase.each_byte do |base| ! if re = Names[base.chr] ! str += re ! else ! str += "." ! end ! end ! Regexp.new(str) ! end ! ! end ! ! ! # as instance methods ! include Data ! ! # as class methods ! extend Data ! ! ! # backward compatibility ! Names = Data::Names ! Weight = Data::Weight def na *************** *** 84,93 **** end - def self.weight - Weight - end - end end --- 152,182 ---- end end end + + if __FILE__ == $0 + + puts "### na = Bio::NucleicAcid.new" + na = Bio::NucleicAcid.new + + puts "# na.to_re('yrwskmbdhvnatgc')" + p na.to_re('yrwskmbdhvnatgc') + + puts "# Bio::NucleicAcid.to_re('yrwskmbdhvnatgc')" + p Bio::NucleicAcid.to_re('yrwskmbdhvnatgc') + + puts "# na.weight('A')" + p na.weight('A') + + puts "# Bio::NucleicAcid.weight('A')" + p Bio::NucleicAcid.weight('A') + + puts "# na.weight('atgc')" + p na.weight('atgc') + + puts "# Bio::NucleicAcid.weight('atgc')" + p Bio::NucleicAcid.weight('atgc') + + end From k at pub.open-bio.org Sun Aug 7 04:19:31 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sun Aug 7 05:06:10 2005 Subject: [BioRuby-cvs] bioruby/lib/bio sequence.rb,0.36,0.37 Message-ID: <200508070819.j778JVdZ018090@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio In directory pub.open-bio.org:/tmp/cvs-serv18079/lib/bio Modified Files: sequence.rb Log Message: * Bio::NucleicAcid, Bio::AminoAcid classes are refactored to have Data module and this module is included and extended to make methods as both of instance methods and extend methods * Bio::Sequence::NA class is rewrited (molecular_weight, to_re methods) to use Bio::NucleicAcid * molecular_weight method is fixed to subtract two hydrogens for each base Index: sequence.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/sequence.rb,v retrieving revision 0.36 retrieving revision 0.37 diff -C2 -d -r0.36 -r0.37 *** sequence.rb 23 Aug 2004 23:46:57 -0000 0.36 --- sequence.rb 7 Aug 2005 08:19:28 -0000 0.37 *************** *** 239,277 **** # NucleicAcid is defined in bio/data/na.rb ! def molecular_weight(hash = nil) ! nw = NucleicAcid.weight ! if self.rna? ! hash = { ! 'g' => nw[:guanine] + nw[:ribose_phosphate] - nw[:water], ! 'c' => nw[:cytosine] + nw[:ribose_phosphate] - nw[:water], ! 'a' => nw[:adenine] + nw[:ribose_phosphate] - nw[:water], ! 'u' => nw[:uracil] + nw[:ribose_phosphate] - nw[:water], ! } ! else ! hash = { ! 'g' => nw[:guanine] + nw[:deoxyribose_phosphate] - nw[:water], ! 'c' => nw[:cytosine] + nw[:deoxyribose_phosphate] - nw[:water], ! 'a' => nw[:adenine] + nw[:deoxyribose_phosphate] - nw[:water], ! 't' => nw[:thymine] + nw[:deoxyribose_phosphate] - nw[:water], ! } ! end unless hash ! total(hash) + nw[:water] end # NucleicAcid is defined in bio/data/na.rb def to_re - hash = NucleicAcid.names if self.rna? ! NucleicAcid.names.each {|k,v| hash[k] = v.tr('t', 'u')} ! end ! re = '' ! self.each_byte do |x| ! if hash[x.chr] ! re += hash[x.chr] ! else ! re += '.' ! end ! end ! return Regexp.new(re) end --- 239,257 ---- # NucleicAcid is defined in bio/data/na.rb ! def molecular_weight ! if self.rna? ! NucleicAcid.weight(self, true) ! else ! NucleicAcid.weight(self) ! end end # NucleicAcid is defined in bio/data/na.rb def to_re if self.rna? ! NucleicAcid.to_re(self.dna) ! else ! NucleicAcid.to_re(self) ! end end From k at pub.open-bio.org Sun Aug 7 04:22:34 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sun Aug 7 05:08:16 2005 Subject: [BioRuby-cvs] bioruby gemspec.rb,1.1,1.2 Message-ID: <200508070822.j778MYdZ021337@pub.open-bio.org> Update of /home/repository/bioruby/bioruby In directory pub.open-bio.org:/tmp/cvs-serv20415 Modified Files: gemspec.rb Log Message: * prepared for 0.6.3 Index: gemspec.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/gemspec.rb,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** gemspec.rb 28 Jun 2005 14:14:53 -0000 1.1 --- gemspec.rb 7 Aug 2005 08:22:32 -0000 1.2 *************** *** 4,8 **** spec = Gem::Specification.new do |s| s.name = 'bioruby' ! s.version = "0.6.2" s.author = "BioRuby project" s.email = "staff@bioruby.org" --- 4,8 ---- spec = Gem::Specification.new do |s| s.name = 'bioruby' ! s.version = "0.6.3" s.author = "BioRuby project" s.email = "staff@bioruby.org" From k at pub.open-bio.org Sun Aug 7 04:23:39 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sun Aug 7 05:09:14 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/db/kegg compound.rb,0.9,0.10 Message-ID: <200508070823.j778NddZ026834@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/db/kegg In directory pub.open-bio.org:/tmp/cvs-serv24591/lib/bio/db/kegg Modified Files: compound.rb Log Message: * entry_id method is fixed to return the first word in the ENTRY line Index: compound.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/kegg/compound.rb,v retrieving revision 0.9 retrieving revision 0.10 diff -C2 -d -r0.9 -r0.10 *** compound.rb 22 Oct 2004 10:00:39 -0000 0.9 --- compound.rb 7 Aug 2005 08:23:37 -0000 0.10 *************** *** 1,4 **** # ! # bio/db/kegg/compound.rb - KEGG/COMPOUND database class # # Copyright (C) 2001, 2002, 2004 KATAYAMA Toshiaki --- 1,4 ---- # ! # bio/db/kegg/compound.rb - KEGG COMPOUND database class # # Copyright (C) 2001, 2002, 2004 KATAYAMA Toshiaki *************** *** 38,42 **** # ENTRY def entry_id ! field_fetch('ENTRY') end --- 38,45 ---- # ENTRY def entry_id ! unless @data['ENTRY'] ! @data['ENTRY'] = fetch('ENTRY').split(/\s+/).first ! end ! @data['ENTRY'] end From k at pub.open-bio.org Sun Aug 7 04:26:40 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sun Aug 7 05:12:15 2005 Subject: [BioRuby-cvs] bioruby/lib/bio db.rb,0.26,0.27 Message-ID: <200508070826.j778QedZ026884@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio In directory pub.open-bio.org:/tmp/cvs-serv26880/lib/bio Modified Files: db.rb Log Message: * entry string is changed to be stripped before passed to entry2hash method in initialize Index: db.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db.rb,v retrieving revision 0.26 retrieving revision 0.27 diff -C2 -d -r0.26 -r0.27 *** db.rb 20 Jun 2004 10:30:06 -0000 0.26 --- db.rb 7 Aug 2005 08:26:38 -0000 0.27 *************** *** 91,95 **** def initialize(entry, tagsize) @tagsize = tagsize ! @orig = entry2hash(entry) # Hash of the original entry @data = {} # Hash of the parsed entry end --- 91,95 ---- def initialize(entry, tagsize) @tagsize = tagsize ! @orig = entry2hash(entry.strip) # Hash of the original entry @data = {} # Hash of the parsed entry end *************** *** 131,135 **** def initialize(entry, tagsize) @tagsize = tagsize ! @orig = entry2hash(entry) # Hash of the original entry @data = {} # Hash of the parsed entry end --- 131,135 ---- def initialize(entry, tagsize) @tagsize = tagsize ! @orig = entry2hash(entry.strip) # Hash of the original entry @data = {} # Hash of the parsed entry end From k at pub.open-bio.org Sun Aug 7 05:49:25 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sun Aug 7 06:35:43 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/io keggapi.rb,1.7,1.8 Message-ID: <200508070949.j779nPdZ027021@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/io In directory pub.open-bio.org:/tmp/cvs-serv27017/lib/bio/io Modified Files: keggapi.rb Log Message: * fixed to avoid adding nil to string Index: keggapi.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/io/keggapi.rb,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** keggapi.rb 24 Aug 2004 00:07:28 -0000 1.7 --- keggapi.rb 7 Aug 2005 09:49:22 -0000 1.8 *************** *** 42,46 **** def method_missing(*arg) ! results = @driver.send(*arg) results = add_filter(results) return results --- 42,50 ---- def method_missing(*arg) ! begin ! results = @driver.send(*arg) ! rescue Timeout::Error ! retry ! end results = add_filter(results) return results *************** *** 106,110 **** 0.step(ary.length, step) do |i| str = ary[i, step].join(" ") ! result << @driver.send(:bget, str) end return result --- 110,116 ---- 0.step(ary.length, step) do |i| str = ary[i, step].join(" ") ! if entry = @driver.send(:bget, str) ! result << entry.to_s ! end end return result *************** *** 116,120 **** 0.step(ary.length, step) do |i| str = "-f -n a " + ary[i, step].join(" ") ! result << @driver.send(:bget, str) end return result --- 122,128 ---- 0.step(ary.length, step) do |i| str = "-f -n a " + ary[i, step].join(" ") ! if entry = @driver.send(:bget, str) ! result << entry.to_s ! end end return result *************** *** 126,130 **** 0.step(ary.length, step) do |i| str = "-f -n n " + ary[i, step].join(" ") ! result << @driver.send(:bget, str) end return result --- 134,140 ---- 0.step(ary.length, step) do |i| str = "-f -n n " + ary[i, step].join(" ") ! if entry = @driver.send(:bget, str) ! result << entry.to_s ! end end return result *************** *** 136,140 **** 0.step(ary.length, step) do |i| str = ary[i, step].join(" ") ! result << @driver.send(:btit, str) end return result --- 146,152 ---- 0.step(ary.length, step) do |i| str = ary[i, step].join(" ") ! if entry = @driver.send(:bget, str) ! result << entry.to_s ! end end return result From k at pub.open-bio.org Sun Aug 7 05:58:24 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sun Aug 7 06:44:00 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/data aa.rb,0.8,0.9 na.rb,0.9,0.10 Message-ID: <200508070958.j779wOdZ027069@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/data In directory pub.open-bio.org:/tmp/cvs-serv27061/lib/bio/data Modified Files: aa.rb na.rb Log Message: * fixed Bio::Sequence::AA#molecular_weight to use AminoAcid#weight also Index: aa.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/data/aa.rb,v retrieving revision 0.8 retrieving revision 0.9 diff -C2 -d -r0.8 -r0.9 *** aa.rb 7 Aug 2005 08:19:28 -0000 0.8 --- aa.rb 7 Aug 2005 09:58:21 -0000 0.9 *************** *** 117,121 **** def weight(x = nil) if x ! Weight[x] else Weight --- 117,130 ---- def weight(x = nil) if x ! if x.length > 1 ! total = 0.0 ! x.each_byte do |byte| ! aa = byte.chr.upcase ! total += Weight[aa] ! end ! total -= NucleicAcid.weight[:water] * (x.length - 1) ! else ! Weight[x] ! end else Weight Index: na.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/data/na.rb,v retrieving revision 0.9 retrieving revision 0.10 diff -C2 -d -r0.9 -r0.10 *** na.rb 7 Aug 2005 08:19:28 -0000 0.9 --- na.rb 7 Aug 2005 09:58:21 -0000 0.10 *************** *** 2,6 **** # bio/data/na.rb - Nucleic Acids # ! # Copyright (C) 2001 KATAYAMA Toshiaki # # This library is free software; you can redistribute it and/or --- 2,6 ---- # bio/data/na.rb - Nucleic Acids # ! # Copyright (C) 2001, 2005 KATAYAMA Toshiaki # # This library is free software; you can redistribute it and/or From k at pub.open-bio.org Sun Aug 7 05:58:24 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sun Aug 7 06:44:02 2005 Subject: [BioRuby-cvs] bioruby/lib/bio sequence.rb,0.37,0.38 Message-ID: <200508070958.j779wOdZ027074@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio In directory pub.open-bio.org:/tmp/cvs-serv27061/lib/bio Modified Files: sequence.rb Log Message: * fixed Bio::Sequence::AA#molecular_weight to use AminoAcid#weight also Index: sequence.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/sequence.rb,v retrieving revision 0.37 retrieving revision 0.38 diff -C2 -d -r0.37 -r0.38 *** sequence.rb 7 Aug 2005 08:19:28 -0000 0.37 --- sequence.rb 7 Aug 2005 09:58:22 -0000 0.38 *************** *** 2,6 **** # bio/sequence.rb - biological sequence class # ! # Copyright (C) 2000-2004 KATAYAMA Toshiaki # Copyright (C) 2001 Yoshinori K. Okuji # Copyright (C) 2003 GOTO Naohisa --- 2,6 ---- # bio/sequence.rb - biological sequence class # ! # Copyright (C) 2000-2005 KATAYAMA Toshiaki # Copyright (C) 2001 Yoshinori K. Okuji # Copyright (C) 2003 GOTO Naohisa *************** *** 322,328 **** # AminoAcid is defined in bio/data/aa.rb ! def molecular_weight(hash = nil) ! hash = AminoAcid.weight unless hash ! total(hash) - NucleicAcid.weight[:water] * (self.length - 1) end --- 322,327 ---- # AminoAcid is defined in bio/data/aa.rb ! def molecular_weight ! AminoAcid.weight(self) end *************** *** 593,597 **** Show abnormal bases other than 'atgcu'. ! --- Bio::Sequence::NA#molecular_weight(hash) Estimate the weight of this biological string molecule. --- 592,596 ---- Show abnormal bases other than 'atgcu'. ! --- Bio::Sequence::NA#molecular_weight Estimate the weight of this biological string molecule. *************** *** 631,635 **** Similar to codes but returns long names. ! --- Bio::Sequence::AA#molecular_weight(hash) Estimate the weight of this protein. --- 630,634 ---- Similar to codes but returns long names. ! --- Bio::Sequence::AA#molecular_weight Estimate the weight of this protein. From k at pub.open-bio.org Sun Aug 7 06:02:43 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sun Aug 7 06:48:07 2005 Subject: [BioRuby-cvs] bioruby/sample biofetch.rb,1.15,1.16 Message-ID: <200508071002.j77A2hdZ027188@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/sample In directory pub.open-bio.org:/tmp/cvs-serv27184/sample Modified Files: biofetch.rb Log Message: * bget method is fixed to surely confirm that the returned value exists. Index: biofetch.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/sample/biofetch.rb,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** biofetch.rb 24 Aug 2004 00:08:54 -0000 1.15 --- biofetch.rb 7 Aug 2005 10:02:41 -0000 1.16 *************** *** 86,93 **** id_list.each do |query_id| entry_id = "#{db}:#{query_id}" ! if result = serv.get_entries([entry_id]) ! results << result ! else error4(query_id, db) end end --- 86,94 ---- id_list.each do |query_id| entry_id = "#{db}:#{query_id}" ! result = serv.get_entries([entry_id]) ! if result.empty? error4(query_id, db) + else + results << result end end From k at pub.open-bio.org Sun Aug 7 19:28:16 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sun Aug 7 20:14:29 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/data aa.rb,0.9,0.10 na.rb,0.10,0.11 Message-ID: <200508072328.j77NSGdZ028706@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/data In directory pub.open-bio.org:/tmp/cvs-serv28702/lib/bio/data Modified Files: aa.rb na.rb Log Message: * AminoAcid#to_re method is added * clean up Index: aa.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/data/aa.rb,v retrieving revision 0.9 retrieving revision 0.10 diff -C2 -d -r0.9 -r0.10 *** aa.rb 7 Aug 2005 09:58:21 -0000 0.9 --- aa.rb 7 Aug 2005 23:28:14 -0000 0.10 *************** *** 136,139 **** --- 136,145 ---- end + # backward compatibility + def names + Names + end + alias :aa :names + def name(x) str = Names[x] *************** *** 212,217 **** --- 218,233 ---- end + def to_re(seq) + str = seq.to_s.upcase + str.gsub!(/[^BZACDEFGHIKLMNPQRSTVWYU]/, ".") + str.gsub!("B", "[DN]") + str.gsub!("Z", "[EQ]") + Regexp.new(str) + end + + private + def reverse hash = Hash.new *************** *** 236,249 **** Weight = Data::Weight - def aa - Names - end - - def self.names - Names - end private alias :orig_reverse :reverse def reverse --- 252,260 ---- Weight = Data::Weight private + + # override when used as an instance method to improve performance alias :orig_reverse :reverse def reverse *************** *** 300,304 **** p aa.to_3('A') - puts "# Bio::AminoAcid.one2three('A')" p Bio::AminoAcid.one2three('A') --- 311,314 ---- *************** *** 330,333 **** --- 340,346 ---- puts "# aa.name2three('alanine')" p aa.name2three('alanine') + + puts "# Bio::AminoAcid.to_re('BZACDEFGHIKLMNPQRSTVWYU')" + p Bio::AminoAcid.to_re('BZACDEFGHIKLMNPQRSTVWYU') end Index: na.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/data/na.rb,v retrieving revision 0.10 retrieving revision 0.11 diff -C2 -d -r0.10 -r0.11 *** na.rb 7 Aug 2005 09:58:21 -0000 0.10 --- na.rb 7 Aug 2005 23:28:14 -0000 0.11 *************** *** 114,117 **** --- 114,123 ---- end + # backward compatibility + def names + Names + end + alias :na :names + def name(x) Names[x.to_s.upcase] *************** *** 144,154 **** Weight = Data::Weight - def na - Names - end - - def self.names - Names - end end --- 150,153 ---- From k at pub.open-bio.org Sun Aug 7 20:44:57 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sun Aug 7 21:30:43 2005 Subject: [BioRuby-cvs] bioruby/lib/bio sequence.rb,0.38,0.39 Message-ID: <200508080044.j780ivdZ029223@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio In directory pub.open-bio.org:/tmp/cvs-serv29219/lib/bio Modified Files: sequence.rb Log Message: * Bio::Sequence::AA#to_re is changed to use AminoAcid.to_re Index: sequence.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/sequence.rb,v retrieving revision 0.38 retrieving revision 0.39 diff -C2 -d -r0.38 -r0.39 *** sequence.rb 7 Aug 2005 09:58:22 -0000 0.38 --- sequence.rb 8 Aug 2005 00:44:55 -0000 0.39 *************** *** 247,251 **** end - # NucleicAcid is defined in bio/data/na.rb def to_re if self.rna? --- 247,250 ---- *************** *** 302,310 **** end def to_re ! return Regexp.new(self) end - # AminoAcid is defined in bio/data/aa.rb def codes array = [] --- 301,313 ---- end + # AminoAcid is defined in bio/data/aa.rb + def molecular_weight + AminoAcid.weight(self) + end + def to_re ! AminoAcid.to_re(self) end def codes array = [] *************** *** 319,327 **** AminoAcid.names[x] end - end - - # AminoAcid is defined in bio/data/aa.rb - def molecular_weight - AminoAcid.weight(self) end --- 322,325 ---- From k at pub.open-bio.org Mon Aug 8 08:57:26 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Mon Aug 8 09:42:45 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/data na.rb,0.11,0.12 Message-ID: <200508081257.j78CvQdZ030968@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/data In directory pub.open-bio.org:/tmp/cvs-serv30964/lib/bio/data Modified Files: na.rb Log Message: * weight of hydrogen is changed to precise value Index: na.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/data/na.rb,v retrieving revision 0.11 retrieving revision 0.12 diff -C2 -d -r0.11 -r0.12 *** na.rb 7 Aug 2005 23:28:14 -0000 0.11 --- na.rb 8 Aug 2005 12:57:24 -0000 0.12 *************** *** 80,84 **** :ribose_phosphate => 212.11, ! :hydrogen => 1.00, :water => 18.015, --- 80,84 ---- :ribose_phosphate => 212.11, ! :hydrogen => 1.00794, :water => 18.015, From k at pub.open-bio.org Mon Aug 8 23:44:35 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Tue Aug 9 00:29:59 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/util - New directory Message-ID: <200508090344.j793iZdZ000361@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/util In directory pub.open-bio.org:/tmp/cvs-serv357/util Log Message: Directory /home/repository/bioruby/bioruby/lib/bio/util added to the repository From k at pub.open-bio.org Mon Aug 8 23:50:38 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Tue Aug 9 00:35:54 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/util sirna.rb,NONE,1.1 Message-ID: <200508090350.j793ocdZ000426@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/util In directory pub.open-bio.org:/tmp/cvs-serv406 Added Files: sirna.rb Log Message: * Contributed by Itoshi Nikaido --- NEW FILE: sirna.rb --- # # bio/util/sirna.rb - Class for Designing small inhibitory RNAs # # Copyright (C) 2004 Itoshi NIKAIDO # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # $Id: sirna.rb,v 1.1 2005/08/09 03:50:36 k Exp $ # require 'bio/sequence' module Bio class SiRNA def initialize(seq, antisense_size = 21, max_gc_percent = 60.0, min_gc_percent = 40.0) @seq = seq.rna! @pairs = Array.new @antisense_size = antisense_size @max_gc_percent = max_gc_percent @min_gc_percent = min_gc_percent end attr_accessor :antisense_size def uitei?(target) return false unless /^.{2}[G|C]/i =~ target.to_s return false unless /[A|U].{2}$/i =~ target.to_s one_third = target.size * 1 / 3 start = @target_size - one_third - 1 one_third_seq = target.subseq(start, @target_size - 2) gc = 0 one_third_seq.scan(/[A|U]/i) { gc += 1 } return false if gc < 5 return false if /[G|C]{9}/i =~ target return false if /[G|C]{9}/i =~ target.complement.rna return true end def reynolds?(target) return false if /[G|C]{9}/i =~ target return false if /[G|C]{9}/i =~ target.complement.rna if /^.{4}A.{6}U.{2}[A|U|C].{5}[A|U].{2}$/i =~ target.to_s return true else return false end end def design(rule = 'uitei') @target_size = @antisense_size + 2 bp = 0 @seq.window_search(@target_size) do |target| bp += 1 antisense = target.subseq(1, @target_size - 2).complement.rna sense = target.subseq(3, @target_size) target_start = bp target_stop = bp + @target_size antisense_gc_percent = antisense.gc_percent next if antisense_gc_percent > @max_gc_percent next if antisense_gc_percent < @min_gc_percent if rule == 'uitei' next if uitei?(target) == false elsif rule == 'reynolds' next if reynolds?(target) == false else next end pair = Bio::SiRNA::Pair.new(target, sense, antisense, target_start, target_stop, rule, antisense_gc_percent) @pairs.push(pair) end #window_search return @pairs end #design class Pair def initialize(target, sense, antisense, start, stop, rule, gc_percent) @target = target @sense = sense @antisense = antisense @start = start @stop = stop @rule = rule @gc_percent = gc_percent end attr_accessor :target attr_accessor :sense attr_accessor :antisense attr_accessor :start, :stop attr_accessor :rule attr_accessor :gc_percent def as_human_readable_text # human readable report report = "--\n" report << 'start: ' + @start.to_s + "\n" report << 'stop: ' + @stop.to_s + "\n" report << 'rule: ' + @rule.to_s + "\n" report << 'gc_percent: ' + @gc_percent.to_s + "\n" report << 'target: ' + @target.upcase + "\n" report << 'sense: ' + ' ' + @sense.upcase + "\n" report << 'antisense: ' + @antisense.reverse.upcase + "\n" # computer parseble # puts antisense # puts target_start # puts target_stop end alias :to_s :as_human_readable_text end #class Bio::SiRNA::Pair class ShRNA def initialize(pair, method_name) @pair = pair @method_name = method_name @top_strand_shrna = nil @bottom_strand_shrna = nil @loop = nil end attr_accessor :method_name attr_accessor :top_strand_shrna attr_accessor :bottom_strand_shrna attr_accessor :loop def design if @method_name == 'BLOCK-iT' block_it else raise NotImplementedError end end def block_it top_strand_shrna_overhang = Bio::Sequence::NA.new('CACC') bottom_strand_shrna_overhang = Bio::Sequence::NA.new('AAAA') # loop = Bio::Sequence::NA.new('CGAA') # From BLOCK-iT's manual @loop = Bio::Sequence::NA.new('GTGTGCTGTCC') # From piGENE document if /^[G|g]/ =~ @pair.sense @top_strand_shrna = top_strand_shrna_overhang + @pair.sense + loop + @pair.sense.complement @bottom_strand_shrna = bottom_strand_shrna_overhang + @pair.sense + loop.complement + @pair.sense.complement else @top_strand_shrna = top_strand_shrna_overhang + 'G' + @pair.sense + loop + @pair.sense.complement @bottom_strand_shrna = bottom_strand_shrna_overhang + @pair.sense + loop.complement + @pair.sense.complement + 'C' end # @top_strand_shrna = Bio::Sequence::NA.new(@top_strand_shrna).dna! # @bottom_strand_shrna = Bio::Sequence::NA.new(@bottom_strand_shrna).dna! end def as_human_readable_text report = '' # report << 'Top Strand shRNA: ' + @top_strand_shrna.upcase.gsub(/G/, 'g') + "\n" # report << 'Bottom Strand shRNA: ' + @bottom_strand_shrna.upcase.gsub(/G/, 'g') + "\n" report << 'Top Strand shRNA: ' + @top_strand_shrna.upcase + "\n" report << 'Bottom Strand shRNA: ' + @bottom_strand_shrna.upcase + "\n" report << 'Size of Top Strand shRNA: ' + @top_strand_shrna.size.to_s + ' nt' + "\n" report << 'Size of Bottom Strand shRNA: ' + @bottom_strand_shrna.size.to_s + ' nt' + "\n" report << "5'-" + @top_strand_shrna.upcase + "-3'" + "\n" report << " 3'-" + @bottom_strand_shrna.reverse.upcase + "-5'" + "\n" end alias :to_s :as_human_readable_text end #class Bio::SiRNA::ShRNA end #class SiRNA end #module bio if __FILE__ == $0 input_seq = ARGF.read seq = Bio::Sequence::NA.new(input_seq) sirna_designer = Bio::SiRNA.new(seq) pairs = sirna_designer.design(rule = 'uitei') # or (rule = 'reynolds') pairs.each do |pair| shRNA = Bio::SiRNA::ShRNA.new(pair, 'BLOCK-iT') shRNA.design puts pair.as_human_readable_text puts shRNA.as_human_readable_text puts [shRNA.top_strand_shrna.dna!, shRNA.bottom_strand_shrna.dna!].join("\t") end end =begin = Bio::SiRNA Designing siRNA. Input is a Bio::Sequence::NA object (the target sequence). Output is a list of Bio::SiRNA::Pair object. This class implements the selection rules described by Kumiko Ui-Tei et al. (2004) and Reynolds et al. (2004) Kumiko Ui-Tei et al. Guidelines for the selection of highly effective siRNA sequences for mammalian and chick RNA interference. Nucl. Acids. Res. 2004 32: 936-948. Angela Reynolds et al. Rational siRNA design for RNA interference. Nature Biotech. 2004 22: 326-330. -- Bio::SiRNA.new(seq, antisense_size, max_gc_percent, min_gc_percent) -- Bio::SiRNA#design(rule) -- Bio::SiRNA#antisense_size -- Bio::SiRNA#max_gc_percent -- Bio::SiRNA#min_gc_percent == Bio::SiRNA::Pair --- Bio::SiRNA::Pair.new(target, sense, antisense, target_start, target_stop, rule, antisense_gc_percent) --- Bio::SiRNA::Pair#target --- Bio::SiRNA::Pair#sense --- Bio::SiRNA::Pair#antisense --- Bio::SiRNA::Pair#start --- Bio::SiRNA::Pair#stop --- Bio::SiRNA::Pair#as_human_readable_text = Bio::ShRNA Input is a Bio::SiRNA::Pair object (the target sequence). Output is a list of Bio::SiRNA::Pair object. -- Bio::ShRNA.new(pair, 'design rule name') -- Bio::ShRNA#design(rule) -- Bio::ShRNA#antisense_size -- Bio::ShRNA#max_gc_percent -- Bio::ShRNA#min_gc_percent -- ChangeLog 2005/03/21 Itoshi NIKAIDO Bio::SiRNA#ShRNA_designer method was changed design method. 2004/06/25 Bio::ShRNA class was added. 2004/06/17 Itoshi NIKAIDO We can use shRNA loop sequence from piGene document. =end From k at pub.open-bio.org Tue Aug 9 01:39:28 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Tue Aug 9 02:25:23 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/util sirna.rb,1.1,1.2 Message-ID: <200508090539.j795dSdZ000629@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/util In directory pub.open-bio.org:/tmp/cvs-serv625 Modified Files: sirna.rb Log Message: * clean up by katayama Index: sirna.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/util/sirna.rb,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** sirna.rb 9 Aug 2005 03:50:36 -0000 1.1 --- sirna.rb 9 Aug 2005 05:39:26 -0000 1.2 *************** *** 1,6 **** # ! # bio/util/sirna.rb - Class for Designing small inhibitory RNAs # ! # Copyright (C) 2004 Itoshi NIKAIDO # # This library is free software; you can redistribute it and/or --- 1,6 ---- # ! # bio/util/sirna.rb - Class for designing small inhibitory RNAs # ! # Copyright (C) 2004, 2005 Itoshi NIKAIDO # # This library is free software; you can redistribute it and/or *************** *** 24,27 **** --- 24,28 ---- module Bio + class SiRNA *************** *** 33,149 **** @min_gc_percent = min_gc_percent end ! attr_accessor :antisense_size ! def uitei?(target) ! return false unless /^.{2}[G|C]/i =~ target.to_s ! return false unless /[A|U].{2}$/i =~ target.to_s one_third = target.size * 1 / 3 ! start = @target_size - one_third - 1 ! one_third_seq = target.subseq(start, @target_size - 2) ! gc = 0 ! one_third_seq.scan(/[A|U]/i) { gc += 1 } ! return false if gc < 5 - return false if /[G|C]{9}/i =~ target - return false if /[G|C]{9}/i =~ target.complement.rna return true end ! def reynolds?(target) ! return false if /[G|C]{9}/i =~ target ! return false if /[G|C]{9}/i =~ target.complement.rna ! if /^.{4}A.{6}U.{2}[A|U|C].{5}[A|U].{2}$/i =~ target.to_s ! return true ! else ! return false ! end end def design(rule = 'uitei') @target_size = @antisense_size + 2 - bp = 0 - @seq.window_search(@target_size) do |target| - bp += 1 antisense = target.subseq(1, @target_size - 2).complement.rna sense = target.subseq(3, @target_size) ! target_start = bp ! target_stop = bp + @target_size antisense_gc_percent = antisense.gc_percent next if antisense_gc_percent > @max_gc_percent next if antisense_gc_percent < @min_gc_percent ! if rule == 'uitei' ! next if uitei?(target) == false ! elsif rule == 'reynolds' ! next if reynolds?(target) == false else ! next end pair = Bio::SiRNA::Pair.new(target, sense, antisense, target_start, target_stop, rule, antisense_gc_percent) @pairs.push(pair) ! ! end #window_search return @pairs ! end #design class Pair def initialize(target, sense, antisense, start, stop, rule, gc_percent) ! @target = target ! @sense = sense ! @antisense = antisense ! @start = start ! @stop = stop ! @rule = rule @gc_percent = gc_percent end ! ! attr_accessor :target ! attr_accessor :sense ! attr_accessor :antisense ! attr_accessor :start, :stop ! attr_accessor :rule ! attr_accessor :gc_percent ! ! def as_human_readable_text ! # human readable report ! report = "--\n" ! report << 'start: ' + @start.to_s + "\n" ! report << 'stop: ' + @stop.to_s + "\n" ! report << 'rule: ' + @rule.to_s + "\n" ! report << 'gc_percent: ' + @gc_percent.to_s + "\n" ! report << 'target: ' + @target.upcase + "\n" ! report << 'sense: ' + ' ' + @sense.upcase + "\n" ! report << 'antisense: ' + @antisense.reverse.upcase + "\n" ! # computer parseble ! # puts antisense ! # puts target_start ! # puts target_stop end - alias :to_s :as_human_readable_text ! end #class Bio::SiRNA::Pair class ShRNA ! def initialize(pair, method_name) @pair = pair - @method_name = method_name - @top_strand_shrna = nil - @bottom_strand_shrna = nil - @loop = nil end ! attr_accessor :method_name ! attr_accessor :top_strand_shrna ! attr_accessor :bottom_strand_shrna ! attr_accessor :loop ! ! def design ! if @method_name == 'BLOCK-iT' block_it else --- 34,143 ---- @min_gc_percent = min_gc_percent end ! attr_accessor :antisense_size, :max_gc_percent, :min_gc_percent ! def uitei?(target) ! return false unless /^.{2}[GC]/i =~ target ! return false unless /[AU].{2}$/i =~ target ! return false if /[GC]{9}/i =~ target ! return false if /[GC]{9}/i =~ target.complement.rna # same as above? one_third = target.size * 1 / 3 ! start_pos = @target_size - one_third - 1 ! remain_seq = target.subseq(start_pos, @target_size - 2) ! gc_number = remain_seq.scan(/[AU]/i).size ! return false if gc_number < 5 return true end ! def reynolds?(target) ! return false if /[GC]{9}/i =~ target ! return false if /[GC]{9}/i =~ target.complement.rna # means same as above? ! return false unless /^.{4}A.{6}U.{2}[AUC].{5}[AU].{2}$/i =~ target ! return true ! end ! ! def uitei ! design('uitei') ! end ! ! def reynolds ! design('reynolds') end def design(rule = 'uitei') @target_size = @antisense_size + 2 + target_start = 0 + @seq.window_search(@target_size) do |target| antisense = target.subseq(1, @target_size - 2).complement.rna sense = target.subseq(3, @target_size) ! target_start += 1 ! target_stop = target_start + @target_size ! antisense_gc_percent = antisense.gc_percent next if antisense_gc_percent > @max_gc_percent next if antisense_gc_percent < @min_gc_percent ! case rule ! when 'uitei' ! next unless uitei?(target) ! when 'reynolds' ! next unless reynolds?(target) else ! raise NotImplementedError end pair = Bio::SiRNA::Pair.new(target, sense, antisense, target_start, target_stop, rule, antisense_gc_percent) @pairs.push(pair) ! end return @pairs ! end ! class Pair def initialize(target, sense, antisense, start, stop, rule, gc_percent) ! @target = target ! @sense = sense ! @antisense = antisense ! @start = start ! @stop = stop ! @rule = rule @gc_percent = gc_percent end ! attr_accessor :target, :sense, :antisense, :start, :stop, :rule, :gc_percent ! # human readable report ! def report ! report = "### siRNA\n" ! report << 'Start: ' + @start.to_s + "\n" ! report << 'Stop: ' + @stop.to_s + "\n" ! report << 'Rule: ' + @rule.to_s + "\n" ! report << 'GC %: ' + @gc_percent.to_s + "\n" ! report << 'Target: ' + @target.upcase + "\n" ! report << 'Sense: ' + ' ' + @sense.upcase + "\n" ! report << 'Antisense: ' + @antisense.reverse.upcase + "\n" end ! # computer parsable report ! #def to_s ! # [ @antisense, @start, @stop ].join("\t") ! #end ! ! end #class Pair ! class ShRNA ! def initialize(pair) @pair = pair end ! attr_accessor :top_strand, :bottom_strand ! ! def design(method = 'BLOCK-iT') ! case method ! when 'BLOCK-iT' block_it else *************** *** 151,203 **** end end - - def block_it - top_strand_shrna_overhang = Bio::Sequence::NA.new('CACC') - bottom_strand_shrna_overhang = Bio::Sequence::NA.new('AAAA') - # loop = Bio::Sequence::NA.new('CGAA') # From BLOCK-iT's manual - @loop = Bio::Sequence::NA.new('GTGTGCTGTCC') # From piGENE document ! if /^[G|g]/ =~ @pair.sense ! @top_strand_shrna = top_strand_shrna_overhang + @pair.sense + loop + @pair.sense.complement ! @bottom_strand_shrna = bottom_strand_shrna_overhang + @pair.sense + loop.complement + @pair.sense.complement else ! @top_strand_shrna = top_strand_shrna_overhang + 'G' + @pair.sense + loop + @pair.sense.complement ! @bottom_strand_shrna = bottom_strand_shrna_overhang + @pair.sense + loop.complement + @pair.sense.complement + 'C' end - - # @top_strand_shrna = Bio::Sequence::NA.new(@top_strand_shrna).dna! - # @bottom_strand_shrna = Bio::Sequence::NA.new(@bottom_strand_shrna).dna! end ! def as_human_readable_text ! report = '' ! # report << 'Top Strand shRNA: ' + @top_strand_shrna.upcase.gsub(/G/, 'g') + "\n" ! # report << 'Bottom Strand shRNA: ' + @bottom_strand_shrna.upcase.gsub(/G/, 'g') + "\n" ! report << 'Top Strand shRNA: ' + @top_strand_shrna.upcase + "\n" ! report << 'Bottom Strand shRNA: ' + @bottom_strand_shrna.upcase + "\n" ! report << 'Size of Top Strand shRNA: ' + @top_strand_shrna.size.to_s + ' nt' + "\n" ! report << 'Size of Bottom Strand shRNA: ' + @bottom_strand_shrna.size.to_s + ' nt' + "\n" ! report << "5'-" + @top_strand_shrna.upcase + "-3'" + "\n" ! report << " 3'-" + @bottom_strand_shrna.reverse.upcase + "-5'" + "\n" end - alias :to_s :as_human_readable_text ! end #class Bio::SiRNA::ShRNA end #class SiRNA end #module bio if __FILE__ == $0 ! input_seq = ARGF.read ! seq = Bio::Sequence::NA.new(input_seq) ! sirna_designer = Bio::SiRNA.new(seq) ! pairs = sirna_designer.design(rule = 'uitei') # or (rule = 'reynolds') pairs.each do |pair| ! shRNA = Bio::SiRNA::ShRNA.new(pair, 'BLOCK-iT') ! shRNA.design ! puts pair.as_human_readable_text ! puts shRNA.as_human_readable_text ! puts [shRNA.top_strand_shrna.dna!, shRNA.bottom_strand_shrna.dna!].join("\t") end --- 145,209 ---- end end ! def block_it(method = 'piGENE') ! top = Bio::Sequence::NA.new('CACC') # top_strand_shrna_overhang ! bot = Bio::Sequence::NA.new('AAAA') # bottom_strand_shrna_overhang ! fwd = @pair.sense ! rev = @pair.sense.complement ! ! case method ! when 'BLOCK-iT' ! # From BLOCK-iT's manual ! loop_fwd = Bio::Sequence::NA.new('CGAA') ! loop_rev = loop_fwd.complement ! when 'piGENE' ! # From piGENE document ! loop_fwd = Bio::Sequence::NA.new('GTGTGCTGTCC') ! loop_rev = loop_fwd.complement ! else ! raise NotImplementedError ! end ! ! if /^G/i =~ fwd ! @top_strand = top + fwd + loop_fwd + rev ! @bottom_strand = bot + fwd + loop_rev + rev else ! @top_strand = top + 'G' + fwd + loop_fwd + rev ! @bottom_strand = bot + fwd + loop_rev + rev + 'C' end end ! def report ! report = "### shRNA\n" ! report << "Top strand shRNA (#{@top_strand.length} nt):\n" ! report << " 5'-#{@top_strand.upcase}-3'\n" ! report << "Bottom strand shRNA (#{@bottom_strand.length} nt):\n" ! report << " 3'-#{@bottom_strand.reverse.upcase}-5'\n" end ! end #class ShRNA ! end #class SiRNA + end #module bio + if __FILE__ == $0 ! seq = Bio::Sequence::NA.new(ARGF.read) ! ! sirna = Bio::SiRNA.new(seq) ! pairs = sirna.design # or .design('uitei') or .uitei or .reynolds ! pairs.each do |pair| ! puts pair.report ! shrna = Bio::SiRNA::ShRNA.new(pair) ! shrna.design # or .design('BLOCK-iT') or .block_it ! puts shrna.report ! ! puts "# as DNA" ! puts shrna.top_strand.dna ! puts shrna.bottom_strand.dna end *************** *** 223,232 **** Nature Biotech. 2004 22: 326-330. ! -- Bio::SiRNA.new(seq, antisense_size, max_gc_percent, min_gc_percent) ! -- Bio::SiRNA#design(rule) ! -- Bio::SiRNA#antisense_size ! -- Bio::SiRNA#max_gc_percent ! -- Bio::SiRNA#min_gc_percent == Bio::SiRNA::Pair --- 229,249 ---- Nature Biotech. 2004 22: 326-330. ! --- Bio::SiRNA.new(seq, antisense_size, max_gc_percent, min_gc_percent) ! --- Bio::SiRNA#design(rule) ! ! rule can be one of 'uitei' (default) and 'reynolds'. ! ! --- Bio::SiRNA#uitei ! ! same as design('uitei') ! ! --- Bio::SiRNA#reynolds ! ! same as design('reynolds') ! ! --- Bio::SiRNA#antisense_size ! --- Bio::SiRNA#max_gc_percent ! --- Bio::SiRNA#min_gc_percent == Bio::SiRNA::Pair *************** *** 239,258 **** --- Bio::SiRNA::Pair#start --- Bio::SiRNA::Pair#stop ! --- Bio::SiRNA::Pair#as_human_readable_text ! = Bio::ShRNA Input is a Bio::SiRNA::Pair object (the target sequence). - Output is a list of Bio::SiRNA::Pair object. ! -- Bio::ShRNA.new(pair, 'design rule name') ! -- Bio::ShRNA#design(rule) ! -- Bio::ShRNA#antisense_size ! -- Bio::ShRNA#max_gc_percent ! -- Bio::ShRNA#min_gc_percent ! -- ChangeLog 2005/03/21 Itoshi NIKAIDO --- 256,283 ---- --- Bio::SiRNA::Pair#start --- Bio::SiRNA::Pair#stop ! --- Bio::SiRNA::Pair#rule ! --- Bio::SiRNA::Pair#report ! == Bio::SiRNA::ShRNA Input is a Bio::SiRNA::Pair object (the target sequence). ! --- Bio::ShRNA.new(pair) ! --- Bio::ShRNA#design(rule) + only the 'BLOCK-iT' rule is implemented for now ! --- Bio::ShRNA#block_it(method) ! ! same as design('BLOCK-iT'). ! method can be one of 'piGENE' (default) and 'BLOCK-iT'. ! ! --- Bio::ShRNA#top_strand ! --- Bio::ShRNA#bottom_strand ! --- Bio::ShRNA#report ! ! ! === ChangeLog 2005/03/21 Itoshi NIKAIDO From k at pub.open-bio.org Tue Aug 9 01:40:46 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Tue Aug 9 02:25:58 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/util sirna.rb,1.2,1.3 Message-ID: <200508090540.j795ekdZ000674@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/util In directory pub.open-bio.org:/tmp/cvs-serv660 Modified Files: sirna.rb Log Message: * removed redundancy Index: sirna.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/util/sirna.rb,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** sirna.rb 9 Aug 2005 05:39:26 -0000 1.2 --- sirna.rb 9 Aug 2005 05:40:44 -0000 1.3 *************** *** 40,44 **** return false unless /[AU].{2}$/i =~ target return false if /[GC]{9}/i =~ target - return false if /[GC]{9}/i =~ target.complement.rna # same as above? one_third = target.size * 1 / 3 --- 40,43 ---- *************** *** 53,57 **** def reynolds?(target) return false if /[GC]{9}/i =~ target - return false if /[GC]{9}/i =~ target.complement.rna # means same as above? return false unless /^.{4}A.{6}U.{2}[AUC].{5}[AU].{2}$/i =~ target return true --- 52,55 ---- From k at pub.open-bio.org Tue Aug 9 03:52:47 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Tue Aug 9 04:38:17 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/io fastacmd.rb,NONE,1.1 Message-ID: <200508090752.j797qldZ000930@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/io In directory pub.open-bio.org:/tmp/cvs-serv926/lib/bio/io Added Files: fastacmd.rb Log Message: * Contributed by Shuji SHIGENOBU --- NEW FILE: fastacmd.rb --- # # bio/io/fastacmd.rb - NCBI fastacmd wrapper class # # Copyright (C) 2005 Shuji SHIGENOBU # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # $Id: fastacmd.rb,v 1.1 2005/08/09 07:52:45 k Exp $ # require 'bio/db/fasta' require 'bio/io/flatfile' require 'open3' module Bio class BlastDB include Enumerable FASTACMD = 'fastacmd' def initialize(db) @database = db end def get_by_id(id) cmd = "#{FASTACMD} -d #{@database} -s #{id}" begin inn, out, err = Open3.popen3(cmd) result = out.read err_msg = err.read fas = Bio::FastaFormat.new(result) return fas rescue raise "[Error] command execution failed : #{cmd}\n#{err_msg}" ensure inn.close; out.close; err.close end end def get_by_ids(ids) # ids: Array object cmd = "#{FASTACMD} -d #{@database} -s #{ids.join(',')}" begin inn, out, err = Open3.popen3(cmd) err_msg = err.read fas_set = Bio::FlatFile.new(Bio::FastaFormat, out).to_a return fas_set rescue raise "[Error] command execution failed : #{cmd}\n#{err_msg}" ensure inn.close; out.close; err.close end end def each_entry cmd = "#{FASTACMD} -d #{@database} -D T" io = IO.popen(cmd) f = Bio::FlatFile.new(Bio::FastaFormat, io) f.each_entry do |e| yield e end io.close end alias :each :each_entry end end if __FILE__ == $0 # test code bdb = Bio::BlastDB.new("/db/myblastdb") # Retrieve one sequence puts bdb.get_by_id("P25724") # Retrieve one more sequences bdb.get_by_ids(["P25724", "AAB59189", "AAA28715"]).each do |fas| puts fas end # Iterate all sequences bdb.each do |fas| p [fas.definition[0..30], fas.seq.size] end end From k at pub.open-bio.org Tue Aug 9 04:55:42 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Tue Aug 9 05:41:13 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/io fastacmd.rb,1.1,1.2 Message-ID: <200508090855.j798tgdZ001452@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/io In directory pub.open-bio.org:/tmp/cvs-serv1425 Modified Files: fastacmd.rb Log Message: * the class is renamed to Bio::Fastacmd (from Bio::BlastDB) * constant FASTACMD is changed to an instance variable * added accessors for database and fastacmd * get_by_ids method is integrated into fetch method * test code modified to accept arguments Index: fastacmd.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/io/fastacmd.rb,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** fastacmd.rb 9 Aug 2005 07:52:45 -0000 1.1 --- fastacmd.rb 9 Aug 2005 08:55:40 -0000 1.2 *************** *** 3,6 **** --- 3,7 ---- # # Copyright (C) 2005 Shuji SHIGENOBU + # Copyright (C) 2005 Toshiaki Katayama # # This library is free software; you can redistribute it and/or *************** *** 27,62 **** module Bio ! class BlastDB include Enumerable - FASTACMD = 'fastacmd' - def initialize(db) @database = db end ! def get_by_id(id) ! cmd = "#{FASTACMD} -d #{@database} -s #{id}" ! begin ! inn, out, err = Open3.popen3(cmd) ! result = out.read ! err_msg = err.read ! fas = Bio::FastaFormat.new(result) ! return fas ! rescue ! raise "[Error] command execution failed : #{cmd}\n#{err_msg}" ! ensure ! inn.close; out.close; err.close ! end end ! def get_by_ids(ids) # ids: Array object ! cmd = "#{FASTACMD} -d #{@database} -s #{ids.join(',')}" begin inn, out, err = Open3.popen3(cmd) err_msg = err.read ! fas_set = Bio::FlatFile.new(Bio::FastaFormat, out).to_a ! return fas_set rescue raise "[Error] command execution failed : #{cmd}\n#{err_msg}" --- 28,60 ---- module Bio ! class Fastacmd include Enumerable def initialize(db) @database = db + @fastacmd = 'fastacmd' end + attr_accessor :database, :fastacmd ! # get an entry_id and returns a Bio::FastaFormat object ! def get_by_id(entry_id) ! fetch(entry_id).shift end ! # get one or more entry_id and returns an Array of Bio::FastaFormat objects ! def fetch(list) ! if list.respond_to?(:join) ! entry_id = list.join(",") ! else ! entry_id = list ! end ! ! cmd = "#{@fastacmd} -d #{@database} -s #{entry_id}" begin inn, out, err = Open3.popen3(cmd) + results = Bio::FlatFile.new(Bio::FastaFormat, out).to_a err_msg = err.read ! return results rescue raise "[Error] command execution failed : #{cmd}\n#{err_msg}" *************** *** 67,79 **** def each_entry ! cmd = "#{FASTACMD} -d #{@database} -D T" ! io = IO.popen(cmd) ! f = Bio::FlatFile.new(Bio::FastaFormat, io) ! f.each_entry do |e| ! yield e end - io.close end - alias :each :each_entry --- 65,76 ---- def each_entry ! cmd = "#{@fastacmd} -d #{@database} -D T" ! IO.popen(cmd) do |io| ! f = Bio::FlatFile.new(Bio::FastaFormat, io) ! f.each_entry do |e| ! yield e ! end end end alias :each :each_entry *************** *** 85,103 **** if __FILE__ == $0 ! # test code ! bdb = Bio::BlastDB.new("/db/myblastdb") ! # Retrieve one sequence ! puts bdb.get_by_id("P25724") ! # Retrieve one more sequences ! bdb.get_by_ids(["P25724", "AAB59189", "AAA28715"]).each do |fas| ! puts fas end ! # Iterate all sequences ! bdb.each do |fas| ! p [fas.definition[0..30], fas.seq.size] end --- 82,121 ---- if __FILE__ == $0 ! database = ARGV.shift || "/db/myblastdb" ! entry_id = ARGV.shift || "sp:128U_DROME" ! ent_list = ["sp:1433_SPIOL", "sp:1432_MAIZE"] ! fastacmd = Bio::Fastacmd.new(database) ! ### Retrieve one sequence ! entry = fastacmd.get_by_id(entry_id) ! # Bio::Fastacmd#get_by_id(entry_id) returns a Bio::FastaFormat object. ! p entry ! ! # Bio::FastaFormat becomes a fasta format string when printed by puts. ! puts entry ! ! # Bio::Fastacmd#fetch(entry_id) returns an Array of a Bio::FastaFormat ! # object even when the result is a single entry. ! p fastacmd.fetch(entry_id) ! ! ### Retrieve more sequences ! ! # Bio::Fastacmd#fetch method also accepts a list of entry_id and returns ! # an Array of Bio::FastaFormat objects. ! p fastacmd.fetch(ent_list) ! ! # So, you can iterate on the results. ! fastacmd.fetch(ent_list).each do |fasta| ! puts fasta end ! ! ### Iterates on all entries ! ! # You can also iterate on all sequences in the database! ! fastacmd.each do |fasta| ! p [ fasta.definition[0..30], fasta.seq.size ] end From k at pub.open-bio.org Tue Aug 9 05:07:05 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Tue Aug 9 05:52:32 2005 Subject: [BioRuby-cvs] bioruby ChangeLog,1.30,1.31 Message-ID: <200508090907.j79975dZ001563@pub.open-bio.org> Update of /home/repository/bioruby/bioruby In directory pub.open-bio.org:/tmp/cvs-serv1559 Modified Files: ChangeLog Log Message: * added sirna, fastacmd Index: ChangeLog =================================================================== RCS file: /home/repository/bioruby/bioruby/ChangeLog,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** ChangeLog 7 Aug 2005 16:45:58 -0000 1.30 --- ChangeLog 9 Aug 2005 09:07:03 -0000 1.31 *************** *** 1,14 **** 2005-08-08 Naohisa Goto * lib/bio/appl/bl2seq/report.rb: Newly added bl2seq (BLAST 2 sequences) output parser. * lib/bio/appl/blast/format0.rb: Added `self.class::` before F0dbstat.new for bl2seq/report.rb 2005-08-07 Naohisa Goto * lib/bio/db/genbank/common.rb ! Avoid NoMethodError (private method `chomp` called for nil:NilClass) ! when parsing features of ftp://ftp.ncbi.nih.gov/genbank/genomes/Bacteria/ Salmonella_typhimurium_LT2/AE006468.gbk --- 1,47 ---- + 2005-08-09 Toshiaki Katayama + + * lib/bio/util/sirna.rb: + + Newly added method for desing of siRNA, contributed by + Itoshi Nikaido. The lib/bio/util/ directory if reserved + for bioinfomatics algorithms implemented by pure Ruby. + + * lib/bio/io/fastacmd.rb: + + Newly added wrapper for NCBI fastacmd program, contributed by + Shinji Shigenobu. + 2005-08-08 Naohisa Goto * lib/bio/appl/bl2seq/report.rb: + Newly added bl2seq (BLAST 2 sequences) output parser. + * lib/bio/appl/blast/format0.rb: + Added `self.class::` before F0dbstat.new for bl2seq/report.rb + 2005-08-07 Toshiaki Katayama + + * lib/bio/sequence.rb, lib/bio/data/na.rb, lib/bio/data/aa.rb: + + Bio::NucleicAcid, Bio::AminoAcid classes are refactored to have + Data module, and this module is included and extended to make + all methods as both of instance methods and extend methods. + + Bio::Sequence::NA class is rewrited (molecular_weight, to_re methods) + to use Bio::NucleicAcid. + + Bio::Sequence::NA#molecular_weight method is fixed to subtract + two hydrogens for each base. + + * lib/bio/db/medline.rb: publication_type (pt) method added. + 2005-08-07 Naohisa Goto * lib/bio/db/genbank/common.rb ! ! Avoid NoMethodError (private method `chomp` called for nil:NilClass) ! when parsing features of ftp://ftp.ncbi.nih.gov/genbank/genomes/Bacteria/ Salmonella_typhimurium_LT2/AE006468.gbk *************** *** 49,54 **** * lib/bio/db/go.rb ! Newly added Bio::GO::External2go class for parsing ! external2go file. 2005-03-10 Naohisa Goto --- 82,86 ---- * lib/bio/db/go.rb ! Newly added Bio::GO::External2go class for parsing external2go file. 2005-03-10 Naohisa Goto *************** *** 61,70 **** * lib/bio/io/flatfile.rb ! * Added file format autodetection for Bio::KEGG::KO, ! Bio::KEGG::GLYCAN, Bio::KEGG::REACTION, Bio::Blat::Report ! and Bio::Sim4::Report. ! * In order to distinguish Bio::KEGG::REACTION and ! Bio::KEGG::COMPOUND, autodetection regexp. of ! Bio::KEGG::COMPOUND were modified. 2005-02-09 KATAYAMA Toshiaki --- 93,104 ---- * lib/bio/io/flatfile.rb ! ! Added file format autodetection for Bio::KEGG::KO, ! Bio::KEGG::GLYCAN, Bio::KEGG::REACTION, Bio::Blat::Report ! and Bio::Sim4::Report. ! ! In order to distinguish Bio::KEGG::REACTION and ! Bio::KEGG::COMPOUND, autodetection regexp. of ! Bio::KEGG::COMPOUND were modified. 2005-02-09 KATAYAMA Toshiaki From k at pub.open-bio.org Tue Aug 9 05:58:21 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Tue Aug 9 06:43:53 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/appl/hmmer report.rb,1.4,1.5 Message-ID: <200508090958.j799wLdZ001777@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl/hmmer In directory pub.open-bio.org:/tmp/cvs-serv1761 Modified Files: report.rb Log Message: * bug fixed by Masashi Fujita (2005/5/26) -- sometimes sequence position in HMMER report becomes '-' instead of digits according to the alignment. Index: report.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/hmmer/report.rb,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** report.rb 26 Feb 2003 02:58:23 -0000 1.4 --- report.rb 9 Aug 2005 09:58:19 -0000 1.5 *************** *** 62,66 **** $1.split(/^\S+.*?\n/).slice(1..-1).each_with_index do |al,k| al2 = al.gsub(/\n\n/,"\n").to_s.collect { |l| ! l.sub(/^.{19}/,'').sub(/\s\d+\s*$/,'') } align = ['', '', ''] --- 62,66 ---- $1.split(/^\S+.*?\n/).slice(1..-1).each_with_index do |al,k| al2 = al.gsub(/\n\n/,"\n").to_s.collect { |l| ! l.sub(/^.{19}/,'').sub(/\s(\d+|-)\s*$/,'') } align = ['', '', ''] *************** *** 121,125 **** def initialize(data, is_hmmsearch) @is_hmmsearch = is_hmmsearch ! @accession, @domain, seq_f, seq_t, @seq_ft, hmm_f, hmm_t, @hmm_ft, score, evalue = data.split(' ') --- 121,125 ---- def initialize(data, is_hmmsearch) @is_hmmsearch = is_hmmsearch ! @accession, @domain, seq_f, seq_t, @seq_ft, hmm_f, hmm_t, @hmm_ft, score, evalue = data.split(' ') From k at pub.open-bio.org Tue Aug 9 07:38:40 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Tue Aug 9 08:25:07 2005 Subject: [BioRuby-cvs] bioruby ChangeLog,1.32,1.33 Message-ID: <200508091138.j79BcedZ002236@pub.open-bio.org> Update of /home/repository/bioruby/bioruby In directory pub.open-bio.org:/tmp/cvs-serv2232 Modified Files: ChangeLog Log Message: * prepared for 0.6.3 release Index: ChangeLog =================================================================== RCS file: /home/repository/bioruby/bioruby/ChangeLog,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** ChangeLog 9 Aug 2005 11:19:15 -0000 1.32 --- ChangeLog 9 Aug 2005 11:38:37 -0000 1.33 *************** *** 1,4 **** --- 1,9 ---- 2005-08-09 Toshiaki Katayama + * BioRuby 0.6.3 is released. + + This version would be the final release to support Ruby 1.6 series + (as long as no serious bug is found:). + * lib/bio/util/sirna.rb: *************** *** 12,15 **** --- 17,25 ---- Shinji Shigenobu. + * lib/bio/appl/hmmer/report.rb: + + Bug fixed by Masashi Fujita when the position of sequence + rarely becomes '-' instead of digits. + 2005-08-08 Mitsuteru Nakao *************** *** 38,66 **** Bio::NucleicAcid, Bio::AminoAcid classes are refactored to have Data module, and this module is included and extended to make ! all methods as both of instance methods and extend methods. ! Bio::Sequence::NA class is rewrited (molecular_weight, to_re methods) ! to use Bio::NucleicAcid. Bio::Sequence::NA#molecular_weight method is fixed to subtract ! two hydrogens for each base. ! * lib/bio/db/medline.rb: publication_type (pt) method added. 2005-08-07 Naohisa Goto ! * lib/bio/db/genbank/common.rb Avoid NoMethodError (private method `chomp` called for nil:NilClass) when parsing features of ftp://ftp.ncbi.nih.gov/genbank/genomes/Bacteria/ ! Salmonella_typhimurium_LT2/AE006468.gbk 2005-07-11 Toshiaki Katayama ! * bin/br_pmfetch.rb ! * added sort by page option (--sort page) ! * lib/io/higet.rb Newly added Bio::HGC::HiGet class for HiGet SOAP service. --- 48,78 ---- Bio::NucleicAcid, Bio::AminoAcid classes are refactored to have Data module, and this module is included and extended to make ! all methods as both of instance methods and class methods. ! Bio::Sequence::NA and AA classes are rewrited (molecular_weight, ! to_re methods) to use Bio::NucleicAcid. Bio::Sequence::NA#molecular_weight method is fixed to subtract ! two hydrogens per each base. ! * lib/bio/db/medline.rb: publication_type (pt) method is added. 2005-08-07 Naohisa Goto ! * lib/bio/db/genbank/common.rb: Avoid NoMethodError (private method `chomp` called for nil:NilClass) when parsing features of + ftp://ftp.ncbi.nih.gov/genbank/genomes/Bacteria/ ! Salmonella_typhimurium_LT2/AE006468.gbk 2005-07-11 Toshiaki Katayama ! * bin/br_pmfetch.rb: ! Added sort by page option (--sort page) ! ! * lib/io/higet.rb: Newly added Bio::HGC::HiGet class for HiGet SOAP service. *************** *** 72,76 **** 2005-06-21 Naohisa Goto ! * lib/bio/appl/blast/report.rb Newly added support for reading BLAST -m 7 result files --- 84,88 ---- 2005-06-21 Naohisa Goto ! * lib/bio/appl/blast/report.rb: Newly added support for reading BLAST -m 7 result files *************** *** 80,84 **** supported by Bio::FlatFile) ! * lib/bio/io/flatfile.rb Added file format autodetection of BLAST XML format. --- 92,96 ---- supported by Bio::FlatFile) ! * lib/bio/io/flatfile.rb: Added file format autodetection of BLAST XML format. *************** *** 90,94 **** 2005-04-04 Mitsuteru Nakao ! * lib/bio/db/go.rb Newly added Bio::GO::External2go class for parsing external2go file. --- 102,106 ---- 2005-04-04 Mitsuteru Nakao ! * lib/bio/db/go.rb: Newly added Bio::GO::External2go class for parsing external2go file. *************** *** 96,100 **** 2005-03-10 Naohisa Goto ! * lib/bio/io/flatfile.rb Added file format autodetection of Spidey (Bio::Spidey::Report). --- 108,112 ---- 2005-03-10 Naohisa Goto ! * lib/bio/io/flatfile.rb: Added file format autodetection of Spidey (Bio::Spidey::Report). *************** *** 102,106 **** 2005-03-10 Naohisa Goto ! * lib/bio/io/flatfile.rb Added file format autodetection for Bio::KEGG::KO, --- 114,118 ---- 2005-03-10 Naohisa Goto ! * lib/bio/io/flatfile.rb: Added file format autodetection for Bio::KEGG::KO, *************** *** 114,118 **** 2005-02-09 KATAYAMA Toshiaki ! * lib/bio/db/kegg/genes.rb Added cu method which returns codon usage in Hash for the --- 126,130 ---- 2005-02-09 KATAYAMA Toshiaki ! * lib/bio/db/kegg/genes.rb: Added cu method which returns codon usage in Hash for the *************** *** 123,136 **** * BioRuby 0.6.2 released. ! * test/all_tests.rb Unit tests for some classes are newly incorporated by Moses Hohman. You can try it by 'ruby install.rb test' ! * lib/bio/appl/spidey/report.rb Newly added Spidey result parser class. ! * lib/bio/appl/blat/report.rb Newly added BLAT result parser class. --- 135,148 ---- * BioRuby 0.6.2 released. ! * test/all_tests.rb: Unit tests for some classes are newly incorporated by Moses Hohman. You can try it by 'ruby install.rb test' ! * lib/bio/appl/spidey/report.rb: Newly added Spidey result parser class. ! * lib/bio/appl/blat/report.rb: Newly added BLAT result parser class. From k at pub.open-bio.org Tue Aug 9 07:43:04 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Tue Aug 9 08:28:21 2005 Subject: [BioRuby-cvs] bioruby README,1.8,1.9 Message-ID: <200508091143.j79Bh4dZ002330@pub.open-bio.org> Update of /home/repository/bioruby/bioruby In directory pub.open-bio.org:/tmp/cvs-serv2274 Modified Files: README Log Message: * FTP removed... (many other points are also needed to be fixed) Index: README =================================================================== RCS file: /home/repository/bioruby/bioruby/README,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** README 22 Aug 2003 00:49:51 -0000 1.8 --- README 9 Aug 2005 11:43:02 -0000 1.9 *************** *** 23,27 **** * WWW -- (()) ! * FTP -- (()) * CVS -- (()) --- 23,27 ---- * WWW -- (()) ! http://bioruby.org/archive/ * CVS -- (()) From k at pub.open-bio.org Tue Aug 9 07:57:55 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Tue Aug 9 08:46:15 2005 Subject: [BioRuby-cvs] bioruby/lib bio.rb,1.42,1.43 Message-ID: <200508091157.j79BvtdZ002461@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib In directory pub.open-bio.org:/tmp/cvs-serv2457/lib Modified Files: bio.rb Log Message: * added sirna.rb and fastacmd.rb Index: bio.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio.rb,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** bio.rb 11 Jul 2005 09:40:02 -0000 1.42 --- bio.rb 9 Aug 2005 11:57:53 -0000 1.43 *************** *** 108,111 **** --- 108,112 ---- require 'bio/io/flatfile/index' require 'bio/io/flatfile/bdb' + require 'bio/io/fastacmd' require 'bio/io/fetch' require 'bio/io/sql' *************** *** 148,150 **** --- 149,155 ---- require 'bio/appl/spidey/report' require 'bio/appl/blat/report' + + ### Utilities + + require 'bio/util/sirna' From k at pub.open-bio.org Wed Aug 10 08:51:18 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Wed Aug 10 09:36:34 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/io flatfile.rb,1.33,1.34 Message-ID: <200508101251.j7ACpIdZ006365@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/io In directory pub.open-bio.org:/tmp/cvs-serv6356/lib/bio/io Modified Files: flatfile.rb Log Message: * the order of the first two arguments for the new and open method can be inverted. * the logic separated by the new and open methods is merged and simplified. * documentation updated. Index: flatfile.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/io/flatfile.rb,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** flatfile.rb 20 Jun 2005 16:46:27 -0000 1.33 --- flatfile.rb 10 Aug 2005 12:51:15 -0000 1.34 *************** *** 2,6 **** # bio/io/flatfile.rb - flatfile access wrapper class # ! # Copyright (C) 2001, 2002 GOTO Naohisa # # This library is free software; you can redistribute it and/or --- 2,6 ---- # bio/io/flatfile.rb - flatfile access wrapper class # ! # Copyright (C) 2001-2005 GOTO Naohisa # # This library is free software; you can redistribute it and/or *************** *** 27,88 **** include Enumerable ! def self.open(dbclass, file, *arg) ! # 3rd and 4th arg: mode, perm (passed to File.open) ! openmode = [] ! while x = arg[0] and !x.is_a?(Hash) ! openmode << arg.shift ! end ! # rest of arg: passed to FlatFile.new ! # create a flatfile object ! unless file.respond_to?(:gets) ! # 'file' is a filename ! if block_given? then ! File.open(file, *openmode) do |fobj| ! ff = self.new(dbclass, fobj, *arg) ! yield ff ! end ! else ! fobj = File.open(file, *openmode) ! self.new(dbclass, fobj, *arg) ! end ! else ! # 'file' is a IO object ! ff = self.new(dbclass, file, *arg) ! block_given? ? (yield ff) : ff end end ! def self.auto(*arg, &block) ! self.open(nil, *arg, &block) end ! def self.to_a(*arg) ! self.auto(*arg) do |ff| ! raise 'cannot determine file format' unless ff.dbclass ! ff.to_a end end ! def initialize(dbclass, stream, options = nil) ! # 2nd arg: IO object ! @io = stream ! # 3rd arg: options (nil or a Hash) ! self.raw = false ! if options.is_a?(Hash) then ! self.raw = options[:raw] if options.has_key?(:raw) ! else ! self.raw = options end ! # initialize prefetch buffer ! @prefetch = '' ! # 1st arg: database class (or file format autodetection) ! if dbclass then self.dbclass = dbclass else ! autodetect end end attr_reader :io def next_entry @entry_raw = gets(@rs) --- 27,107 ---- include Enumerable ! def self.to_a(*args) ! self.auto(*args) do |ff| ! raise 'cannot determine file format' unless ff.dbclass ! ff.to_a end end ! # Bio::FlatFile.auto(filename/io[, [mode, parm,] opts]) [{block}] ! def self.auto(*args, &block) ! self.open(nil, *args, &block) end ! # Bio::FlatFile.open(filename/io, dbclass[, [mode, parm,] opts]) [{block}] ! # or ! # Bio::FlatFile.open(dbclass, filename/io[, [mode, parm,] opts]) [{block}] ! def self.open(*args) ! ff = self.new(*args) ! if block_given? ! yield ff ! ff.close ! else ! ff end end ! # Bio::FlatFile.new(filename/io, dbclass[, [mode, parm,] opts]) ! # or ! # Bio::FlatFile.new(dbclass, filename/io[, [mode, parm,] opts]) ! def initialize(file, dbclass, *args) ! if file.nil? or file.kind_of?(Module) ! # swap first two arguments if needed for the backward compatibility ! dbclass, file = file, dbclass end ! openmode = parse_opts(args) # args is always an Array ! ! if file.respond_to?(:gets) # 'file' is already an IO object ! @io = file ! else # 'file' is a filename ! @io = File.open(file, *openmode) ! end ! ! @prefetch = '' # initialize prefetch buffer ! if dbclass self.dbclass = dbclass else ! autodetect # file format autodetection end end attr_reader :io + # 1. if the 1st element is not a Hash or true, assume it as a "mode" + # for File.open + # 2. if the 2nd element is not a Hash or true, assume it as a "parm" + # for File.open + # 3. if the 3rd element is a Hash and have a key ':raw', use its value + # to specify the raw mode (other keys are not in the FlatFile spec yet). + # 4. elsif the 3rd element is true, treat it as 'raw = true' is specified + # for the backward compatibility + def parse_opts(args) + # openmode = args.reject {|x| x.is_a?(Hash) or x.is_a?(TrueClass)} + mode = args.shift unless args[0].is_a?(Hash) or args[0].is_a?(TrueClass) + perm = args.shift unless args[0].is_a?(Hash) or args[0].is_a?(TrueClass) + opts = args.shift + openmode = [mode, perm].compact + + self.raw = false + if opts.is_a?(Hash) and opts.has_key?(:raw) + self.raw = opts[:raw] + else + self.raw = opts # true or nil + end + + return openmode + end + private :parse_opts + + def next_entry @entry_raw = gets(@rs) *************** *** 361,428 **** = Bio::FlatFile ! --- Bio::FlatFile.auto(filename_or_stream[, mode, perm, options]) ! Same as Bio::FlatFile.open(nil, filename_or_stream, mode, perm, options). * Example 1 ! Bio::FlatFile.auto(ARGF) * Example 2 ! Bio::FlatFile.auto("embl/est_hum17.dat") * Example 3 ! Bio::FlatFile.auto(IO.popen("gzip -dc nc1101.flat.gz")) ! ! --- Bio::FlatFile.open(dbclass, filename_or_stream[, mode, perm, options]) ! Prepare to read a file or a stream 'filename_or_stream' ! which contains 'dbclass'-style formatted data. ! 'dbclass' shoud be a class (or module) or nil. ! e.g. Bio::GenBank, Bio::FastaFormat. ! If 'filename_or_stream' is a filename (which doesn't have gets method), ! the method opens a local file named 'filename_or_stream' ! with 'File.open(filename, mode, perm)'. ! When nil is given to dbclass, trying to determine database class ! (file format) automatically. If fails to determine, dbclass is ! set to nil and FlatFile#next_entry works same as IO#gets when ! raw = true. It is recommended to set dbclass using ! FlatFile#dbclass= method if fails to determine automatically. * Example 1 ! Bio::FlatFile.open(Bio::GenBank, "genbank/gbest40.seq") * Example 2 ! Bio::FlatFile.open(nil, "embl/est_hum17.dat") * Example 3 ! Bio::FlatFile.open(Bio::GenBank, $stdin) ! If it is called with block, the block will be executed with ! a newly opened Bio::FlatFile instance object. If filename ! is given, the file is automatically closed when leaving the block. * Example 4 ! Bio::FlatFile.open(nil, 'test4.fst') do |ff| ! ff.each { |e| print e.definition, "\n" } end ! --- Bio::FlatFile.new(dbclass, stream, options = nil) ! Same as FlatFile.open, except that 'stream' should be a opened ! stream object (IO, File, ..., who have the 'gets' method). * Example 1 ! Bio::FlatFile.new(Bio::GenBank, ARGF) * Example 2 ! Bio::FlatFile.new(Bio::GenBank, IO.popen("gzip -dc nc1101.flat.gz")) ! ! 'options' needs to be a hash (or nil). ! Current options are below: ! :raw --> if true, "raw mode" (same as #raw=true). ! default: false (not "raw mode"). ! * Example 3 ! Bio::FlatFile.new(nil, $stdin, :raw=>true) ! * Example 3 in old style (deprecated) ! Bio::FlatFile.new(nil, $stdin, true) --- Bio::FlatFile.to_a(filename_or_stream, *arg) --- 380,473 ---- = Bio::FlatFile ! --- Bio::FlatFile.new(filename_or_stream, dbclass[, [mode, parm,] options]) ! --- Bio::FlatFile.new(dbclass, filename_or_stream[, [mode, parm,] options]) ! Prepare to read a file or a IO stream specified in 'filename_or_stream'. ! If the 'filename_or_stream' is a filename, this method opens the local ! file as File.open(filename, mode, perm). See the documentations on ! Ruby's Kernel#open method for the 'mode' and 'parm' options. ! ! The 'dbclass' must be a one of the BioRuby's database class name ! (e.g. Bio::GenBank, Bio::FastaFormat). ! If nil is given to the 'dbclass', try to determine database class ! (file format) automatically. It is recommended to set 'dbclass' ! using FlatFile#dbclass= method if the automatic determination failed. ! Otherwise, 'dbclass' is set to nil and FlatFile#next_entry can act same ! as the IO#gets method only when the raw mode is on (raw = true). ! ! The last argument 'options' is a Hash (or nil to omit) containing ! flags to determine the behavior of the Bio::FlatFile instance. ! Currently, only the ':raw' flag is recognized as the key. ! If the value of options[:raw] is true, "raw mode" is on (defalut is off). ! You can also change this flag by Bio::FlatFile#raw = true afterwards. ! ! Backward compatibility: ! The order of the first two arguments is automatically recognized. * Example 1 ! Bio::FlatFile.new(ARGF, Bio::GenBank) ! Bio::FlatFile.new(Bio::GenBank, ARGF) * Example 2 ! Bio::FlatFile.new(IO.popen("gzip -dc nc1101.flat.gz"), Bio::GenBank) * Example 3 ! Bio::FlatFile.new($stdin, nil, :raw => true) ! # following notation was also used in the old BioRuby to specify ! # the raw mode (deprecated). ! Bio::FlatFile.new($stdin, nil, true) ! --- Bio::FlatFile.open(filename_or_stream, dbclass[, [mode, perm,] options]) ! --- Bio::FlatFile.open(dbclass, filename_or_stream[, [mode, perm,] options]) ! Open a file as a flat file database in the specified 'dbclass' format. ! Similar to Bio::FlatFile.new but also accepts block. ! Refer to the document of Bio::FlatFile.new for the other options. ! Backward compatibilities: ! It is not recommended because the name of this method is resemble to ! the Ruby's File.open, but the 'filename_or_stream' can be an already ! opened IO stream. It is also not recommended but if nil is specified ! to the 'dbclass', this method acts as the Bio::FlatFile.auto method. * Example 1 ! ff = Bio::FlatFile.open("genbank/gbest40.seq", Bio::GenBank) * Example 2 ! ff = Bio::FlatFile.open("embl/est_hum17.dat", nil) * Example 3 ! ff = Bio::FlatFile.open($stdin, Bio::GenBank) ! If it is called with block, the block is passed to the newly opened ! Bio::FlatFile instance and the file will be automatically closed ! when leaving the block. * Example 4 ! Bio::FlatFile.open('test4.fst', Bio::FastaFormat) do |ff| ! ff.each { |e| puts e.definition } end ! --- Bio::FlatFile.auto(filename_or_stream[, [mode, perm,] options]) ! Open a file or an IO stream by auto detection of the database format. ! Similar to Bio::FlatFile.open but no need to specify the 'dbclass'. ! This method would be most useful one among the 'new', 'open' and 'auto'. ! Refer to the document of Bio::FlatFile.new for other options. * Example 1 ! flatfile = Bio::FlatFile.auto(ARGF) ! flatfile.each do |entry| ! # do something on entry ! puts entry.entry_id ! end * Example 2 ! Bio::FlatFile.auto("embl/est_hum17.dat") * Example 3 ! Bio::FlatFile.auto(IO.popen("gzip -dc nc1101.flat.gz")) ! * Example 4 ! Bio::FlatFile.auto(ARGF) do |flatfile| ! flatfile.each do |entry| ! # do something on entry ! puts entry.entry_id ! end ! end --- Bio::FlatFile.to_a(filename_or_stream, *arg) From k at pub.open-bio.org Wed Aug 10 08:53:04 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Wed Aug 10 09:38:12 2005 Subject: [BioRuby-cvs] bioruby/lib/bio sequence.rb,0.39,0.40 Message-ID: <200508101253.j7ACr4dZ006394@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio In directory pub.open-bio.org:/tmp/cvs-serv6388/lib/bio Modified Files: sequence.rb Log Message: * Bio::Sequence::NA#to_re for RNA sequence is fixed to act same as bioruby-0.6.2 (the change introduced in bioruby-0.6.3 is not tested enough). Index: sequence.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/sequence.rb,v retrieving revision 0.39 retrieving revision 0.40 diff -C2 -d -r0.39 -r0.40 *** sequence.rb 8 Aug 2005 00:44:55 -0000 0.39 --- sequence.rb 10 Aug 2005 12:53:02 -0000 0.40 *************** *** 249,253 **** def to_re if self.rna? ! NucleicAcid.to_re(self.dna) else NucleicAcid.to_re(self) --- 249,253 ---- def to_re if self.rna? ! NucleicAcid.to_re(self.dna, true) else NucleicAcid.to_re(self) From k at pub.open-bio.org Wed Aug 10 08:53:04 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Wed Aug 10 09:38:12 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/data na.rb,0.12,0.13 Message-ID: <200508101253.j7ACr4dZ006398@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/data In directory pub.open-bio.org:/tmp/cvs-serv6388/lib/bio/data Modified Files: na.rb Log Message: * Bio::Sequence::NA#to_re for RNA sequence is fixed to act same as bioruby-0.6.2 (the change introduced in bioruby-0.6.3 is not tested enough). Index: na.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/data/na.rb,v retrieving revision 0.12 retrieving revision 0.13 diff -C2 -d -r0.12 -r0.13 *** na.rb 8 Aug 2005 12:57:24 -0000 0.12 --- na.rb 10 Aug 2005 12:53:02 -0000 0.13 *************** *** 124,128 **** end ! def to_re(seq) str = "" seq.to_s.downcase.each_byte do |base| --- 124,128 ---- end ! def to_re(seq, rna = false) str = "" seq.to_s.downcase.each_byte do |base| *************** *** 132,135 **** --- 132,138 ---- str += "." end + end + if rna + str.tr!("t", "u") end Regexp.new(str) From k at pub.open-bio.org Wed Aug 10 08:53:56 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Wed Aug 10 09:38:59 2005 Subject: [BioRuby-cvs] bioruby/test/bio test_sequence.rb,1.1,1.2 Message-ID: <200508101253.j7ACrudZ006425@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/test/bio In directory pub.open-bio.org:/tmp/cvs-serv6421/test/bio Modified Files: test_sequence.rb Log Message: * assert_in_delta is used instead of assert_equal for molecular_weight Index: test_sequence.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/test/bio/test_sequence.rb,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_sequence.rb 12 Nov 2004 02:27:08 -0000 1.1 --- test_sequence.rb 10 Aug 2005 12:53:53 -0000 1.2 *************** *** 31,37 **** class TestSequence < Test::Unit::TestCase def setup ! @na = Sequence::NA.new('atgcatgcatgcatgcaaaa') @rna = Sequence::NA.new('augcaugcaugcaugcaaaa') ! @aa = Sequence::AA.new('ACDEFGHIKLMNPQRSTVWYU') end --- 31,37 ---- class TestSequence < Test::Unit::TestCase def setup ! @na = Sequence::NA.new('atgcatgcatgcatgcaaaa') @rna = Sequence::NA.new('augcaugcaugcaugcaaaa') ! @aa = Sequence::AA.new('ACDEFGHIKLMNPQRSTVWYU') end *************** *** 240,248 **** def test_dna_molecular_weight ! assert_equal(6214.715, @na.molecular_weight) end def test_rna_molecular_weight ! assert_equal(6478.595, @rna.molecular_weight) end --- 240,248 ---- def test_dna_molecular_weight ! assert_in_delta(6174.3974, @na.molecular_weight, 1e-5) end def test_rna_molecular_weight ! assert_in_delta(6438.2774, @rna.molecular_weight, 1e-5) end From k at pub.open-bio.org Wed Aug 10 08:55:08 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Wed Aug 10 09:40:11 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/io fastacmd.rb,1.5,1.6 Message-ID: <200508101255.j7ACt8dZ006454@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/io In directory pub.open-bio.org:/tmp/cvs-serv6448/lib/bio/io Modified Files: fastacmd.rb Log Message: * renamed to Bio::Blast::Fastacmd (from Bio::Fastacmd) * popen is left for win32 environmnets (open3 is recommended, although) Index: fastacmd.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/io/fastacmd.rb,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** fastacmd.rb 10 Aug 2005 05:41:31 -0000 1.5 --- fastacmd.rb 10 Aug 2005 12:55:06 -0000 1.6 *************** *** 27,58 **** module Bio ! class Fastacmd ! include Enumerable ! def initialize(db) ! @database = db ! @fastacmd = 'fastacmd' ! end ! attr_accessor :database, :fastacmd ! # get an entry_id and returns a Bio::FastaFormat object ! def get_by_id(entry_id) ! fetch(entry_id).shift end ! # get one or more entry_id and returns an Array of Bio::FastaFormat objects ! def fetch(list) ! if list.respond_to?(:join) ! entry_id = list.join(",") ! else ! entry_id = list end ! cmd = [ @fastacmd, '-d', @database, '-s', entry_id ] Open3.popen3(*cmd) do |inn, out, err| inn.close ! t = Thread.start { err.read } results = Bio::FlatFile.new(Bio::FastaFormat, out).to_a t.join --- 27,66 ---- module Bio + class Blast ! class Fastacmd ! include Enumerable ! def initialize(db) ! @database = db ! @fastacmd = 'fastacmd' ! end ! attr_accessor :database, :fastacmd, :errorlog ! # get an entry_id and returns a Bio::FastaFormat object ! def get_by_id(entry_id) ! fetch(entry_id).shift ! end ! ! # get one or more entry_id and returns an Array of Bio::FastaFormat objects ! def fetch(list) ! if list.respond_to?(:join) ! entry_id = list.join(",") ! else ! entry_id = list end ! if RUBY_PLATFORM[/mswin32|bccwin32/] # replace with appl/factory.rb ! cmd = "#{@fastacmd} -d #{@database} -s #{entry_id}" ! IO.popen(cmd, "r") do |io| ! io.sync = true ! results = Bio::FlatFile.new(Bio::FastaFormat, io).to_a end ! else cmd = [ @fastacmd, '-d', @database, '-s', entry_id ] Open3.popen3(*cmd) do |inn, out, err| inn.close ! t = Thread.start { @errorlog = err.read } results = Bio::FlatFile.new(Bio::FastaFormat, out).to_a t.join *************** *** 60,82 **** end end ! def each_entry cmd = [ @fastacmd, '-d', @database, '-D', 'T' ] Open3.popen3(*cmd) do |inn, out, err| inn.close ! t = Thread.start { err.read } ! f = Bio::FlatFile.new(Bio::FastaFormat, out) ! f.each_entry do |e| ! yield e end t.join end - self end ! alias :each :each_entry ! end end --- 68,105 ---- end end + end ! def each_entry ! if RUBY_PLATFORM[/mswin32|bccwin32/] # replace with appl/factory.rb ! cmd = "#{@fastacmd} -d #{@database} -D T" ! IO.popen(cmd, "r") do |io| ! io.sync = true ! Bio::FlatFile.open(Bio::FastaFormat, io) do |f| ! f.each_entry do |e| ! yield e ! end ! end ! end ! else cmd = [ @fastacmd, '-d', @database, '-D', 'T' ] Open3.popen3(*cmd) do |inn, out, err| inn.close ! t = Thread.start { @errorlog = err.read } ! Bio::FlatFile.open(Bio::FastaFormat, out) do |f| ! f.each_entry do |e| ! yield e ! end end t.join end end ! self end + alias :each :each_entry + + end end + end *************** *** 87,96 **** ent_list = ["sp:1433_SPIOL", "sp:1432_MAIZE"] ! fastacmd = Bio::Fastacmd.new(database) ### Retrieve one sequence entry = fastacmd.get_by_id(entry_id) ! # Bio::Fastacmd#get_by_id(entry_id) returns a Bio::FastaFormat object. p entry --- 110,119 ---- ent_list = ["sp:1433_SPIOL", "sp:1432_MAIZE"] ! fastacmd = Bio::Blast::Fastacmd.new(database) ### Retrieve one sequence entry = fastacmd.get_by_id(entry_id) ! # Fastacmd#get_by_id(entry_id) returns a Bio::FastaFormat object. p entry *************** *** 98,102 **** puts entry ! # Bio::Fastacmd#fetch(entry_id) returns an Array of a Bio::FastaFormat # object even when the result is a single entry. p fastacmd.fetch(entry_id) --- 121,125 ---- puts entry ! # Fastacmd#fetch(entry_id) returns an Array of a Bio::FastaFormat # object even when the result is a single entry. p fastacmd.fetch(entry_id) *************** *** 104,108 **** ### Retrieve more sequences ! # Bio::Fastacmd#fetch method also accepts a list of entry_id and returns # an Array of Bio::FastaFormat objects. p fastacmd.fetch(ent_list) --- 127,131 ---- ### Retrieve more sequences ! # Fastacmd#fetch method also accepts a list of entry_id and returns # an Array of Bio::FastaFormat objects. p fastacmd.fetch(ent_list) From k at pub.open-bio.org Wed Aug 10 08:55:43 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Wed Aug 10 09:40:47 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/appl/bl2seq report.rb,1.1,1.2 Message-ID: <200508101255.j7ACthdZ006481@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl/bl2seq In directory pub.open-bio.org:/tmp/cvs-serv6477/lib/bio/appl/bl2seq Modified Files: report.rb Log Message: * renamed to Bio::Blast::Bl2seq (from Bio::Bl2seq) Index: report.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/bl2seq/report.rb,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** report.rb 7 Aug 2005 16:42:28 -0000 1.1 --- report.rb 10 Aug 2005 12:55:41 -0000 1.2 *************** *** 29,32 **** --- 29,34 ---- module Bio + class Blast + class Bl2seq class Report < Bio::Blast::Default::Report *************** *** 97,100 **** --- 99,104 ---- end #class Report end #class Bl2seq + + end #class Blast end #module Bio *************** *** 103,110 **** if __FILE__ == $0 ! Bio::FlatFile.open(Bio::Bl2seq::Report, ARGF) do |ff| ff.each do |rep| ! print "# === Bio::Bl2seq::Report\n" puts #@#print " rep.program #=> "; p rep.program --- 107,114 ---- if __FILE__ == $0 ! Bio::FlatFile.open(Bio::Blast::Bl2seq::Report, ARGF) do |ff| ff.each do |rep| ! print "# === Bio::Blast::Bl2seq::Report\n" puts #@#print " rep.program #=> "; p rep.program *************** *** 171,175 **** rep.iterations.each do |itr| ! print "# --- Bio::Bl2seq::Report::Iteration\n" puts --- 175,179 ---- rep.iterations.each do |itr| ! print "# --- Bio::Blast::Bl2seq::Report::Iteration\n" puts *************** *** 194,198 **** itr.hits.each_with_index do |hit, i| ! print "# --- Bio::Bl2seq::Default::Report::Hit" print " ([#{i}])\n" puts --- 198,202 ---- itr.hits.each_with_index do |hit, i| ! print "# --- Bio::Blast::Bl2seq::Default::Report::Hit" print " ([#{i}])\n" puts *************** *** 245,249 **** hit.hsps.each_with_index do |hsp, j| ! print "# --- Bio::Blast::Default::Report::HSP (Bio::Bl2seq::Report::HSP)" print " ([#{j}])\n" puts --- 249,253 ---- hit.hsps.each_with_index do |hsp, j| ! print "# --- Bio::Blast::Default::Report::HSP (Bio::Blast::Bl2seq::Report::HSP)" print " ([#{j}])\n" puts *************** *** 295,299 **** =begin ! = Bio::Bl2seq::Default::Report NCBI bl2seq (BLAST 2 sequences) output parser --- 299,303 ---- =begin ! = Bio::Blast::Bl2seq::Report NCBI bl2seq (BLAST 2 sequences) output parser From k at pub.open-bio.org Wed Aug 10 08:56:39 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Wed Aug 10 09:41:42 2005 Subject: [BioRuby-cvs] bioruby/lib bio.rb,1.43,1.44 Message-ID: <200508101256.j7ACuddZ006539@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib In directory pub.open-bio.org:/tmp/cvs-serv6535/lib Modified Files: bio.rb Log Message: * bio/appl/bl2seq/report is included * prepared for 0.6.4 release Index: bio.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio.rb,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** bio.rb 9 Aug 2005 11:57:53 -0000 1.43 --- bio.rb 10 Aug 2005 12:56:37 -0000 1.44 *************** *** 22,26 **** module Bio ! BIORUBY_VERSION = [0, 6, 3].extend(Comparable) end --- 22,26 ---- module Bio ! BIORUBY_VERSION = [0, 6, 4].extend(Comparable) end *************** *** 133,136 **** --- 133,137 ---- require 'bio/appl/blast/xmlparser' require 'bio/appl/blast/format8' + require 'bio/appl/bl2seq/report' require 'bio/appl/hmmer' require 'bio/appl/hmmer/report' From k at pub.open-bio.org Wed Aug 10 08:57:03 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Wed Aug 10 09:42:09 2005 Subject: [BioRuby-cvs] bioruby ChangeLog,1.33,1.34 gemspec.rb,1.2,1.3 Message-ID: <200508101257.j7ACv3dZ006566@pub.open-bio.org> Update of /home/repository/bioruby/bioruby In directory pub.open-bio.org:/tmp/cvs-serv6562 Modified Files: ChangeLog gemspec.rb Log Message: * prepared for 0.6.4 release Index: gemspec.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/gemspec.rb,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** gemspec.rb 7 Aug 2005 08:22:32 -0000 1.2 --- gemspec.rb 10 Aug 2005 12:57:01 -0000 1.3 *************** *** 4,8 **** spec = Gem::Specification.new do |s| s.name = 'bioruby' ! s.version = "0.6.3" s.author = "BioRuby project" s.email = "staff@bioruby.org" --- 4,8 ---- spec = Gem::Specification.new do |s| s.name = 'bioruby' ! s.version = "0.6.4" s.author = "BioRuby project" s.email = "staff@bioruby.org" Index: ChangeLog =================================================================== RCS file: /home/repository/bioruby/bioruby/ChangeLog,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** ChangeLog 9 Aug 2005 11:38:37 -0000 1.33 --- ChangeLog 10 Aug 2005 12:57:01 -0000 1.34 *************** *** 1,2 **** --- 1,12 ---- + 2005-08-10 Toshiaki Katayama + + * BioRuby 0.6.4 is released. + + * Sequence#to_re method to have compatibility with 0.6.2 for RNA + * Fixed Bio::Fastacmd#fetch to work + * Bio::Fastacmd and Bio::Bl2seq classes (introduced in 0.6.3) are + renamed to Bio::Blast::Fastacmd, Bio::Blast::Bl2seq respectively. + * new and open method of the Bio::FlatFile are refactored. + 2005-08-09 Toshiaki Katayama From k at pub.open-bio.org Wed Aug 10 13:15:26 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Wed Aug 10 14:00:37 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/io flatfile.rb,1.34,1.35 Message-ID: <200508101715.j7AHFQdZ008761@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/io In directory pub.open-bio.org:/tmp/cvs-serv8755/lib/bio/io Modified Files: flatfile.rb Log Message: * reverted to the previous version. proposed changes will be considered in the 0.7 series. Index: flatfile.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/io/flatfile.rb,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** flatfile.rb 10 Aug 2005 12:51:15 -0000 1.34 --- flatfile.rb 10 Aug 2005 17:15:23 -0000 1.35 *************** *** 2,6 **** # bio/io/flatfile.rb - flatfile access wrapper class # ! # Copyright (C) 2001-2005 GOTO Naohisa # # This library is free software; you can redistribute it and/or --- 2,6 ---- # bio/io/flatfile.rb - flatfile access wrapper class # ! # Copyright (C) 2001, 2002 GOTO Naohisa # # This library is free software; you can redistribute it and/or *************** *** 27,107 **** include Enumerable ! def self.to_a(*args) ! self.auto(*args) do |ff| ! raise 'cannot determine file format' unless ff.dbclass ! ff.to_a end end ! # Bio::FlatFile.auto(filename/io[, [mode, parm,] opts]) [{block}] ! def self.auto(*args, &block) ! self.open(nil, *args, &block) end ! # Bio::FlatFile.open(filename/io, dbclass[, [mode, parm,] opts]) [{block}] ! # or ! # Bio::FlatFile.open(dbclass, filename/io[, [mode, parm,] opts]) [{block}] ! def self.open(*args) ! ff = self.new(*args) ! if block_given? ! yield ff ! ff.close ! else ! ff end end ! # Bio::FlatFile.new(filename/io, dbclass[, [mode, parm,] opts]) ! # or ! # Bio::FlatFile.new(dbclass, filename/io[, [mode, parm,] opts]) ! def initialize(file, dbclass, *args) ! if file.nil? or file.kind_of?(Module) ! # swap first two arguments if needed for the backward compatibility ! dbclass, file = file, dbclass ! end ! openmode = parse_opts(args) # args is always an Array ! ! if file.respond_to?(:gets) # 'file' is already an IO object ! @io = file ! else # 'file' is a filename ! @io = File.open(file, *openmode) end ! ! @prefetch = '' # initialize prefetch buffer ! if dbclass self.dbclass = dbclass else ! autodetect # file format autodetection end end attr_reader :io - # 1. if the 1st element is not a Hash or true, assume it as a "mode" - # for File.open - # 2. if the 2nd element is not a Hash or true, assume it as a "parm" - # for File.open - # 3. if the 3rd element is a Hash and have a key ':raw', use its value - # to specify the raw mode (other keys are not in the FlatFile spec yet). - # 4. elsif the 3rd element is true, treat it as 'raw = true' is specified - # for the backward compatibility - def parse_opts(args) - # openmode = args.reject {|x| x.is_a?(Hash) or x.is_a?(TrueClass)} - mode = args.shift unless args[0].is_a?(Hash) or args[0].is_a?(TrueClass) - perm = args.shift unless args[0].is_a?(Hash) or args[0].is_a?(TrueClass) - opts = args.shift - openmode = [mode, perm].compact - - self.raw = false - if opts.is_a?(Hash) and opts.has_key?(:raw) - self.raw = opts[:raw] - else - self.raw = opts # true or nil - end - - return openmode - end - private :parse_opts - - def next_entry @entry_raw = gets(@rs) --- 27,88 ---- include Enumerable ! def self.open(dbclass, file, *arg) ! # 3rd and 4th arg: mode, perm (passed to File.open) ! openmode = [] ! while x = arg[0] and !x.is_a?(Hash) ! openmode << arg.shift ! end ! # rest of arg: passed to FlatFile.new ! # create a flatfile object ! unless file.respond_to?(:gets) ! # 'file' is a filename ! if block_given? then ! File.open(file, *openmode) do |fobj| ! ff = self.new(dbclass, fobj, *arg) ! yield ff ! end ! else ! fobj = File.open(file, *openmode) ! self.new(dbclass, fobj, *arg) ! end ! else ! # 'file' is a IO object ! ff = self.new(dbclass, file, *arg) ! block_given? ? (yield ff) : ff end end ! def self.auto(*arg, &block) ! self.open(nil, *arg, &block) end ! def self.to_a(*arg) ! self.auto(*arg) do |ff| ! raise 'cannot determine file format' unless ff.dbclass ! ff.to_a end end ! def initialize(dbclass, stream, options = nil) ! # 2nd arg: IO object ! @io = stream ! # 3rd arg: options (nil or a Hash) ! self.raw = false ! if options.is_a?(Hash) then ! self.raw = options[:raw] if options.has_key?(:raw) ! else ! self.raw = options end ! # initialize prefetch buffer ! @prefetch = '' ! # 1st arg: database class (or file format autodetection) ! if dbclass then self.dbclass = dbclass else ! autodetect end end attr_reader :io def next_entry @entry_raw = gets(@rs) *************** *** 380,473 **** = Bio::FlatFile ! --- Bio::FlatFile.new(filename_or_stream, dbclass[, [mode, parm,] options]) ! --- Bio::FlatFile.new(dbclass, filename_or_stream[, [mode, parm,] options]) ! ! Prepare to read a file or a IO stream specified in 'filename_or_stream'. ! If the 'filename_or_stream' is a filename, this method opens the local ! file as File.open(filename, mode, perm). See the documentations on ! Ruby's Kernel#open method for the 'mode' and 'parm' options. ! ! The 'dbclass' must be a one of the BioRuby's database class name ! (e.g. Bio::GenBank, Bio::FastaFormat). ! If nil is given to the 'dbclass', try to determine database class ! (file format) automatically. It is recommended to set 'dbclass' ! using FlatFile#dbclass= method if the automatic determination failed. ! Otherwise, 'dbclass' is set to nil and FlatFile#next_entry can act same ! as the IO#gets method only when the raw mode is on (raw = true). ! ! The last argument 'options' is a Hash (or nil to omit) containing ! flags to determine the behavior of the Bio::FlatFile instance. ! Currently, only the ':raw' flag is recognized as the key. ! If the value of options[:raw] is true, "raw mode" is on (defalut is off). ! You can also change this flag by Bio::FlatFile#raw = true afterwards. ! Backward compatibility: ! The order of the first two arguments is automatically recognized. * Example 1 ! Bio::FlatFile.new(ARGF, Bio::GenBank) ! Bio::FlatFile.new(Bio::GenBank, ARGF) * Example 2 ! Bio::FlatFile.new(IO.popen("gzip -dc nc1101.flat.gz"), Bio::GenBank) * Example 3 ! Bio::FlatFile.new($stdin, nil, :raw => true) ! # following notation was also used in the old BioRuby to specify ! # the raw mode (deprecated). ! Bio::FlatFile.new($stdin, nil, true) ! --- Bio::FlatFile.open(filename_or_stream, dbclass[, [mode, perm,] options]) ! --- Bio::FlatFile.open(dbclass, filename_or_stream[, [mode, perm,] options]) ! Open a file as a flat file database in the specified 'dbclass' format. ! Similar to Bio::FlatFile.new but also accepts block. ! Refer to the document of Bio::FlatFile.new for the other options. ! Backward compatibilities: ! It is not recommended because the name of this method is resemble to ! the Ruby's File.open, but the 'filename_or_stream' can be an already ! opened IO stream. It is also not recommended but if nil is specified ! to the 'dbclass', this method acts as the Bio::FlatFile.auto method. * Example 1 ! ff = Bio::FlatFile.open("genbank/gbest40.seq", Bio::GenBank) * Example 2 ! ff = Bio::FlatFile.open("embl/est_hum17.dat", nil) * Example 3 ! ff = Bio::FlatFile.open($stdin, Bio::GenBank) ! If it is called with block, the block is passed to the newly opened ! Bio::FlatFile instance and the file will be automatically closed ! when leaving the block. * Example 4 ! Bio::FlatFile.open('test4.fst', Bio::FastaFormat) do |ff| ! ff.each { |e| puts e.definition } end ! --- Bio::FlatFile.auto(filename_or_stream[, [mode, perm,] options]) ! Open a file or an IO stream by auto detection of the database format. ! Similar to Bio::FlatFile.open but no need to specify the 'dbclass'. ! This method would be most useful one among the 'new', 'open' and 'auto'. ! Refer to the document of Bio::FlatFile.new for other options. * Example 1 ! flatfile = Bio::FlatFile.auto(ARGF) ! flatfile.each do |entry| ! # do something on entry ! puts entry.entry_id ! end * Example 2 ! Bio::FlatFile.auto("embl/est_hum17.dat") * Example 3 ! Bio::FlatFile.auto(IO.popen("gzip -dc nc1101.flat.gz")) ! * Example 4 ! Bio::FlatFile.auto(ARGF) do |flatfile| ! flatfile.each do |entry| ! # do something on entry ! puts entry.entry_id ! end ! end --- Bio::FlatFile.to_a(filename_or_stream, *arg) --- 361,428 ---- = Bio::FlatFile ! --- Bio::FlatFile.auto(filename_or_stream[, mode, perm, options]) ! Same as Bio::FlatFile.open(nil, filename_or_stream, mode, perm, options). * Example 1 ! Bio::FlatFile.auto(ARGF) * Example 2 ! Bio::FlatFile.auto("embl/est_hum17.dat") * Example 3 ! Bio::FlatFile.auto(IO.popen("gzip -dc nc1101.flat.gz")) ! --- Bio::FlatFile.open(dbclass, filename_or_stream[, mode, perm, options]) ! Prepare to read a file or a stream 'filename_or_stream' ! which contains 'dbclass'-style formatted data. ! 'dbclass' shoud be a class (or module) or nil. ! e.g. Bio::GenBank, Bio::FastaFormat. ! If 'filename_or_stream' is a filename (which doesn't have gets method), ! the method opens a local file named 'filename_or_stream' ! with 'File.open(filename, mode, perm)'. ! ! When nil is given to dbclass, trying to determine database class ! (file format) automatically. If fails to determine, dbclass is ! set to nil and FlatFile#next_entry works same as IO#gets when ! raw = true. It is recommended to set dbclass using ! FlatFile#dbclass= method if fails to determine automatically. * Example 1 ! Bio::FlatFile.open(Bio::GenBank, "genbank/gbest40.seq") * Example 2 ! Bio::FlatFile.open(nil, "embl/est_hum17.dat") * Example 3 ! Bio::FlatFile.open(Bio::GenBank, $stdin) ! If it is called with block, the block will be executed with ! a newly opened Bio::FlatFile instance object. If filename ! is given, the file is automatically closed when leaving the block. * Example 4 ! Bio::FlatFile.open(nil, 'test4.fst') do |ff| ! ff.each { |e| print e.definition, "\n" } end ! --- Bio::FlatFile.new(dbclass, stream, options = nil) ! Same as FlatFile.open, except that 'stream' should be a opened ! stream object (IO, File, ..., who have the 'gets' method). * Example 1 ! Bio::FlatFile.new(Bio::GenBank, ARGF) * Example 2 ! Bio::FlatFile.new(Bio::GenBank, IO.popen("gzip -dc nc1101.flat.gz")) ! ! 'options' needs to be a hash (or nil). ! Current options are below: ! :raw --> if true, "raw mode" (same as #raw=true). ! default: false (not "raw mode"). ! * Example 3 ! Bio::FlatFile.new(nil, $stdin, :raw=>true) ! * Example 3 in old style (deprecated) ! Bio::FlatFile.new(nil, $stdin, true) --- Bio::FlatFile.to_a(filename_or_stream, *arg) From k at pub.open-bio.org Wed Aug 10 13:23:43 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Wed Aug 10 14:08:50 2005 Subject: [BioRuby-cvs] bioruby ChangeLog,1.34,1.35 Message-ID: <200508101723.j7AHNhdZ008835@pub.open-bio.org> Update of /home/repository/bioruby/bioruby In directory pub.open-bio.org:/tmp/cvs-serv8831 Modified Files: ChangeLog Log Message: * prepared for 0.6.4 release Index: ChangeLog =================================================================== RCS file: /home/repository/bioruby/bioruby/ChangeLog,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** ChangeLog 10 Aug 2005 12:57:01 -0000 1.34 --- ChangeLog 10 Aug 2005 17:23:41 -0000 1.35 *************** *** 1,3 **** ! 2005-08-10 Toshiaki Katayama * BioRuby 0.6.4 is released. --- 1,3 ---- ! 2005-08-11 Toshiaki Katayama * BioRuby 0.6.4 is released. *************** *** 7,11 **** * Bio::Fastacmd and Bio::Bl2seq classes (introduced in 0.6.3) are renamed to Bio::Blast::Fastacmd, Bio::Blast::Bl2seq respectively. - * new and open method of the Bio::FlatFile are refactored. 2005-08-09 Toshiaki Katayama --- 7,10 ---- From k at pub.open-bio.org Wed Aug 31 03:22:55 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Wed Aug 31 04:07:12 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/data aa.rb,0.10,0.11 Message-ID: <200508310722.j7V7MtdZ030481@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/data In directory pub.open-bio.org:/tmp/cvs-serv30477/lib/bio/data Modified Files: aa.rb Log Message: * fixed one2name method (reported by Nakao) * one and three methods are added as aliases for to_1 and to_3 methods. Index: aa.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/data/aa.rb,v retrieving revision 0.10 retrieving revision 0.11 diff -C2 -d -r0.10 -r0.11 *** aa.rb 7 Aug 2005 23:28:14 -0000 0.10 --- aa.rb 31 Aug 2005 07:22:53 -0000 0.11 *************** *** 161,164 **** --- 161,165 ---- end end + alias :one :to_1 def to_3(x) *************** *** 172,175 **** --- 173,177 ---- end end + alias :three :to_3 def one2three(x) *************** *** 193,197 **** raise ArgumentError else ! Names[x] end end --- 195,199 ---- raise ArgumentError else ! three2name(Names[x]) end end *************** *** 200,204 **** str = reverse[x.to_s.downcase] if str and str.length == 3 ! reverse[str] else str --- 202,206 ---- str = reverse[x.to_s.downcase] if str and str.length == 3 ! three2one(str) else str *************** *** 280,313 **** p aa['A'] ! puts "# Bio::AminoAcid.name('A')" ! p Bio::AminoAcid.name('A') ! puts "# aa.name('A')" ! p aa.name('A') ! puts "# Bio::AminoAcid.to_1('alanine')" ! p Bio::AminoAcid.to_1('alanine') ! puts "# aa.to_1('alanine')" ! p aa.to_1('alanine') ! puts "# Bio::AminoAcid.to_1('Ala')" ! p Bio::AminoAcid.to_1('Ala') ! puts "# aa.to_1('Ala')" ! p aa.to_1('Ala') ! puts "# Bio::AminoAcid.to_1('A')" ! p Bio::AminoAcid.to_1('A') ! puts "# aa.to_1('A')" ! p aa.to_1('A') ! puts "# Bio::AminoAcid.to_3('alanine')" ! p Bio::AminoAcid.to_3('alanine') ! puts "# aa.to_3('alanine')" ! p aa.to_3('alanine') ! puts "# Bio::AminoAcid.to_3('Ala')" ! p Bio::AminoAcid.to_3('Ala') ! puts "# aa.to_3('Ala')" ! p aa.to_3('Ala') ! puts "# Bio::AminoAcid.to_3('A')" ! p Bio::AminoAcid.to_3('A') ! puts "# aa.to_3('A')" ! p aa.to_3('A') puts "# Bio::AminoAcid.one2three('A')" --- 282,315 ---- p aa['A'] ! puts "# Bio::AminoAcid.name('A'), Bio::AminoAcid.name('Ala')" ! p Bio::AminoAcid.name('A'), Bio::AminoAcid.name('Ala') ! puts "# aa.name('A'), aa.name('Ala')" ! p aa.name('A'), aa.name('Ala') ! puts "# Bio::AminoAcid.to_1('alanine'), Bio::AminoAcid.one('alanine')" ! p Bio::AminoAcid.to_1('alanine'), Bio::AminoAcid.one('alanine') ! puts "# aa.to_1('alanine'), aa.one('alanine')" ! p aa.to_1('alanine'), aa.one('alanine') ! puts "# Bio::AminoAcid.to_1('Ala'), Bio::AminoAcid.one('Ala')" ! p Bio::AminoAcid.to_1('Ala'), Bio::AminoAcid.one('Ala') ! puts "# aa.to_1('Ala'), aa.one('Ala')" ! p aa.to_1('Ala'), aa.one('Ala') ! puts "# Bio::AminoAcid.to_1('A'), Bio::AminoAcid.one('A')" ! p Bio::AminoAcid.to_1('A'), Bio::AminoAcid.one('A') ! puts "# aa.to_1('A'), aa.one('A')" ! p aa.to_1('A'), aa.one('A') ! puts "# Bio::AminoAcid.to_3('alanine'), Bio::AminoAcid.three('alanine')" ! p Bio::AminoAcid.to_3('alanine'), Bio::AminoAcid.three('alanine') ! puts "# aa.to_3('alanine'), aa.three('alanine')" ! p aa.to_3('alanine'), aa.three('alanine') ! puts "# Bio::AminoAcid.to_3('Ala'), Bio::AminoAcid.three('Ala')" ! p Bio::AminoAcid.to_3('Ala'), Bio::AminoAcid.three('Ala') ! puts "# aa.to_3('Ala'), aa.three('Ala')" ! p aa.to_3('Ala'), aa.three('Ala') ! puts "# Bio::AminoAcid.to_3('A'), Bio::AminoAcid.three('A')" ! p Bio::AminoAcid.to_3('A'), Bio::AminoAcid.three('A') ! puts "# aa.to_3('A'), aa.three('A')" ! p aa.to_3('A'), aa.three('A') puts "# Bio::AminoAcid.one2three('A')" From k at pub.open-bio.org Wed Aug 31 09:17:43 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Wed Aug 31 10:00:35 2005 Subject: [BioRuby-cvs] bioruby ChangeLog,1.37,1.38 Message-ID: <200508311317.j7VDHhdZ032221@pub.open-bio.org> Update of /home/repository/bioruby/bioruby In directory pub.open-bio.org:/tmp/cvs-serv32217 Modified Files: ChangeLog Log Message: * prepared for 0.6.4 Index: ChangeLog =================================================================== RCS file: /home/repository/bioruby/bioruby/ChangeLog,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** ChangeLog 31 Aug 2005 05:55:35 -0000 1.37 --- ChangeLog 31 Aug 2005 13:17:41 -0000 1.38 *************** *** 1,6 **** 2005-08-31 Naohisa Goto * removed unused file lib/bio/appl/factory.rb ! (some functions had been moved to lib/bio/command.rb) 2005-08-16 Naohisa Goto --- 1,14 ---- + 2005-08-31 Toshiaki Katayama + + * BioRuby 0.6.4 is released. + 2005-08-31 Naohisa Goto * removed unused file lib/bio/appl/factory.rb ! (the functionality had been integrated into lib/bio/command.rb) ! ! * doc/Tutorial.rd ! ! Newly added an English translation of the Japanese tutorial. 2005-08-16 Naohisa Goto *************** *** 24,38 **** * lib/bio/appl/blast.rb, lib/bio/appl/fasta.rb ! Bio::Blast.remote and Bio::Fasta.remote did not work ! due to the change of the GenomeNet. 2005-08-11 Toshiaki Katayama ! * BioRuby 0.6.4 is released. ! * Sequence#to_re method to have compatibility with 0.6.2 for RNA ! * Fixed Bio::Fastacmd#fetch to work ! * Bio::Fastacmd and Bio::Bl2seq classes (introduced in 0.6.3) are ! renamed to Bio::Blast::Fastacmd, Bio::Blast::Bl2seq respectively. 2005-08-09 Toshiaki Katayama --- 32,46 ---- * lib/bio/appl/blast.rb, lib/bio/appl/fasta.rb ! Bio::Blast.remote and Bio::Fasta.remote is fixed to work ! with the recent change of the GenomeNet. 2005-08-11 Toshiaki Katayama ! * Sequence#to_re method to have compatibility with 0.6.2 for RNA ! * Fixed Bio::Fastacmd#fetch to work ! ! * Bio::Fastacmd and Bio::Bl2seq classes (introduced in 0.6.3) are ! renamed to Bio::Blast::Fastacmd, Bio::Blast::Bl2seq respectively. 2005-08-09 Toshiaki Katayama From k at pub.open-bio.org Wed Aug 31 09:29:03 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Wed Aug 31 10:12:22 2005 Subject: [BioRuby-cvs] bioruby/doc KEGG_API.rd, NONE, 1.1 KEGG_API.rd.ja, 1.6, 1.7 Message-ID: <200508311329.j7VDT3dZ032288@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/doc In directory pub.open-bio.org:/tmp/cvs-serv32284 Modified Files: KEGG_API.rd.ja Added Files: KEGG_API.rd Log Message: * newly added English version of the KEGG API manual * Japanese version also updated Index: KEGG_API.rd.ja =================================================================== RCS file: /home/repository/bioruby/bioruby/doc/KEGG_API.rd.ja,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** KEGG_API.rd.ja 24 Aug 2004 00:21:55 -0000 1.6 --- KEGG_API.rd.ja 31 Aug 2005 13:29:01 -0000 1.7 *************** *** 3,7 **** $Id$ ! Copyright (C) 2004 KATAYAMA Toshiaki = KEGG API --- 3,7 ---- $Id$ ! Copyright (C) 2003-2005 Toshiaki Katayama = KEGG API *************** *** 43,52 **** * (()) * (()) ! * (()), ! (()), (()), (()), ! (()), ! (()) * (()) * (()), --- 43,52 ---- * (()) * (()) ! * (()), (()), (()), ! (()) ! # * (()), ! # (()) * (()) * (()), *************** *** 54,84 **** * (()) * (()), ! (()), (()), (()) * (()) * (()), ! (()) * (()), (()), (()), ! (()) * (()), (()), (()), ! (()) * (()) * (()), (()) * (()), (()), (()), (()), (()), ! (()) * (()) * (()) * (()) * (()) == イントロダクション --- 54,99 ---- * (()) * (()), ! (()), ! (()), ! (()), (()), (()) + # (()), * (()) * (()), ! (()), ! (()), ! (()) * (()), (()), (()), ! (()), ! (()), ! (()) * (()), (()), (()), ! (()), ! (()), ! (()) * (()) * (()), (()) * (()), + (()), (()), (()), (()), + (()), + (()), (()), ! (()), ! (()) * (()) * (()) * (()) * (()) + * (()) + * (()) == イントロダクション *************** *** 316,320 **** -> list_pathways("eco"); ! foreach $path (@{$result}) { print "$path->{entry_id}\t$path->{definition}\n"; } --- 331,335 ---- -> list_pathways("eco"); ! foreach $path (@{$results}) { print "$path->{entry_id}\t$path->{definition}\n"; } *************** *** 487,493 **** * org は KEGG に含まれている生物種をそれぞれ3文字コードで 表記したもので、eco が大腸菌、sce が出芽酵母などとなっています。 ! 3文字コードのリストは以下のページにあります。 ! * (()) * db は GenomeNet で提供されているデータベース名です。データベース名の --- 502,509 ---- * org は KEGG に含まれている生物種をそれぞれ3文字コードで 表記したもので、eco が大腸菌、sce が出芽酵母などとなっています。 ! 3文字コードのリストは list_organisms メソッドや以下のページを ! 参照してください。 ! * (()) * db は GenomeNet で提供されているデータベース名です。データベース名の *************** *** 497,501 **** ユニークな ID です。たとえば embl:J00231 で EMBL のエントリ J00231 を 指します。entry_id は、以下の genes_id, enzyme_id, compound_id, ! reaction_id, pathway_id, motif_id などを含みます。 * genes_id は keggorg と遺伝子名を ':' で結合した KEGG の遺伝子 ID です。 --- 513,517 ---- ユニークな ID です。たとえば embl:J00231 で EMBL のエントリ J00231 を 指します。entry_id は、以下の genes_id, enzyme_id, compound_id, ! glycan_id, reaction_id, pathway_id, motif_id などを含みます。 * genes_id は keggorg と遺伝子名を ':' で結合した KEGG の遺伝子 ID です。 *************** *** 508,511 **** --- 524,530 ---- C00158 の化合物であるクエン酸を指します。 + * glycan_id は gl: をつけた化合物の ID です。gl:G00050 は糖鎖番号 + G00050 の糖鎖である Paragloboside を指します。 + * reaction_id は REACTION データベースのエントリ番号で、rn:R00959 は リアクション番号 R00959 の反応 (cpd:C00103 と cpd:00668 間の変換) を *************** *** 526,529 **** --- 545,554 ---- グループを指します。 + * ko_class_id は KO を階層的に分類した各階層(クラス)の ID で、 + '01110' は Carbohydrate Metabolism クラスになります。 + KO クラスや KO 番号のリストは以下のページを参照してください。 + + * (()) + * start, max_results は一度に返ってくる結果の数を指定するオプションで、 start 番目から max_results 個の結果を受け取ります。全ての結果を得るには *************** *** 541,548 **** KEGG API のメソッドは文字列など単純な値を返すものだけでなく、複雑なデータ 構造を持った値を返す場合もあり、そのためのデータ型が定義されています。 + SSDBRelation 型 ! SSDB データベースの各フィールドに対応する値が入った配列です。 genes_id1 クエリーの genes_id (string) --- 566,579 ---- KEGG API のメソッドは文字列など単純な値を返すものだけでなく、複雑なデータ 構造を持った値を返す場合もあり、そのためのデータ型が定義されています。 + API のメソッドによる(検索などの)結果がなかった場合、型によって以下の + 戻り値が返されます。 + * 空の配列 -- もともと ArrayOfOBJ (オブジェクトの配列)を返すメソッドの場合 + * 空の文字列 -- もともと String (文字列)を返すメソッドの場合 + * -1 -- もともと int (数値)を返すメソッドの場合 + * NULL -- もともと以下で定義されたオブジェクトのどれかを返すメソッドの場合 + SSDBRelation 型 ! SSDB データベースの各フィールドに対応する値が入ったデータ型です。 genes_id1 クエリーの genes_id (string) *************** *** 623,627 **** 戻値: ! ArrayOfDefinition --- list_organisms --- 654,658 ---- 戻値: ! ArrayOfDefinition (db, definition) --- list_organisms *************** *** 630,634 **** 戻値: ! ArrayOfDefinition --- list_pathways(org) --- 661,665 ---- 戻値: ! ArrayOfDefinition (org, definition) --- list_pathways(org) *************** *** 638,642 **** 戻値: ! ArrayOfDefinition --- 669,673 ---- 戻値: ! ArrayOfDefinition (pathway_id, definition) *************** *** 694,698 **** bget("-f -n a eco:b0002 bsu:BG10065") # FASTA フォーマットの塩基配列を取得 ! bget("-f -n a eco:b0002 hin:tRNA-Cys-1") --- btit(string) --- 725,729 ---- bget("-f -n a eco:b0002 bsu:BG10065") # FASTA フォーマットの塩基配列を取得 ! bget("-f -n n eco:b0002 hin:tRNA-Cys-1") --- btit(string) *************** *** 741,758 **** * (()) ! --- get_neighbors_by_gene(genes_id, org, start, max_results) ! ! 指定した genes_id の遺伝子にホモロジーのある全遺伝子を指定した生物から ! 検索します。また org に 'all' を指定すると全生物種から検索します。 ! ! 戻値: ! ArrayOfSSDBRelation ! ! 例: ! # 大腸菌の遺伝子 b0002 に相同性のある遺伝子を全て検索して、結果の1番 ! # から10番目までを返します ! get_neighbors_by_gene('eco:b0002', 'all' 1, 10) ! # 次の10個を start = start + max_results として取ります ! get_neighbors_by_gene('eco:b0002', 'all' 11, 10) --- get_best_best_neighbors_by_gene(genes_id, start, max_results) --- 772,789 ---- * (()) ! #--- get_neighbors_by_gene(genes_id, org, start, max_results) ! # ! #指定した genes_id の遺伝子にホモロジーのある全遺伝子を指定した生物から ! #検索します。また org に 'all' を指定すると全生物種から検索します。 ! # ! #戻値: ! # ArrayOfSSDBRelation ! # ! #例: ! # # 大腸菌の遺伝子 b0002 に相同性のある遺伝子を全て検索して、結果の1番 ! # # から10番目までを返します ! # get_neighbors_by_gene('eco:b0002', 'all' 1, 10) ! # # 次の10個を start = start + max_results として取ります ! # get_neighbors_by_gene('eco:b0002', 'all' 11, 10) --- get_best_best_neighbors_by_gene(genes_id, start, max_results) *************** *** 804,817 **** get_paralogs_by_gene('eco:b0002', 11, 10) ! --- get_similarity_between_genes(genes_id1, genes_id2) ! ! 指定した2つの遺伝子間の Smith-Waterman スコアを含むデータを返します。 ! ! 戻値: ! SSDBRelation ! ! 例: ! # 大腸菌の b0002 遺伝子と b3940 遺伝子間のスコアやアライメント領域を得る ! get_similarity_between_genes('eco:b0002', 'eco:b3940') --- 835,848 ---- get_paralogs_by_gene('eco:b0002', 11, 10) ! #--- get_similarity_between_genes(genes_id1, genes_id2) ! # ! #指定した2つの遺伝子間の Smith-Waterman スコアを含むデータを返します。 ! # ! #戻値: ! # SSDBRelation ! # ! #例: ! # # 大腸菌の b0002 遺伝子と b3940 遺伝子間のスコアやアライメント領域を得る ! # get_similarity_between_genes('eco:b0002', 'eco:b3940') *************** *** 833,840 **** --- get_genes_by_motifs(motif_id_list, start, max_results) ! 指定したモチーフを持つ遺伝子を検索します。 戻値: ! ArrayOfDefinition 例: --- 864,871 ---- --- get_genes_by_motifs(motif_id_list, start, max_results) ! 指定したモチーフを全て持つ遺伝子を検索します。 戻値: ! ArrayOfDefinition (genes_id, definition) 例: *************** *** 856,860 **** 戻値: ! ArrayOfstring 例: --- 887,891 ---- 戻値: ! ArrayOfstring (ko_id) 例: *************** *** 862,875 **** get_ko_by_gene('eco:b0002') ! --- get_ko_members(ko_id) ! 指定した ko_id の KO エントリに含まれる遺伝子のリストを返します。 戻値: ! ArrayOfstring 例: ! # KO 番号 K02208 のアサインされている遺伝子のリスト ! get_ko_by_gene('ko:K02598') --- get_oc_members_by_gene(genes_id, start, max_results) --- 893,943 ---- get_ko_by_gene('eco:b0002') ! #--- get_ko_members(ko_id) ! # ! #指定した ko_id の KO エントリに含まれる遺伝子のリストを返します。 ! # ! #戻値: ! # ArrayOfstring (genes_id) ! # ! #例: ! # # KO 番号 K02208 のアサインされている遺伝子のリスト ! # get_ko_by_gene('ko:K02598') ! --- get_ko_by_ko_class(ko_class_id) ! ! 指定した ko_class_id に含まれる ko_id のリストを返します。 戻値: ! ArrayOfDefinition (ko_id) 例: ! # KO class '01196' に含まれる KO のリスト ! get_ko_by_ko_class('01196') ! ! --- get_genes_by_ko_class(ko_class_id, org, start, max_results) ! ! 指定した生物種の ko_class_id に含まれる遺伝子のリストを返します。 ! ! 戻値: ! ArrayOfDefinition (genes_id, definition) ! ! 例: ! # KO クラス '00930' に含まれるヒト遺伝子のリスト ! get_genes_by_ko_class('00903', 'hsa' , 1, 100) ! ! --- get_genes_by_ko(ko_id, org) ! ! 指定した生物種の ko_id に含まれる遺伝子のリストを返します。 ! 生物種コードに all を指定すると全生物種の遺伝子を返します。 ! ! 戻値: ! ArrayOfDefinition (genes_id, definition) ! ! 例: ! # KO 番号 'K00001' に含まれる大腸菌遺伝子のリスト ! get_genes_by_ko('ko:K00010', 'eco') ! ! # KO 番号 'K00010' に含まれる全生物種の遺伝子リスト ! get_genes_by_ko('ko:K00010', 'all') --- get_oc_members_by_gene(genes_id, start, max_results) *************** *** 878,882 **** 戻値: ! ArrayOfstring 例: --- 946,950 ---- 戻値: ! ArrayOfstring (genes_id) 例: *************** *** 890,894 **** 戻値: ! ArrayOfstring 例: --- 958,962 ---- 戻値: ! ArrayOfstring (genes_id) 例: *************** *** 914,918 **** 戻値: ! string 例: --- 982,986 ---- 戻値: ! string (URL) 例: *************** *** 930,934 **** 戻値: ! string 例: --- 998,1002 ---- 戻値: ! string (URL) 例: *************** *** 941,944 **** --- 1009,1043 ---- color_pathway_by_objects('path:eco00053', obj_list, fg_list, bg_list) + --- get_html_of_marked_pathway_by_objects(pathway_id, object_id_list) + + 画像の代わりにクリッカブルマップを含む HTML ページの URL を返す + バージョンの 'mark_pathway_by_objects' メソッドです。 + + 戻値: + string (URL) + + 例: + # 大腸菌のパスウェイ '00970' の、遺伝子 'eco:b4258'、化合物 'cpd:C00135' + # KO 番号 'ko:K01881' に赤色でマークをつけた画像のクリッカブルマップを + # 表示する HTML の URL を返す + obj_list = ['eco:b4258', 'cpd:C00135', 'ko:K01881'] + get_html_of_marked_pathway_by_objects('path:eco00970', obj_list) + + --- get_html_of_colored_pathway_by_objects(pathway_id, object_id_list, fg_color_list, bg_color_list) + + 画像の代わりにクリッカブルマップを含む HTML ページの URL を返す + バージョンの 'color_pathway_by_object' メソッドです。 + + 戻値: + string (URL) + + 例: + # 大腸菌のパスウェイ '00970' の、遺伝子 'eco:b4258' を赤地に灰色、化合物 + # 'cpd:C00135' を黄色地に緑、KO 番号 'ko:K01881' を橙地に青の色づけをした + # 画像のクリッカブルマップを表示する HTML の URL を返す + obj_list = ['eco:b4258', 'cpd:C00135', 'ko:K01881'] + fg_list = ['gray', '#00ff00', 'blue'] + bg_list = ['#ff0000', 'yellow', 'orange'] + get_html_of_colored_pathway_by_objects('path:eco00970', obj_list, fg_list, bg_list) + パスウェイ上のオブジェクト検索 *************** *** 950,954 **** 戻値: ! ArrayOfstring 例: --- 1049,1053 ---- 戻値: ! ArrayOfstring (genes_id) 例: *************** *** 961,968 **** 戻値: ! ArrayOfstring 例: ! # パスウェイ 00020 番に載っている酵素番号のリスト get_enzymes_by_pathway('path:eco00020') --- 1060,1067 ---- 戻値: ! ArrayOfstring (enzyme_id) 例: ! # 大腸菌のパスウェイ 00020 番に載っている酵素番号のリスト get_enzymes_by_pathway('path:eco00020') *************** *** 972,981 **** 戻値: ! ArrayOfstring 例: ! # パスウェイ 00020 に載っている化合物のリスト get_compounds_by_pathway('path:eco00020') --- get_reactions_by_pathway(pathway_id) --- 1071,1091 ---- 戻値: ! ArrayOfstring (compound_id) 例: ! # 大腸菌のパスウェイ 00020 に載っている化合物のリスト get_compounds_by_pathway('path:eco00020') + --- get_glycans_by_pathway(pathway_id) + + 指定したパスウェイに載っている糖鎖のリストを返します。 + + 戻値: + ArrayOfstring (glycan_id) + + 例: + # 大腸菌のパスウェイ 00510 に載っている糖鎖のリスト + get_glycans_by_pathway('path:eco00510') + --- get_reactions_by_pathway(pathway_id) *************** *** 983,991 **** 戻値: ! ArrayOfstring 例: ! # パスウェイ 00260 番に載っているリアクションのリスト ! get_reactions_by_pathways('path:map00260') --- 1093,1113 ---- 戻値: ! ArrayOfstring (reaction_id) 例: ! # 大腸菌のパスウェイ 00260 番に載っているリアクションのリスト ! get_reactions_by_pathways('path:eco00260') ! ! --- get_kos_by_pathway(pathway_id) ! ! 指定したパスウェイに載っている KO 番号のリストを返します。 ! ! 戻値: ! ArrayOfstring (ko_id) ! ! 例: ! # ヒトのパスウェイ 00010 に載っている KO 番号のリスト ! get_kos_by_pathway('path:hsa00010') ! *************** *** 997,1001 **** 戻値: ! ArrayOfstring 例: --- 1119,1123 ---- 戻値: ! ArrayOfstring (pathway_id) 例: *************** *** 1008,1012 **** 戻値: ! ArrayOfstring 例: --- 1130,1134 ---- 戻値: ! ArrayOfstring (pathway_id) 例: *************** *** 1019,1023 **** 戻値: ! ArrayOfstring 例: --- 1141,1145 ---- 戻値: ! ArrayOfstring (pathway_id) 例: *************** *** 1025,1028 **** --- 1147,1161 ---- get_pathways_by_compounds(['cpd:C00033', 'cpd:C00158']) + --- get_pathways_by_glycans(compound_id_list) + + 指定した糖鎖が全て載っているパスウェイのリストを返します。 + + 戻値: + ArrayOfstring (pathway_id) + + 例: + # 糖鎖 G00009 と G00011 が両方載っているパスウェイのリスト + get_pathways_by_glycans(['gl:G00009', 'gl:G00011']) + --- get_pathways_by_reactions(reaction_id_list) *************** *** 1030,1034 **** 戻値: ! ArrayOfstring 例: --- 1163,1167 ---- 戻値: ! ArrayOfstring (pathway_id) 例: *************** *** 1037,1040 **** --- 1170,1187 ---- get_pathways_by_reactions(['rn:R00959', 'rn:R02740', 'rn:R00960', 'rn:R01786']) + --- get_pathways_by_kos(ko_id_list, org) + + 指定した生物の KO 番号が全て載っているパスウェイのリストを返します。 + + 戻値: + ArrayOfstring (pathway_id) + + 例: + # KO 番号 'ko:K00016' と 'ko:K00382' を含むヒトのパスウェイのリスト + get_pathways_by_kos(['ko:K00016', 'ko:K00382'], 'hsa') + + # KO 番号 'ko:K00016' と 'ko:K00382' を含む全生物種のパスウェイのリスト + get_pathways_by_kos(['ko:K00016', 'ko:K00382'], 'all') + + パスウェイ間の関係 *************** *** 1046,1050 **** 戻値: ! ArrayOfstring 例: --- 1193,1197 ---- 戻値: ! ArrayOfstring (pathway_id) 例: *************** *** 1060,1064 **** 戻値: ! ArrayOfstring 例: --- 1207,1211 ---- 戻値: ! ArrayOfstring (genes_id) 例: *************** *** 1071,1075 **** 戻値: ! ArrayOfstring 例: --- 1218,1222 ---- 戻値: ! ArrayOfstring (enzyme_id) 例: *************** *** 1082,1089 **** --- get_enzymes_by_compound(compound_id) ! 指定した化合物番号に対応する酵素番号のリストを返します。 戻値: ! ArrayOfstring 例: --- 1229,1236 ---- --- get_enzymes_by_compound(compound_id) ! 指定した化合物に対応する酵素番号のリストを返します。 戻値: ! ArrayOfstring (compound_id) 例: *************** *** 1091,1094 **** --- 1238,1252 ---- get_enzymes_by_compound('cpd:C00345') + --- get_enzymes_by_glycan(compound_id) + + 指定した糖鎖に対応する酵素番号のリストを返します。 + + 戻値: + ArrayOfstring (glycan_id) + + 例: + # 糖鎖 'gl:G00001' の代謝に関わる酵素のリスト + get_enzymes_by_glycan('gl:G00001') + --- get_enzymes_by_reaction(reaction_id) *************** *** 1096,1100 **** 戻値: ! ArrayOfstring 例: --- 1254,1258 ---- 戻値: ! ArrayOfstring (reaction_id) 例: *************** *** 1107,1111 **** 戻値: ! ArrayOfstring 例: --- 1265,1269 ---- 戻値: ! ArrayOfstring (compound_id) 例: *************** *** 1118,1122 **** 戻値: ! ArrayOfstring 例: --- 1276,1280 ---- 戻値: ! ArrayOfstring (compound_id) 例: *************** *** 1124,1127 **** --- 1282,1307 ---- get_compounds_by_reaction('rn:R00100') + --- get_glycans_by_enzyme(enzyme_id) + + 指定した酵素番号に対応する糖鎖のリストを返します。 + + 戻値: + ArrayOfstring (glycan_id) + + 例: + # 酵素番号 'ec:2.4.1.141' の代謝に関わる糖鎖のリスト + get_glycans_by_enzyme('ec:2.4.1.141') + + --- get_glycans_by_reaction(reaction_id) + + 指定したリアクションに対応する糖鎖のリストを返します。 + + 戻値: + ArrayOfstring (glycan_id) + + 例: + # リアクション番号 'rn:R06164' の反応に関わる糖鎖のリスト + get_glycans_by_reaction('rn:R06164') + --- get_reactions_by_enzyme(enzyme_id) *************** *** 1129,1133 **** 戻値: ! ArrayOfstring 例: --- 1309,1313 ---- 戻値: ! ArrayOfstring (reaction_id) 例: *************** *** 1140,1144 **** 戻値: ! ArrayOfstring 例: --- 1320,1324 ---- 戻値: ! ArrayOfstring (reaction_id) 例: *************** *** 1146,1149 **** --- 1326,1340 ---- get_reactions_by_compound('cpd:C00199') + --- get_reactions_by_glycan(glycan_id) + + 指定した糖鎖に対応するリアクションのリストを返します。 + + 戻値: + ArrayOfstring (reaction_id) + + 例: + # 糖鎖 'gl:G00001' の触媒反応に関わるリアクション番号のリスト + get_reactions_by_glycan('gl:G00001') + ==== GENES *************** *** 1160,1164 **** 戻値: ! ArrayOfstring 例: --- 1351,1355 ---- 戻値: ! ArrayOfstring (genes_id) 例: *************** *** 1170,1174 **** ==== GENOME ! GENOMES データベースに対するメソッドの一覧です。GENOME データベースについて 詳しくは以下のページを参照してください。 --- 1361,1365 ---- ==== GENOME ! GENOME データベースに対するメソッドの一覧です。GENOME データベースについて 詳しくは以下のページを参照してください。 *************** *** 1187,1198 **** ! == Notes ! Last updated: July 12, 2004 ! This document is written and maintained by Toshiaki Katayama. ! Copyright (C) 2003, 2004 Toshiaki Katayama - =end --- 1378,1399 ---- ! ==== LIGAND ! LIGAND データベースに対するメソッドの一覧です。 ! --- convert_mol_to_kcf(mol_text) ! MOL フォーマットのエントリを KCF フォーマットに変換します。 ! ! 戻値: ! String ! ! 例: ! convert_mol_to_kcf(mol_str) + == Notes + + Last updated: May 31, 2005 + + =end --- NEW FILE: KEGG_API.rd --- =begin $Id: KEGG_API.rd,v 1.1 2005/08/31 13:29:01 k Exp $ Copyright (C) 2003-2005 Toshiaki Katayama = KEGG API KEGG API is a web service to use the KEGG system from your program via SOAP/WSDL. We have been making the (()) system available at (()). KEGG is a suite of databases including GENES, SSDB, PATHWAY, LIGAND, LinkDB, etc. for genome research and related research areas in molecular and cellular biology. These databases and associated computation services are available via WWW and the user interfaces are built on web browsers. Thus, the interfaces are designed to be accessed by humans, not by machines, which means that it is troublesome for the researchers who want to use KEGG in an [...1398 lines suppressed...] This section describes the APIs for LIGAND database. --- convert_mol_to_kcf(mol_text) Convert a MOL format into the KCF format. Return value: string Example: convert_mol_to_kcf(mol_str) == Notes Last updated: May 31, 2005 =end From k at pub.open-bio.org Wed Aug 31 09:42:32 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Wed Aug 31 10:25:21 2005 Subject: [BioRuby-cvs] bioruby ChangeLog,1.38,1.39 Message-ID: <200508311342.j7VDgWdZ032352@pub.open-bio.org> Update of /home/repository/bioruby/bioruby In directory pub.open-bio.org:/tmp/cvs-serv32348 Modified Files: ChangeLog Log Message: * prepared for 0.6.4 again Index: ChangeLog =================================================================== RCS file: /home/repository/bioruby/bioruby/ChangeLog,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** ChangeLog 31 Aug 2005 13:17:41 -0000 1.38 --- ChangeLog 31 Aug 2005 13:42:29 -0000 1.39 *************** *** 3,6 **** --- 3,15 ---- * BioRuby 0.6.4 is released. + * doc/KEGG_API.rd + + Newly added English version of the KEGG API manual. + + * lib/bio/aa.rb + + the 'one2name' method introduced in 0.6.3 is fixed and added 'one' + and 'three' methods as aliases for 'to_1' and 'to_3' methods. + 2005-08-31 Naohisa Goto From nakao at pub.open-bio.org Sun Aug 7 02:20:44 2005 From: nakao at pub.open-bio.org (Mitsuteru C. Nakao) Date: Fri Sep 9 13:28:50 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/appl/genscan report.rb,1.3,1.4 Message-ID: <200508070535.j775ZKdZ017000@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl/genscan In directory pub.open-bio.org:/tmp/cvs-serv16971/lib/bio/appl/genscan Modified Files: report.rb Log Message: * Re-formated codes. Index: report.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/genscan/report.rb,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** report.rb 5 Nov 2004 06:41:06 -0000 1.3 --- report.rb 7 Aug 2005 05:35:18 -0000 1.4 *************** *** 29,40 **** class Genscan ! # Bio::Genscan::Report class Report ! attr_reader :genscan_version, :date_run, :time attr_reader :query_name alias_method :sequence_name, :query_name alias_method :name, :query_name ! attr_reader :length, :gccontent, :isochore attr_reader :matrix attr_reader :predictions --- 29,44 ---- class Genscan ! # Bio::Genscan::Report - Class for Genscan report output. class Report ! attr_reader :genscan_version ! attr_reader :date_run ! attr_reader :time attr_reader :query_name alias_method :sequence_name, :query_name alias_method :name, :query_name ! attr_reader :length ! attr_reader :gccontent ! attr_reader :isochore attr_reader :matrix attr_reader :predictions *************** *** 44,52 **** # Bio::Genscan::Report.new(str) def initialize(report) @predictions = [] @genscan_version = nil ! @date_run = nil ! @time = nil @query_name = nil @length = nil --- 48,58 ---- # Bio::Genscan::Report.new(str) + # + # Parse a Genscan report output string. def initialize(report) @predictions = [] @genscan_version = nil ! @date_run = nil ! @time = nil @query_name = nil @length = nil *************** *** 55,59 **** @matrix = nil ! report.each("\n") {|line| case line when /^GENSCAN/ --- 61,65 ---- @matrix = nil ! report.each("\n") do |line| case line when /^GENSCAN/ *************** *** 66,70 **** break end ! } # rests --- 72,76 ---- break end ! end # rests *************** *** 85,91 **** sequence_region.gsub!(/^Predicted .+?:/, '') sequence_region.gsub!(/^\s*$/, '') ! sequence_region.split(Bio::FastaFormat::RS).each {|ff| add_seq(Bio::FastaFormat.new(ff)) ! } end --- 91,97 ---- sequence_region.gsub!(/^Predicted .+?:/, '') sequence_region.gsub!(/^\s*$/, '') ! sequence_region.split(Bio::FastaFormat::RS).each do |ff| add_seq(Bio::FastaFormat.new(ff)) ! end end *************** *** 100,103 **** --- 106,110 ---- private :parse_headline + # Bio::Genscan::Report#parse_sequence def parse_sequence(line) *************** *** 182,186 **** @polyA = nil end ! attr_reader :number, :aaseq, :naseq, :exons, :promoter, :polyA --- 189,198 ---- @polyA = nil end ! attr_reader :number ! attr_reader :aaseq ! attr_reader :naseq ! attr_reader :exons ! attr_reader :promoter ! attr_reader :polyA *************** *** 238,242 **** ! # Bio::Genescan::Report::Exon.new(gene_number, exon_type, strand, first, end, length, frame, phase, acceptor_score, donor_score, score, p_value, t_score) def initialize(gnex, t, s, b, e, len, fr, ph, iac, dot, cr, prob, ts) @gene_number, @number = gnex.split(".").map {|n| n.to_i } --- 250,256 ---- ! # Bio::Genescan::Report::Exon.new(gene_number, exon_type, strand, first, ! # end, length, frame, phase, acceptor_score, donor_score, score, p_value, ! # t_score) def initialize(gnex, t, s, b, e, len, fr, ph, iac, dot, cr, prob, ts) @gene_number, @number = gnex.split(".").map {|n| n.to_i } *************** *** 254,259 **** @t_score = ts.to_f end ! attr_reader :gene_number, :number, :exon_type, :strand, ! :first, :last, :frame, :phase, :score, :p_value, :t_score alias_method :coding_region_score, :score --- 268,282 ---- @t_score = ts.to_f end ! attr_reader :gene_number ! attr_reader :number ! attr_reader :exon_type ! attr_reader :strand ! attr_reader :first ! attr_reader :last ! attr_reader :frame ! attr_reader :phase ! attr_reader :score ! attr_reader :p_value ! attr_reader :t_score alias_method :coding_region_score, :score *************** *** 308,386 **** puts "= class Bio::Genscan::Report " ! rpt = Bio::Genscan::Report.new(report) ! puts "==> rpt.genscan_version " ! p rpt.genscan_version ! puts "==> rpt.date_run " ! p rpt.date_run ! puts "==> rpt.time " ! p rpt.time ! puts "==> rpt.query_name " ! p rpt.query_name ! puts "==> rpt.length " ! p rpt.length ! puts "==> rpt.gccontent " ! p rpt.gccontent ! puts "==> rpt.isochore " ! p rpt.isochore ! puts "==> rpt.matrix " ! p rpt.matrix ! puts "==> rpt.predictions (Array of Bio::Genscan::Report::Gene) " ! puts "==> rpt.predictions.size " ! p rpt.predictions.size ! puts "\n== class Bio::Genscan::Report::Gene " ! rpt.predictions.each {|gene| ! puts " ==> gene.number " p gene.number ! puts " ==> gene.aaseq (Bio::FastaFormat)" p gene.aaseq ! puts " ==> gene.naseq (Bio::FastaFormat) " p gene.naseq ! puts " ==> gene.promoter (Bio::Genscan::Report::Exon)" p gene.promoter ! puts " ==> gene.polyA (Bio::Genscan::Report::Exon) " p gene.polyA ! puts " ==> gene.exons (Array of Bio::Genscan::Report::Exon) " ! puts " ==> gene.exons.size " p gene.exons.size ! puts "\n== class Bio::Genscan::Report::Exon " gene.exons.each {|exon| ! puts " ==> exon.number " p exon.number ! puts " ==> exon.exon_type " p exon.exon_type ! puts " ==> exon.exon_type_long " p exon.exon_type_long ! puts " ==> exon.strand " p exon.strand ! puts " ==> exon.first " p exon.first ! puts " ==> exon.last" p exon.last ! puts " ==> exon.range (Range)" p exon.range ! puts " ==> exon.frame" p exon.frame ! puts " ==> exon.phase" p exon.phase ! puts " ==> exon.acceptor_score" p exon.acceptor_score ! puts " ==> exon.donor_score" p exon.donor_score ! puts " ==> exon.initiation_score" p exon.initiation_score ! puts " ==> exon.termination_score" p exon.termination_score ! puts " ==> exon.score" p exon.score ! puts " ==> exon.p_value" p exon.p_value ! puts " ==> exon.t_score" p exon.t_score puts --- 331,411 ---- puts "= class Bio::Genscan::Report " ! report = Bio::Genscan::Report.new(report) ! print " report.genscan_version #=> " ! p report.genscan_version ! print " report.date_run #=> " ! p report.date_run ! print " report.time #=> " ! p report.time ! print " report.query_name #=> " ! p report.query_name ! print " report.length #=> " ! p report.length ! print " report.gccontent #=> " ! p report.gccontent ! print " report.isochore #=> " ! p report.isochore ! print " report.matrix #=> " ! p report.matrix ! puts " report.predictions (Array of Bio::Genscan::Report::Gene) " ! print " report.predictions.size #=> " ! p report.predictions.size ! ! report.predictions.each {|gene| ! puts "\n== class Bio::Genscan::Report::Gene " ! print " gene.number #=> " p gene.number ! print " gene.aaseq (Bio::FastaFormat) #=> " p gene.aaseq ! print " gene.naseq (Bio::FastaFormat) #=> " p gene.naseq ! print " ene.promoter (Bio::Genscan::Report::Exon) #=> " p gene.promoter ! print " gene.polyA (Bio::Genscan::Report::Exon) #=> " p gene.polyA ! puts " gene.exons (Array of Bio::Genscan::Report::Exon) " ! print " gene.exons.size #=> " p gene.exons.size ! gene.exons.each {|exon| ! puts "\n== class Bio::Genscan::Report::Exon " ! print " exon.number #=> " p exon.number ! print " exon.exon_type #=> " p exon.exon_type ! print " exon.exon_type_long #=> " p exon.exon_type_long ! print " exon.strand #=> " p exon.strand ! print " exon.first #=> " p exon.first ! print " exon.last #=> " p exon.last ! print " exon.range (Range) #=> " p exon.range ! print " exon.frame #=> " p exon.frame ! print " exon.phase #=> " p exon.phase ! print " exon.acceptor_score #=> " p exon.acceptor_score ! print " exon.donor_score #=> " p exon.donor_score ! print " exon.initiation_score #=> " p exon.initiation_score ! print " exon.termination_score #=> " p exon.termination_score ! print " exon.score #=> " p exon.score ! print " exon.p_value #=> " p exon.p_value ! print " exon.t_score #=> " p exon.t_score puts From nakao at pub.open-bio.org Mon Aug 8 03:27:12 2005 From: nakao at pub.open-bio.org (Mitsuteru C. Nakao) Date: Fri Sep 9 13:28:53 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/db/embl sptr.rb,1.23,1.24 Message-ID: <200508080641.j786fGdZ029927@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/db/embl In directory pub.open-bio.org:/tmp/cvs-serv29902/lib/bio/db/embl Modified Files: sptr.rb Log Message: * Added Bio::SPTR#protein_name method (proposed by Luca Pireddu). * Added Bio::SPTR#synomyms method (proposed by Luca Pireddu). * Changed Bio::SPTR#gn to parsing newly GN line format (proposed by Luca Pireddu). * Changed Bio::SPTR#gene_names method (proposed by Luca Pireddu). * Changed Bio::SPTR#gene_name method (proposed by Luca Pireddu). Index: sptr.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/embl/sptr.rb,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** sptr.rb 25 Aug 2004 16:57:12 -0000 1.23 --- sptr.rb 8 Aug 2005 06:41:13 -0000 1.24 *************** *** 67,70 **** --- 67,71 ---- end + # def entry id_line('ENTRY_NAME') *************** *** 73,76 **** --- 74,78 ---- alias entry_id entry + # def molecule id_line('MOLECULE_TYPE') *************** *** 78,81 **** --- 80,84 ---- alias molecule_type molecule + # def sequence_length id_line('SEQUENCE_LENGTH') *************** *** 98,102 **** # #accession -> accessions.first ! @@ac_regrexp = /[OPQ][0-9][A-Z0-9]{3}[0-9]/ # DT Line; date (3/entry) --- 101,106 ---- # #accession -> accessions.first ! @@ac_regrexp = /[OPQ][0-9][A-Z0-9]{3}[0-9]/ ! # DT Line; date (3/entry) *************** *** 133,139 **** --- 137,179 ---- # CONTEINS >=0 # + # Returns the proposed official name of the protein + def protein_name + name = "" + if de_line = fetch('DE') then + str = de_line[/^[^\[]*/] # everything preceding the first [ (the "contains" part) + name = str[/^[^(]*/].strip + name << ' (Fragment)' if str =~ /fragment/i + end + return name + end + # synonyms are each placed in () following the official name on the DE line + # Returns an array of synonyms (unofficial names) + def synonyms + ary = Array.new + if de_line = fetch('DE') then + line = de_line.sub(/\[.*\]/,'') # ignore stuff between [ and ]. That's the "contains" part + line.scan(/\([^)]+/) do |synonym| + unless synonym =~ /fragment/i then + ary << synonym[1..-1].strip # index to remove the leading ( + end + end + end + return ary + end # GN Line: Gene name(s) (>=0, optional) + def gn + return @data['GN'] if @data['GN'] + + case fetch('GN') + when /Name=/ then + return gn_uniprot_parser + else + return gn_old_parser + end + end + + # GN Line: Gene name(s) (>=0, optional) # GN HNS OR DRDX OR OSMZ OR BGLY. # GN CECA1 AND CECA2. *************** *** 146,192 **** # #gene_names -> Array # ! def gn ! unless @data['GN'] ! if get('GN').size > 0 ! names = fetch('GN').sub(/\.$/,'').split(/ AND /) ! names.map! {|synonyms| ! synonyms = synonyms.gsub(/\(|\)/,'').split(/ OR /).map {|e| ! e.strip ! } } end ! @data['GN'] = names end return @data['GN'] end ! alias gene_names gn # Bio::SPTR#gene_name -> String # def gene_name ! begin ! @data['GN'][0][0] ! rescue NameError ! nil ! end end # OS Line; organism species (>=1) ! # "OS Trifolium repens (white clover)" ! # ! # OS Genus species (name). ! # OS Genus species (name0) (name1). ! # OS Genus species (name0) (name1). ! # OS Genus species (name0), G s0 (name0), and G s (name1). # ! # Bio::EMBLDB#os -> Array w/in Hash # [{'name'=>'(Human)', 'os'=>'Homo sapiens'}, # {'name'=>'(Rat)', 'os'=>'Rattus norveticus'}] ! # Bio::EMBLDB#os[0]['name'] => "(Human)" ! # Bio::EMBLDB#os[0] => {'name'=>"(Human)", 'os'=>'Homo sapiens'} ! # Bio::EMBLDB#os(0) => "Homo sapiens (Human)" # ! # Bio::SPTR#os -> Array w/in Hash # Bio::SPTR#os(num) -> String --- 186,298 ---- # #gene_names -> Array # ! def gn_old_parser ! names = Array.new ! if get('GN').size > 0 ! names = fetch('GN').sub(/\.$/,'').split(/ AND /) ! names.map! { |synonyms| ! synonyms = synonyms.gsub(/\(|\)/,'').split(/ OR /).map { |e| ! e.strip } + } + end + return @data['GN'] = names + end + private :gn_old_parser + + + # The new format of the GN line is: + # GN Name=; Synonyms=[, ...]; OrderedLocusNames=[, ...]; + # GN ORFNames=[, ...]; + # + # GN and + # + # Bio::SPTR#gn -> [ * ] + # where is: + # { :name => '...', + # :synonyms => [ 's1', 's2', ... ], + # :loci => [ 'l1', 'l2', ... ], + # :orfs => [ 'o1', 'o2', ... ] + # } + def gn_uniprot_parser + @data['GN'] = Array.new + gn_line = fetch('GN').strip + records = gn_line.split(/\s*and\s*/) + records.each do |record| + gene_hash = {:name => '', :synonyms => [], :loci => [], :orfs => []} + record.each(';') do |element| + case element + when /Name=/ then + gene_hash[:name] = $'[0..-2] + when /Synonyms=/ then + gene_hash[:synonyms] = $'[0..-2].split(/\s*,\s*/) + when /OrderedLocusNames=/ then + gene_hash[:loci] = $'[0..-2].split(/\s*,\s*/) + when /ORFNames=/ then + gene_hash[:orfs] = $'[0..-2].split(/\s*,\s*/) + end end ! @data['GN'] << gene_hash end return @data['GN'] end ! private :gn_uniprot_parser ! ! ! # Bio::SPTR#gene_names -> [String] ! def gene_names ! gn # set @data['GN'] if it hasn't been already done ! if @data['GN'].first.class == Hash then ! @data['GN'].collect { |element| element[:name] } ! else ! @data['GN'].first ! end ! end ! # Bio::SPTR#gene_name -> String # def gene_name ! gene_names.first end + # OS Line; organism species (>=1) ! # "OS Genus species (name)." ! # "OS Genus species (name0) (name1)." ! # "OS Genus species (name0) (name1)." ! # "OS Genus species (name0), G s0 (name0), and G s (name0) (name1)." ! # "OS Homo sapiens (Human), and Rarrus norveticus (Rat)" # ! # Bio::EMBLDB#os -> Array of Hash # [{'name'=>'(Human)', 'os'=>'Homo sapiens'}, # {'name'=>'(Rat)', 'os'=>'Rattus norveticus'}] ! # Bio::SPTR#os[0]['name'] => "(Human)" ! # Bio::EPTR#os[0] => {'name'=>"(Human)", 'os'=>'Homo sapiens'} ! # Bio::EPTR#os(0) => "Homo sapiens (Human)" # ! # Bio::SPTR#os -> Array of Hash # Bio::SPTR#os(num) -> String + def os(num = nil) + unless @data['OS'] + os = Array.new + fetch('OS').split(/, and|, /).each do |tmp| + if tmp =~ /([A-Z][a-z]* *[\w\d \:\'\+\-]+[\w\d])/ + org = $1 + tmp =~ /(\(.+\))/ + os.push({'name' => $1, 'os' => org}) + else + raise "Error: OS Line. #{$!}\n#{fetch('OS')}\n" + end + end + @data['OS'] = os + end + + if num + # EX. "Trifolium repens (white clover)" + return "#{@data['OS'][num]['os']} #{@data['OS'][num]['name']}" + else + return @data['OS'] + end + end *************** *** 211,220 **** def ox unless @data['OX'] ! tmp = fetch('OX').sub(/\.$/,'').split(/;/).map {|e| e.strip } hsh = Hash.new ! tmp.each {|e| db,refs = e.split(/=/) hsh[db] = refs.split(/, */) ! } @data['OX'] = hsh end --- 317,326 ---- def ox unless @data['OX'] ! tmp = fetch('OX').sub(/\.$/,'').split(/;/).map { |e| e.strip } hsh = Hash.new ! tmp.each do |e| db,refs = e.split(/=/) hsh[db] = refs.split(/, */) ! end @data['OX'] = hsh end *************** *** 272,276 **** begin ! fetch('CC').split(/#{cmt}/)[0].sub(dlm,'').split(dlm).each {|tmp| if /(^[A-Z ]+[A-Z]): (.+)/ =~ tmp key = $1 --- 378,382 ---- begin ! fetch('CC').split(/#{cmt}/)[0].sub(dlm,'').split(dlm).each do |tmp| if /(^[A-Z ]+[A-Z]): (.+)/ =~ tmp key = $1 *************** *** 282,296 **** end else ! raise ["Error: #{entry_id}: CC Lines", '', tmp, '', '', fetch('CC'),''].join("\n") end ! } rescue NameError if fetch('CC') == '' return {} else ! raise "Error: Invalid CC Lines: #{entry_id}: " + ! "\n'#{self.get('CC')}'\n" + ! "(#{$!})" end rescue NoMethodError --- 388,401 ---- end else ! raise ["Error: [#{entry_id}]: CC Lines", '', tmp, '', '', fetch('CC'),''].join("\n") end ! end rescue NameError if fetch('CC') == '' return {} else ! raise ["Error: Invalid CC Lines: [#{entry_id}]: ", ! "\n'#{self.get('CC')}'\n", "(#{$!})"].join end rescue NoMethodError *************** *** 314,319 **** # Event, Named isoforms, Comment, [Name, Synonyms, IsoId, Sequnce]+ ! tmp = {'Event'=>nil, 'Named isoforms'=>nil, 'Comment'=>nil, ! 'Variants' => []} if /Event=(.+?);/ =~ ap --- 419,423 ---- # Event, Named isoforms, Comment, [Name, Synonyms, IsoId, Sequnce]+ ! tmp = {'Event' => nil, 'Named isoforms' => nil, 'Comment' => nil, 'Variants' => []} if /Event=(.+?);/ =~ ap *************** *** 326,332 **** tmp['Comment'] = $1 end ! ap.scan(/Name=.+?Sequence=.+?;/).each {|ent| tmp['Variants'] << cc_ap_variants_parse(ent) ! } return tmp --- 430,436 ---- tmp['Comment'] = $1 end ! ap.scan(/Name=.+?Sequence=.+?;/).each do |ent| tmp['Variants'] << cc_ap_variants_parse(ent) ! end return tmp *************** *** 338,344 **** return db unless db ! db.each {|e| ! db = {'NAME'=>nil,'NOTE'=>nil,'WWW'=>nil,'FTP'=>nil} ! e.sub(/.$/,'').split(/;/).each {|line| case line when /NAME=(.+)/ --- 442,448 ---- return db unless db ! db.each do |e| ! db = {'NAME' => nil, 'NOTE' => nil, 'WWW' => nil, 'FTP' => nil} ! e.sub(/.$/,'').split(/;/).each do |line| case line when /NAME=(.+)/ *************** *** 351,357 **** db['FTP'] = $1 end ! } tmp.push(db) ! } return tmp --- 455,461 ---- db['FTP'] = $1 end ! end tmp.push(db) ! end return tmp *************** *** 362,368 **** return ms unless ms ! ms.each {|m| mass = {'MW'=>nil,'MW_ERR'=>nil,'METHOD'=>nil,'RANGE'=>nil} ! m.sub(/.$/,'').split(/;/).each {|line| case line when /MW=(.+)/ --- 466,472 ---- return ms unless ms ! ms.each do |m| mass = {'MW'=>nil,'MW_ERR'=>nil,'METHOD'=>nil,'RANGE'=>nil} ! m.sub(/.$/,'').split(/;/).each do |line| case line when /MW=(.+)/ *************** *** 375,381 **** mass['RANGE'] = $1 # RANGE class ? end ! } tmp.push(mass) ! } return tmp --- 479,485 ---- mass['RANGE'] = $1 # RANGE class ? end ! end tmp.push(mass) ! end return tmp *************** *** 390,402 **** def cc_ap_variants_parse(ent) ! tmp = {} ! ent.split(/; /).map {|e| e.split(/=/) }.each {|e| case e[0] when 'Sequence' e[1] = e[1].sub(/;/,'').split(/, /) end ! tmp[e[0]] = e[1] ! } ! tmp end private :cc_ap_variants_parse --- 494,506 ---- def cc_ap_variants_parse(ent) ! hsh = {} ! ent.split(/; /).map {|e| e.split(/=/) }.each do |e| case e[0] when 'Sequence' e[1] = e[1].sub(/;/,'').split(/, /) end ! hsh[e[0]] = e[1] ! end ! return hsh end private :cc_ap_variants_parse *************** *** 404,409 **** - - # DR Line; defabases cross-reference (>=0) # a cross_ref pre one line --- 508,511 ---- *************** *** 419,423 **** - # KW Line; keyword (>=1) # KW [Keyword;]+ --- 521,524 ---- *************** *** 471,475 **** end - case last_feature when 'VARSPLIC', 'VARIANT', 'CONFLICT' --- 572,575 ---- *************** *** 502,507 **** end ! table.each_key {|k| ! table[k].each {|e| if / -> / =~ e['Description'] pattern = /([A-Z][A-Z ]*[A-Z]*) -> ([A-Z][A-Z ]*[A-Z]*)/ --- 602,607 ---- end ! table.each_key do |k| ! table[k].each do |e| if / -> / =~ e['Description'] pattern = /([A-Z][A-Z ]*[A-Z]*) -> ([A-Z][A-Z ]*[A-Z]*)/ *************** *** 522,528 **** } end ! } ! } ! @data['FT'] = table end --- 622,627 ---- } end ! end ! end @data['FT'] = table end *************** *** 549,553 **** unless @data['SQ'] if fetch('SQ') =~ /(\d+) AA\; (\d+) MW; (.+) CRC64;/ ! @data['SQ'] = { 'aalen'=>$1.to_i, 'MW'=>$2.to_i, 'CRC64'=>$3 } else raise "Invalid SQ Line: \n'#{fetch('SQ')}'" --- 648,652 ---- unless @data['SQ'] if fetch('SQ') =~ /(\d+) AA\; (\d+) MW; (.+) CRC64;/ ! @data['SQ'] = { 'aalen' => $1.to_i, 'MW' => $2.to_i, 'CRC64' => $3 } else raise "Invalid SQ Line: \n'#{fetch('SQ')}'" *************** *** 624,627 **** --- 723,727 ---- cmd "Bio::SPTR.new($ent).gn", 'GN' cmd "Bio::SPTR.new($ent).gene_name" + cmd "Bio::SPTR.new($ent).gene_names" cmd "Bio::SPTR.new($ent).dt", "DT" *************** *** 632,635 **** --- 732,737 ---- cmd "Bio::SPTR.new($ent).de", 'DE' cmd "Bio::SPTR.new($ent).definition" + cmd "Bio::SPTR.new($ent).protein_name" + cmd "Bio::SPTR.new($ent).synonyms" cmd "Bio::SPTR.new($ent).kw", 'KW' *************** *** 684,690 **** --- Bio::SPTR#entry_id -> str - --- Bio::SPTR#molecule -> str - --- Bio::SPTR#sequence_length -> int --- 786,790 ---- *************** *** 695,703 **** --- Bio::SPTR#accessions -> ary --- Bio::SPTR#accession -> accessions.first === GN line (Gene name(s)) ! --- Bio::SPTR#gn -> [ary, ...] ! --- Bio::SPTR#gene_name -> gn[0][0] === DT lines (Date) --- 795,806 ---- --- Bio::SPTR#accessions -> ary --- Bio::SPTR#accession -> accessions.first + === GN line (Gene name(s)) ! --- Bio::SPTR#gn -> [ary, ...] or [{:name => str, :synonyms => [], :loci => [], :orfs => []}] ! --- Bio::SPTR#gene_name -> str ! --- Bio::SPTR#gene_names -> [str] or [str] ! === DT lines (Date) *************** *** 708,715 **** --- 811,828 ---- key := (created|annotation|sequence) + === DE lines (Description) --- Bio::SPTR#de -> str #definition -> str + + --- Bio::SPTR#protein_name + + Returns the proposed official name of the protein + + + --- Bio::SPTR#synonyms + + Returns an array of synonyms (unofficial names) === KW lines (Keyword) From ngoto at pub.open-bio.org Sun Aug 7 01:47:12 2005 From: ngoto at pub.open-bio.org (Naohisa Goto) Date: Fri Sep 9 13:28:54 2005 Subject: [BioRuby-cvs] bioruby ChangeLog,1.27,1.28 Message-ID: <200508070501.j7751kdZ016816@pub.open-bio.org> Update of /home/repository/bioruby/bioruby In directory pub.open-bio.org:/tmp/cvs-serv16806 Modified Files: ChangeLog Log Message: added old Changelog modified by ngoto Index: ChangeLog =================================================================== RCS file: /home/repository/bioruby/bioruby/ChangeLog,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** ChangeLog 11 Jul 2005 09:37:33 -0000 1.27 --- ChangeLog 7 Aug 2005 05:01:43 -0000 1.28 *************** *** 12,15 **** --- 12,33 ---- * gemspec.rb: newly added RubyGems spec file. + 2005-06-21 Naohisa Goto + + * lib/bio/appl/blast/report.rb + + Newly added support for reading BLAST -m 7 result files + through Bio::FlatFile by adding + DELIMITER = "\n" to Bio::Blast::Report class. + (Note that tab-delimited format (-m 8 and -m 9) are not yet + supported by Bio::FlatFile) + + * lib/bio/io/flatfile.rb + + Added file format autodetection of BLAST XML format. + + 2005-06-20 Naohisa Goto + + * lib/bio/appl/blast/format0.rb: added 'to_s' to store original entry + 2005-04-04 Mitsuteru Nakao *************** *** 18,21 **** --- 36,55 ---- Newly added Bio::GO::External2go class for parsing external2go file. + + 2005-03-10 Naohisa Goto + + * lib/bio/io/flatfile.rb + + Added file format autodetection of Spidey (Bio::Spidey::Report). + + 2005-03-10 Naohisa Goto + + * lib/bio/io/flatfile.rb + * Added file format autodetection for Bio::KEGG::KO, + Bio::KEGG::GLYCAN, Bio::KEGG::REACTION, Bio::Blat::Report + and Bio::Sim4::Report. + * In order to distinguish Bio::KEGG::REACTION and + Bio::KEGG::COMPOUND, autodetection regexp. of + Bio::KEGG::COMPOUND were modified. 2005-02-09 KATAYAMA Toshiaki From ngoto at pub.open-bio.org Sun Aug 7 02:13:41 2005 From: ngoto at pub.open-bio.org (Naohisa Goto) Date: Fri Sep 9 13:28:55 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/db/genbank common.rb,1.3,1.4 Message-ID: <200508070528.j775SCdZ016948@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/db/genbank In directory pub.open-bio.org:/tmp/cvs-serv16926/lib/bio/db/genbank Modified Files: common.rb Log Message: Avoid NoMethodError (private method `chomp` called for nil:NilClass) when parsing features of ftp://ftp.ncbi.nih.gov/genbank/genomes/Bacteria/ Salmonella_typhimurium_LT2/AE006468.gbk Index: common.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/genbank/common.rb,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** common.rb 16 Jun 2005 16:43:11 -0000 1.3 --- common.rb 7 Aug 2005 05:28:10 -0000 1.4 *************** *** 186,193 **** # feature type (source, CDS, ...) ! head = line[0,20].strip # feature value (position or /qualifier=) ! body = line[20,60].chomp # sub-array [ feature type, position, /q="data", ... ] --- 186,193 ---- # feature type (source, CDS, ...) ! head = line[0,20].to_s.strip # feature value (position or /qualifier=) ! body = line[20,60].to_s.chomp # sub-array [ feature type, position, /q="data", ... ] From ngoto at pub.open-bio.org Sun Aug 7 02:17:36 2005 From: ngoto at pub.open-bio.org (Naohisa Goto) Date: Fri Sep 9 13:28:56 2005 Subject: [BioRuby-cvs] bioruby ChangeLog,1.28,1.29 Message-ID: <200508070532.j775W5dZ016991@pub.open-bio.org> Update of /home/repository/bioruby/bioruby In directory pub.open-bio.org:/tmp/cvs-serv16981 Modified Files: ChangeLog Log Message: added log for lib/bio/db/genbank/common.rb modified today Index: ChangeLog =================================================================== RCS file: /home/repository/bioruby/bioruby/ChangeLog,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** ChangeLog 7 Aug 2005 05:01:43 -0000 1.28 --- ChangeLog 7 Aug 2005 05:32:03 -0000 1.29 *************** *** 1,2 **** --- 1,10 ---- + 2005-08-07 Naohisa Goto + + * lib/bio/db/genbank/common.rb + Avoid NoMethodError (private method `chomp` called for nil:NilClass) + when parsing features of + ftp://ftp.ncbi.nih.gov/genbank/genomes/Bacteria/ + Salmonella_typhimurium_LT2/AE006468.gbk + 2005-07-11 Toshiaki Katayama From ngoto at pub.open-bio.org Sun Aug 7 13:21:36 2005 From: ngoto at pub.open-bio.org (Naohisa Goto) Date: Fri Sep 9 13:28:57 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/appl/bl2seq - New directory Message-ID: <200508071636.j77GaFdZ027809@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl/bl2seq In directory pub.open-bio.org:/tmp/cvs-serv27799/bl2seq Log Message: Directory /home/repository/bioruby/bioruby/lib/bio/appl/bl2seq added to the repository From ngoto at pub.open-bio.org Sun Aug 7 13:27:53 2005 From: ngoto at pub.open-bio.org (Naohisa Goto) Date: Fri Sep 9 13:28:58 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/appl/blast format0.rb,1.8,1.9 Message-ID: <200508071642.j77GgUdZ027857@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl/blast In directory pub.open-bio.org:/tmp/cvs-serv27826/blast Modified Files: format0.rb Log Message: * lib/bio/appl/bl2seq/report.rb: Newly added bl2seq (BLAST 2 sequences) output parser. * lib/bio/appl/blast/format0.rb: Added `self.class::` before F0dbstat.new for bl2seq/report.rb Index: format0.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/blast/format0.rb,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** format0.rb 20 Jun 2005 11:35:30 -0000 1.8 --- format0.rb 7 Aug 2005 16:42:28 -0000 1.9 *************** *** 187,191 **** dbs << data.shift end ! @f0dbstat = F0dbstat.new(dbs) i = -1 while r = data[0] and /^Lambda/ =~ r --- 187,191 ---- dbs << data.shift end ! @f0dbstat = self.class::F0dbstat.new(dbs) i = -1 while r = data[0] and /^Lambda/ =~ r From ngoto at pub.open-bio.org Sun Aug 7 13:27:54 2005 From: ngoto at pub.open-bio.org (Naohisa Goto) Date: Fri Sep 9 13:29:01 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/appl/bl2seq report.rb,NONE,1.1 Message-ID: <200508071642.j77GgUdZ027853@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl/bl2seq In directory pub.open-bio.org:/tmp/cvs-serv27826/bl2seq Added Files: report.rb Log Message: * lib/bio/appl/bl2seq/report.rb: Newly added bl2seq (BLAST 2 sequences) output parser. * lib/bio/appl/blast/format0.rb: Added `self.class::` before F0dbstat.new for bl2seq/report.rb --- NEW FILE: report.rb --- # # bio/appl/bl2seq/report.rb - bl2seq (BLAST 2 sequences) parser # # Copyright (C) 2005 GOTO Naohisa # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # $Id: report.rb,v 1.1 2005/08/07 16:42:28 ngoto Exp $ # # Acknowledgements: # Thanks to Tomoaki NISHIYAMA # for providing bl2seq parser patches based on # lib/bio/appl/blast/format0.rb. # require 'bio/appl/blast/format0' module Bio class Bl2seq class Report < Bio::Blast::Default::Report DELIMITER = RS = nil undef format0_parse_header undef program, version, version_number, version_date, message, converged?, reference, db def format0_split_headers(data) @f0query = data.shift end def format0_split_search(data) iterations = [] while r = data[0] and /^\>/ =~ r iterations << Iteration.new(data) end if iterations.size <= 0 then iterations << Iteration.new(data) end iterations end class F0dbstat < Bio::Blast::Default::Report::F0dbstat def db_num unless defined?(@db_num) parse_params @db_num = @hash['Number of Sequences'].to_i end @db_num end def db_len unless defined?(@db_len) parse_params @db_len = @hash['length of database'].to_i end @db_len end end #class F0dbstat class Iteration < Bio::Blast::Default::Report::Iteration def initialize(data) @f0stat = [] @f0dbstat = nil @hits = [] @num = 1 while r = data[0] and /^\>/ =~ r @hits << Hit.new(data) end end def hits; @hits; end undef message, pattern_in_database, f0message, f0hitlist, pattern, pattern_positions, hits_found_again, hits_newly_found, hits_for_pattern, parse_hitlist, converged? end #class Iteration class Hit < Bio::Blast::Default::Report::Hit end #class Hit # NOTE: HSP class below is NOT used!! class HSP < Bio::Blast::Default::Report::HSP end #class HSP end #class Report end #class Bl2seq end #module Bio ###################################################################### if __FILE__ == $0 Bio::FlatFile.open(Bio::Bl2seq::Report, ARGF) do |ff| ff.each do |rep| print "# === Bio::Bl2seq::Report\n" puts #@#print " rep.program #=> "; p rep.program #@#print " rep.version #=> "; p rep.version #@#print " rep.reference #=> "; p rep.reference #@#print " rep.db #=> "; p rep.db #print " rep.query_id #=> "; p rep.query_id print " rep.query_def #=> "; p rep.query_def print " rep.query_len #=> "; p rep.query_len #puts #@#print " rep.version_number #=> "; p rep.version_number #@#print " rep.version_date #=> "; p rep.version_date puts print "# === Parameters\n" #puts #print " rep.parameters #=> "; p rep.parameters puts print " rep.matrix #=> "; p rep.matrix print " rep.expect #=> "; p rep.expect #print " rep.inclusion #=> "; p rep.inclusion print " rep.sc_match #=> "; p rep.sc_match print " rep.sc_mismatch #=> "; p rep.sc_mismatch print " rep.gap_open #=> "; p rep.gap_open print " rep.gap_extend #=> "; p rep.gap_extend #print " rep.filter #=> "; p rep.filter #@#print " rep.pattern #=> "; p rep.pattern #print " rep.entrez_query #=> "; p rep.entrez_query #puts #@#print " rep.pattern_positions #=> "; p rep.pattern_positions puts print "# === Statistics (last iteration's)\n" #puts #print " rep.statistics #=> "; p rep.statistics puts print " rep.db_num #=> "; p rep.db_num print " rep.db_len #=> "; p rep.db_len #print " rep.hsp_len #=> "; p rep.hsp_len print " rep.eff_space #=> "; p rep.eff_space print " rep.kappa #=> "; p rep.kappa print " rep.lambda #=> "; p rep.lambda print " rep.entropy #=> "; p rep.entropy puts print " rep.num_hits #=> "; p rep.num_hits print " rep.gapped_kappa #=> "; p rep.gapped_kappa print " rep.gapped_lambda #=> "; p rep.gapped_lambda print " rep.gapped_entropy #=> "; p rep.gapped_entropy print " rep.posted_date #=> "; p rep.posted_date puts #@#print "# === Message (last iteration's)\n" #@#puts #@#print " rep.message #=> "; p rep.message #puts #@#print " rep.converged? #=> "; p rep.converged? #@#puts print "# === Iterations\n" puts print " rep.itrerations.each do |itr|\n" puts rep.iterations.each do |itr| print "# --- Bio::Bl2seq::Report::Iteration\n" puts print " itr.num #=> "; p itr.num #print " itr.statistics #=> "; p itr.statistics #@#print " itr.message #=> "; p itr.message print " itr.hits.size #=> "; p itr.hits.size #puts #@#print " itr.hits_newly_found.size #=> "; p itr.hits_newly_found.size; #@#print " itr.hits_found_again.size #=> "; p itr.hits_found_again.size; #@#if itr.hits_for_pattern then #@#itr.hits_for_pattern.each_with_index do |hp, hpi| #@#print " itr.hits_for_pattern[#{hpi}].size #=> "; p hp.size; #@#end #@#end #@#print " itr.converged? #=> "; p itr.converged? puts print " itr.hits.each do |hit|\n" puts itr.hits.each_with_index do |hit, i| print "# --- Bio::Bl2seq::Default::Report::Hit" print " ([#{i}])\n" puts #print " hit.num #=> "; p hit.num #print " hit.hit_id #=> "; p hit.hit_id print " hit.len #=> "; p hit.len print " hit.definition #=> "; p hit.definition #print " hit.accession #=> "; p hit.accession #puts print " hit.found_again? #=> "; p hit.found_again? print " --- compatible/shortcut ---\n" #print " hit.query_id #=> "; p hit.query_id #print " hit.query_def #=> "; p hit.query_def #print " hit.query_len #=> "; p hit.query_len #print " hit.target_id #=> "; p hit.target_id print " hit.target_def #=> "; p hit.target_def print " hit.target_len #=> "; p hit.target_len print " --- first HSP's values (shortcut) ---\n" print " hit.evalue #=> "; p hit.evalue print " hit.bit_score #=> "; p hit.bit_score print " hit.identity #=> "; p hit.identity #print " hit.overlap #=> "; p hit.overlap print " hit.query_seq #=> "; p hit.query_seq print " hit.midline #=> "; p hit.midline print " hit.target_seq #=> "; p hit.target_seq print " hit.query_start #=> "; p hit.query_start print " hit.query_end #=> "; p hit.query_end print " hit.target_start #=> "; p hit.target_start print " hit.target_end #=> "; p hit.target_end print " hit.lap_at #=> "; p hit.lap_at print " --- first HSP's vaules (shortcut) ---\n" print " --- compatible/shortcut ---\n" puts print " hit.hsps.size #=> "; p hit.hsps.size if hit.hsps.size == 0 then puts " (HSP not found: please see blastall's -b and -v options)" puts else puts print " hit.hsps.each do |hsp|\n" puts hit.hsps.each_with_index do |hsp, j| print "# --- Bio::Blast::Default::Report::HSP (Bio::Bl2seq::Report::HSP)" print " ([#{j}])\n" puts #print " hsp.num #=> "; p hsp.num print " hsp.bit_score #=> "; p hsp.bit_score print " hsp.score #=> "; p hsp.score print " hsp.evalue #=> "; p hsp.evalue print " hsp.identity #=> "; p hsp.identity print " hsp.gaps #=> "; p hsp.gaps print " hsp.positive #=> "; p hsp.positive print " hsp.align_len #=> "; p hsp.align_len #print " hsp.density #=> "; p hsp.density print " hsp.query_frame #=> "; p hsp.query_frame print " hsp.query_from #=> "; p hsp.query_from print " hsp.query_to #=> "; p hsp.query_to print " hsp.hit_frame #=> "; p hsp.hit_frame print " hsp.hit_from #=> "; p hsp.hit_from print " hsp.hit_to #=> "; p hsp.hit_to #print " hsp.pattern_from#=> "; p hsp.pattern_from #print " hsp.pattern_to #=> "; p hsp.pattern_to print " hsp.qseq #=> "; p hsp.qseq print " hsp.midline #=> "; p hsp.midline print " hsp.hseq #=> "; p hsp.hseq puts print " hsp.percent_identity #=> "; p hsp.percent_identity #print " hsp.mismatch_count #=> "; p hsp.mismatch_count # print " hsp.query_strand #=> "; p hsp.query_strand print " hsp.hit_strand #=> "; p hsp.hit_strand print " hsp.percent_positive #=> "; p hsp.percent_positive print " hsp.percent_gaps #=> "; p hsp.percent_gaps puts end #each end #if hit.hsps.size == 0 end end end #ff.each end #FlatFile.open end #if __FILE__ == $0 ###################################################################### =begin = Bio::Bl2seq::Default::Report NCBI bl2seq (BLAST 2 sequences) output parser =end From ngoto at pub.open-bio.org Sun Aug 7 13:31:21 2005 From: ngoto at pub.open-bio.org (Naohisa Goto) Date: Fri Sep 9 13:29:03 2005 Subject: [BioRuby-cvs] bioruby ChangeLog,1.29,1.30 Message-ID: <200508071646.j77Gk1dZ027920@pub.open-bio.org> Update of /home/repository/bioruby/bioruby In directory pub.open-bio.org:/tmp/cvs-serv27910 Modified Files: ChangeLog Log Message: added Changelog for lib/bio/appl/bl2seq/report.rb and lib/bio/appl/blast/format0.rb Index: ChangeLog =================================================================== RCS file: /home/repository/bioruby/bioruby/ChangeLog,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** ChangeLog 7 Aug 2005 05:32:03 -0000 1.29 --- ChangeLog 7 Aug 2005 16:45:58 -0000 1.30 *************** *** 1,2 **** --- 1,9 ---- + 2005-08-08 Naohisa Goto + + * lib/bio/appl/bl2seq/report.rb: + Newly added bl2seq (BLAST 2 sequences) output parser. + * lib/bio/appl/blast/format0.rb: + Added `self.class::` before F0dbstat.new for bl2seq/report.rb + 2005-08-07 Naohisa Goto From ngoto at pub.open-bio.org Tue Aug 9 06:28:28 2005 From: ngoto at pub.open-bio.org (Naohisa Goto) Date: Fri Sep 9 13:29:04 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/io fastacmd.rb,1.2,1.3 Message-ID: <200508090940.j799eTdZ001672@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/io In directory pub.open-bio.org:/tmp/cvs-serv1657 Modified Files: fastacmd.rb Log Message: * Changed not to execute shell when execute command * Using block with Open3.popen3 * removed rescue Index: fastacmd.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/io/fastacmd.rb,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** fastacmd.rb 9 Aug 2005 08:55:40 -0000 1.2 --- fastacmd.rb 9 Aug 2005 09:40:27 -0000 1.3 *************** *** 51,74 **** end ! cmd = "#{@fastacmd} -d #{@database} -s #{entry_id}" ! begin ! inn, out, err = Open3.popen3(cmd) results = Bio::FlatFile.new(Bio::FastaFormat, out).to_a ! err_msg = err.read ! return results ! rescue ! raise "[Error] command execution failed : #{cmd}\n#{err_msg}" ! ensure ! inn.close; out.close; err.close end end def each_entry ! cmd = "#{@fastacmd} -d #{@database} -D T" ! IO.popen(cmd) do |io| ! f = Bio::FlatFile.new(Bio::FastaFormat, io) f.each_entry do |e| yield e end end end --- 51,74 ---- end ! cmd = [ @fastacmd, '-d', @database, '-s', entry_id ] ! Open3.popen3(cmd) do |inn, out, err| ! inn.close ! t = Thread.start { err.read } results = Bio::FlatFile.new(Bio::FastaFormat, out).to_a ! t.join ! results end end def each_entry ! cmd = [ @fastacmd, '-d', @database, '-D', 'T' ] ! Open3.popen3(*cmd) do |inn, out, err| ! inn.close ! t = Thread.start { err.read } ! f = Bio::FlatFile.new(Bio::FastaFormat, out) f.each_entry do |e| yield e end + t.join end end From ngoto at pub.open-bio.org Tue Aug 9 06:53:38 2005 From: ngoto at pub.open-bio.org (Naohisa Goto) Date: Fri Sep 9 13:29:05 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/io fastacmd.rb,1.3,1.4 Message-ID: <200508090946.j799kfdZ001712@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/io In directory pub.open-bio.org:/tmp/cvs-serv1700/lib/bio/io Modified Files: fastacmd.rb Log Message: * each_entry: changed to return self * changes in 1.2 -> 1.3 (sorry, I forgot to write) * using thread to read stderr Index: fastacmd.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/io/fastacmd.rb,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** fastacmd.rb 9 Aug 2005 09:40:27 -0000 1.3 --- fastacmd.rb 9 Aug 2005 09:46:39 -0000 1.4 *************** *** 72,75 **** --- 72,76 ---- t.join end + self end alias :each :each_entry From nakao at pub.open-bio.org Tue Aug 9 08:05:06 2005 From: nakao at pub.open-bio.org (Mitsuteru C. Nakao) Date: Fri Sep 9 13:29:05 2005 Subject: [BioRuby-cvs] bioruby ChangeLog,1.31,1.32 Message-ID: <200508091119.j79BJHdZ002153@pub.open-bio.org> Update of /home/repository/bioruby/bioruby In directory pub.open-bio.org:/tmp/cvs-serv2143 Modified Files: ChangeLog Log Message: * added log for lib/bio/db/embl/sptr.rb. Index: ChangeLog =================================================================== RCS file: /home/repository/bioruby/bioruby/ChangeLog,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** ChangeLog 9 Aug 2005 09:07:03 -0000 1.31 --- ChangeLog 9 Aug 2005 11:19:15 -0000 1.32 *************** *** 12,15 **** --- 12,25 ---- Shinji Shigenobu. + 2005-08-08 Mitsuteru Nakao + + * lib/bio/db/embl/sptr.rb: + + Added Bio::SPTR#protein_name and Bio::SPTR#synoyms methods. + contributed by Luca Pireddu. + + Changed Bio::SPTR#gn, Bio::SPTR#gene_name and + Bio::SPTR#gene_names methods. contributed by Luca Pireddu. + 2005-08-08 Naohisa Goto From ngoto at pub.open-bio.org Wed Aug 10 02:26:42 2005 From: ngoto at pub.open-bio.org (Naohisa Goto) Date: Fri Sep 9 13:29:06 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/io fastacmd.rb,1.4,1.5 Message-ID: <200508100541.j7A5fXdZ005169@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/io In directory pub.open-bio.org:/tmp/cvs-serv5157/lib/bio/io Modified Files: fastacmd.rb Log Message: typo in line 54 Index: fastacmd.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/io/fastacmd.rb,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** fastacmd.rb 9 Aug 2005 09:46:39 -0000 1.4 --- fastacmd.rb 10 Aug 2005 05:41:31 -0000 1.5 *************** *** 52,56 **** cmd = [ @fastacmd, '-d', @database, '-s', entry_id ] ! Open3.popen3(cmd) do |inn, out, err| inn.close t = Thread.start { err.read } --- 52,56 ---- cmd = [ @fastacmd, '-d', @database, '-s', entry_id ] ! Open3.popen3(*cmd) do |inn, out, err| inn.close t = Thread.start { err.read } From ngoto at pub.open-bio.org Tue Aug 16 06:23:24 2005 From: ngoto at pub.open-bio.org (Naohisa Goto) Date: Fri Sep 9 13:29:07 2005 Subject: [BioRuby-cvs] bioruby ChangeLog,1.35,1.36 Message-ID: <200508160938.j7G9cadZ009049@pub.open-bio.org> Update of /home/repository/bioruby/bioruby In directory pub.open-bio.org:/tmp/cvs-serv9033 Modified Files: ChangeLog Log Message: * lib/bio/command.rb Newly added Bio::Command::Tools module. Bio::Command::Tools is a collection of useful methods for execution of external commands. * lib/bio/appl/blast.rb, lib/bio/appl/fasta.rb, lib/bio/appl/hmmer.rb, lib/bio/io/fastacmd.rb For security reason, shell special characters are escaped. * lib/bio/appl/blast.rb, lib/bio/appl/fasta.rb, lib/bio/appl/hmmer.rb Options are stored with an array (@options). #options and #opions= methods are added. * lib/bio/appl/blast.rb, lib/bio/appl/fasta.rb Bio::Blast.remote and Bio::Fasta.remote did not work due to the change of the GenomeNet. Index: ChangeLog =================================================================== RCS file: /home/repository/bioruby/bioruby/ChangeLog,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** ChangeLog 10 Aug 2005 17:23:41 -0000 1.35 --- ChangeLog 16 Aug 2005 09:38:34 -0000 1.36 *************** *** 1,2 **** --- 1,25 ---- + 2005-08-16 Naohisa Goto + + * lib/bio/command.rb + + Newly added Bio::Command::Tools module. + Bio::Command::Tools is a collection of useful methods + for execution of external commands. + + * lib/bio/appl/blast.rb, lib/bio/appl/fasta.rb, + lib/bio/appl/hmmer.rb, lib/bio/io/fastacmd.rb + + For security reason, shell special characters are escaped. + + * lib/bio/appl/blast.rb, lib/bio/appl/fasta.rb, lib/bio/appl/hmmer.rb + + Options are stored with an array (@options). + #options and #opions= methods are added. + + * lib/bio/appl/blast.rb, lib/bio/appl/fasta.rb + + Bio::Blast.remote and Bio::Fasta.remote did not work + due to the change of the GenomeNet. + 2005-08-11 Toshiaki Katayama From ngoto at pub.open-bio.org Tue Aug 16 06:24:01 2005 From: ngoto at pub.open-bio.org (Naohisa Goto) Date: Fri Sep 9 13:29:08 2005 Subject: [BioRuby-cvs] bioruby/lib/bio command.rb,NONE,1.1 Message-ID: <200508160938.j7G9cadZ009051@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio In directory pub.open-bio.org:/tmp/cvs-serv9033/lib/bio Added Files: command.rb Log Message: * lib/bio/command.rb Newly added Bio::Command::Tools module. Bio::Command::Tools is a collection of useful methods for execution of external commands. * lib/bio/appl/blast.rb, lib/bio/appl/fasta.rb, lib/bio/appl/hmmer.rb, lib/bio/io/fastacmd.rb For security reason, shell special characters are escaped. * lib/bio/appl/blast.rb, lib/bio/appl/fasta.rb, lib/bio/appl/hmmer.rb Options are stored with an array (@options). #options and #opions= methods are added. * lib/bio/appl/blast.rb, lib/bio/appl/fasta.rb Bio::Blast.remote and Bio::Fasta.remote did not work due to the change of the GenomeNet. --- NEW FILE: command.rb --- # # bio/command.rb - useful methods for external command execution # # Copyright (C) 2003-2005 GOTO Naohisa # Copyright (C) 2004 KATAYAMA Toshiaki # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # $Id: command.rb,v 1.1 2005/08/16 09:38:34 ngoto Exp $ # require 'open3' module Bio module Command module Tools UNSAFE_CHARS_UNIX = /[^A-Za-z0-9\_\-\.\:\,\/\@\x1b\x80-\xfe]/n QUOTE_CHARS_WINDOWS = /[^A-Za-z0-9\_\-\.\:\,\/\@\\]/n UNESCAPABLE_CHARS = /[\x00-\x08\x10-\x1a\x1c-\x1f\x7f\xff]/n #module_function private def escape_shell_windows(str) str = str.to_s raise 'cannot escape control characters' if UNESCAPABLE_CHARS =~ str if QUOTE_CHARS_WINDOWS =~ str then '"' + str.gsub(/\"/, '""') + '"' else String.new(str) end end def escape_shell_unix(str) str = str.to_s raise 'cannot escape control characters' if UNESCAPABLE_CHARS =~ str str.gsub(UNSAFE_CHARS_UNIX) { |x| "\\#{x}" } end def escape_shell(str) case RUBY_PLATFORM when /mswin32|bccwin32/ escape_shell_windows(str) else escape_shell_unix(str) end end def make_command_line(ary) case RUBY_PLATFORM when /mswin32|bccwin32/ make_command_line_windows(ary) else make_command_line_unix(ary) end end def make_command_line_windows(ary) ary.collect { |str| escape_shell_windows(str) }.join(" ") end def make_command_line_unix(ary) ary.collect { |str| escape_shell_unix(str) }.join(" ") end def call_command_local(cmd, query = nil, &block) case RUBY_PLATFORM when /mswin32|bccwin32/ call_command_local_popen(cmd, query, &block) else call_command_local_open3(cmd, query, &block) end end def call_command_local_popen(cmd, query = nil) str = make_command_line(cmd) IO.popen(str, "w+") do |io| if block_given? then io.sync = true yield io, io else io.sync = true io.print query if query io.close_write io.read end end end def call_command_local_open3(cmd, query = nil) cmd = cmd.collect { |x| x.to_s } Open3.popen3(*cmd) do |pin, pout, perr| perr.sync = true t = Thread.start { @errorlog = perr.read } if block_given? then yield pin, pout else begin pin.print query if query pin.close output = pout.read ensure t.join end output end end end attr_reader :errorlog public :errorlog end #module Tools end #module Command end # module Bio =begin = Bio::Command = Bio::Command::Tools Bio::Command::Tools is a collection of useful methods for execution of external commands or web applications. Any wrapper class for applications shall include this class. Note that all methods below are private except for some methods. --- Bio::Command::Tools#escape_shell(str) Escape special characters in command line string. --- Bio::Command::Tools#escape_shell_unix(str) Escape special characters in command line string for UNIX shells. --- Bio::Command::Tools#escape_shell_windows(str) Escape special characters in command line string for cmd.exe on Windows. --- Bio::Command::Tools#make_command_line(ary) Generate command line string with special characters escaped. --- Bio::Command::Tools#make_command_line_unix(ary) Generate command line string with special characters escaped for UNIX shells. --- Bio::Command::Tools#make_command_line_windows(ary) Generate command line string with special characters escaped for cmd.exe on Windows. --- Bio::Command::Tools#exec_command_local(cmd, query = nil) --- Bio::Command::Tools#exec_command_local(cmd) {|inn, out| ... } Executes the program. Automatically select popen for Windows environment and open3 for the others. If block is given, yield the block with input and output IO objects. Note that in some platform, inn and out are the same object. Please be careful to do inn.close and out.close. --- Bio::Command::Tools#exec_command_local_popen(cmd, query = nil) --- Bio::Command::Tools#exec_command_local_popen(cmd) {|io, io| ... } Executes the program via IO.popen for OS which doesn't support fork. If block is given, yield the block with IO objects. The two objects are the same because of limitation of IO.popen. --- Bio::Command::Tools#exec_command_local_open3(cmd, query = nil) --- Bio::Command::Tools#exec_command_local_open3(cmd) {|inn, out| ... } Executes the program via Open3.popen3 If block is given, yield the block with input and output IO objects. From the view point of security, this method is recommended rather than exec_local_popen. --- Bio::Command::Tools#errorlog Shows the latest stderr of the program execution. Note that this method may be thread unsafe. =end From ngoto at pub.open-bio.org Tue Aug 16 06:25:31 2005 From: ngoto at pub.open-bio.org (Naohisa Goto) Date: Fri Sep 9 13:29:23 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/io fastacmd.rb,1.6,1.7 Message-ID: <200508160938.j7G9cbdZ009063@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/io In directory pub.open-bio.org:/tmp/cvs-serv9033/lib/bio/io Modified Files: fastacmd.rb Log Message: * lib/bio/command.rb Newly added Bio::Command::Tools module. Bio::Command::Tools is a collection of useful methods for execution of external commands. * lib/bio/appl/blast.rb, lib/bio/appl/fasta.rb, lib/bio/appl/hmmer.rb, lib/bio/io/fastacmd.rb For security reason, shell special characters are escaped. * lib/bio/appl/blast.rb, lib/bio/appl/fasta.rb, lib/bio/appl/hmmer.rb Options are stored with an array (@options). #options and #opions= methods are added. * lib/bio/appl/blast.rb, lib/bio/appl/fasta.rb Bio::Blast.remote and Bio::Fasta.remote did not work due to the change of the GenomeNet. Index: fastacmd.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/io/fastacmd.rb,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** fastacmd.rb 10 Aug 2005 12:55:06 -0000 1.6 --- fastacmd.rb 16 Aug 2005 09:38:34 -0000 1.7 *************** *** 24,28 **** require 'bio/db/fasta' require 'bio/io/flatfile' ! require 'open3' module Bio --- 24,28 ---- require 'bio/db/fasta' require 'bio/io/flatfile' ! require 'bio/command' module Bio *************** *** 32,35 **** --- 32,36 ---- include Enumerable + include Bio::Command::Tools def initialize(db) *************** *** 52,95 **** end ! if RUBY_PLATFORM[/mswin32|bccwin32/] # replace with appl/factory.rb ! cmd = "#{@fastacmd} -d #{@database} -s #{entry_id}" ! IO.popen(cmd, "r") do |io| ! io.sync = true ! results = Bio::FlatFile.new(Bio::FastaFormat, io).to_a ! end ! else ! cmd = [ @fastacmd, '-d', @database, '-s', entry_id ] ! Open3.popen3(*cmd) do |inn, out, err| ! inn.close ! t = Thread.start { @errorlog = err.read } ! results = Bio::FlatFile.new(Bio::FastaFormat, out).to_a ! t.join ! results ! end end end def each_entry ! if RUBY_PLATFORM[/mswin32|bccwin32/] # replace with appl/factory.rb ! cmd = "#{@fastacmd} -d #{@database} -D T" ! IO.popen(cmd, "r") do |io| ! io.sync = true ! Bio::FlatFile.open(Bio::FastaFormat, io) do |f| ! f.each_entry do |e| ! yield e ! end ! end ! end ! else ! cmd = [ @fastacmd, '-d', @database, '-D', 'T' ] ! Open3.popen3(*cmd) do |inn, out, err| ! inn.close ! t = Thread.start { @errorlog = err.read } ! Bio::FlatFile.open(Bio::FastaFormat, out) do |f| ! f.each_entry do |e| ! yield e ! end end - t.join end end --- 53,71 ---- end ! cmd = [ @fastacmd, '-d', @database, '-s', entry_id ] ! call_command_local(cmd) do |inn, out| ! inn.close_write ! Bio::FlatFile.new(Bio::FastaFormat, out).to_a end end def each_entry ! cmd = [ @fastacmd, '-d', @database, '-D', 'T' ] ! call_command_local(cmd) do |inn, out| ! inn.close_write ! Bio::FlatFile.open(Bio::FastaFormat, out) do |f| ! f.each_entry do |e| ! yield e end end end From ngoto at pub.open-bio.org Wed Aug 31 01:55:37 2005 From: ngoto at pub.open-bio.org (Naohisa Goto) Date: Fri Sep 9 13:29:24 2005 Subject: [BioRuby-cvs] bioruby ChangeLog,1.36,1.37 Message-ID: <200508310555.j7V5tbdZ030220@pub.open-bio.org> Update of /home/repository/bioruby/bioruby In directory pub.open-bio.org:/tmp/cvs-serv30208 Modified Files: ChangeLog Log Message: removed unused file lib/bio/appl/factory.rb (some functions had been moved to lib/bio/command.rb) Index: ChangeLog =================================================================== RCS file: /home/repository/bioruby/bioruby/ChangeLog,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** ChangeLog 16 Aug 2005 09:38:34 -0000 1.36 --- ChangeLog 31 Aug 2005 05:55:35 -0000 1.37 *************** *** 1,2 **** --- 1,7 ---- + 2005-08-31 Naohisa Goto + + * removed unused file lib/bio/appl/factory.rb + (some functions had been moved to lib/bio/command.rb) + 2005-08-16 Naohisa Goto From ngoto at pub.open-bio.org Wed Aug 31 08:35:44 2005 From: ngoto at pub.open-bio.org (Naohisa Goto) Date: Fri Sep 9 13:29:24 2005 Subject: [BioRuby-cvs] bioruby/doc Tutorial.rd,NONE,1.1 Message-ID: <200508311235.j7VCZidZ032000@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/doc In directory pub.open-bio.org:/tmp/cvs-serv31988 Added Files: Tutorial.rd Log Message: Quick translation of Tutorial.rd.ja into English. --- NEW FILE: Tutorial.rd --- =begin $Id: Tutorial.rd,v 1.1 2005/08/31 12:35:41 ngoto Exp $ Copyright (C) 2001-2003 KATAYAMA Toshiaki = How to use BioRuby == Manipulating nucleic / amino acid sequences (Bio::Sequence class) For simple example, by using a short DNA seuquence "atgcatgcaaaa", we are now converting into complemental strand, splicing subsequence, calculating nucleic acid compositions, translating to amino acid sequence, calculating molecular weight, and so on. About translation to amino acid sequences, you can specify frame where you want to start translation from and condon table ID defined in codontable.rb. #!/usr/bin/env ruby [...978 lines suppressed...] to be written... = KEGG API Please refer to KEGG_API.rd.ja (TRANSLATOR'S NOTE: English version: (()) ) and * (()) = APPENDIX == Installing required external library to be written... (TRANSLATOR'S NOTE: No additional libraries are needed with Ruby 1.8.1 and later.) =end From ngoto at pub.open-bio.org Wed Aug 31 09:16:05 2005 From: ngoto at pub.open-bio.org (Naohisa Goto) Date: Fri Sep 9 13:29:25 2005 Subject: [BioRuby-cvs] bioruby/doc Tutorial.rd,1.1,1.2 Message-ID: <200508311316.j7VDG5dZ032172@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/doc In directory pub.open-bio.org:/tmp/cvs-serv32139 Modified Files: Tutorial.rd Log Message: * removed Japanese characters in lines 317, 319, 321 and 763. * added credit of translator. * fixed TRANSLATOR'S NOTE in line 264. * changed "and" to "or" in line 1014. Index: Tutorial.rd =================================================================== RCS file: /home/repository/bioruby/bioruby/doc/Tutorial.rd,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Tutorial.rd 31 Aug 2005 12:35:41 -0000 1.1 --- Tutorial.rd 31 Aug 2005 13:16:03 -0000 1.2 *************** *** 5,8 **** --- 5,11 ---- Copyright (C) 2001-2003 KATAYAMA Toshiaki + Translated into English: Naohisa Goto + (to be written...) + = How to use BioRuby *************** *** 262,266 **** Bio::Sequence#splicing splices subsequence from nucleic acid sequence according to location information used in GenBank, EMBL and DDBJ. ! (TRANSLATOR'S NOTE: added EMBL and GenBank.) When translation table is different from 0(universal), or first codon is not "atg" or the protein contain selenocysteine, the two amino acid sequences will --- 265,269 ---- Bio::Sequence#splicing splices subsequence from nucleic acid sequence according to location information used in GenBank, EMBL and DDBJ. ! (TRANSLATOR'S NOTE: EMBL and DDBJ should be added in Japanese document.) When translation table is different from 0(universal), or first codon is not "atg" or the protein contain selenocysteine, the two amino acid sequences will *************** *** 315,323 **** ff = Bio::FlatFile.auto(ARGF) ff.each_entry do |entry| - p entry.entry_id # エントリの ID p entry.entry_id # identifier of the entry - p entry.definition # エントリの説明文 p entry.definition # definition of the entry - p entry.seq # 配列データベースの場合 p entry.seq # sequence data of the entry end --- 318,323 ---- *************** *** 761,765 **** \documentclass{jarticle} \begin{document} ! foo bar KEGG database~\cite{PMID:10592173} baz hoge fuga。 \begin{thebibliography}{00} --- 761,765 ---- \documentclass{jarticle} \begin{document} ! foo bar KEGG database~\cite{PMID:10592173} baz hoge fuga. \begin{thebibliography}{00} *************** *** 1012,1016 **** to be written... ! (TRANSLATOR'S NOTE: No additional libraries are needed with Ruby 1.8.1 and later.) =end --- 1012,1016 ---- to be written... ! (TRANSLATOR'S NOTE: No additional libraries are needed with Ruby 1.8.1 or later.) =end From ngoto at pub.open-bio.org Tue Aug 16 06:26:03 2005 From: ngoto at pub.open-bio.org (Naohisa Goto) Date: Fri Sep 9 13:29:44 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/appl blast.rb, 1.20, 1.21 fasta.rb, 1.16, 1.17 hmmer.rb, 1.1, 1.2 Message-ID: <200508160938.j7G9cadZ009057@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl In directory pub.open-bio.org:/tmp/cvs-serv9033/lib/bio/appl Modified Files: blast.rb fasta.rb hmmer.rb Log Message: * lib/bio/command.rb Newly added Bio::Command::Tools module. Bio::Command::Tools is a collection of useful methods for execution of external commands. * lib/bio/appl/blast.rb, lib/bio/appl/fasta.rb, lib/bio/appl/hmmer.rb, lib/bio/io/fastacmd.rb For security reason, shell special characters are escaped. * lib/bio/appl/blast.rb, lib/bio/appl/fasta.rb, lib/bio/appl/hmmer.rb Options are stored with an array (@options). #options and #opions= methods are added. * lib/bio/appl/blast.rb, lib/bio/appl/fasta.rb Bio::Blast.remote and Bio::Fasta.remote did not work due to the change of the GenomeNet. Index: blast.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/blast.rb,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** blast.rb 23 Aug 2004 23:48:02 -0000 1.20 --- blast.rb 16 Aug 2005 09:38:34 -0000 1.21 *************** *** 25,28 **** --- 25,30 ---- require 'cgi' unless defined?(CGI) require 'bio/appl/blast/report' + require 'bio/command' + require 'shellwords' module Bio *************** *** 30,34 **** class Blast ! def initialize(program, db, option = '', server = 'local') if defined?(XMLParser) or defined?(REXML) @format = 7 --- 32,38 ---- class Blast ! include Bio::Command::Tools ! ! def initialize(program, db, opt = [], server = 'local') if defined?(XMLParser) or defined?(REXML) @format = 7 *************** *** 39,43 **** @program = program @db = db - @option = "-m #{@format} #{option}" @server = server --- 43,46 ---- *************** *** 48,53 **** @output = '' @parser = nil end ! attr_accessor :program, :db, :option, :server, :blastall, :matrix, :filter attr_reader :output, :format attr_writer :parser # to change :xmlparser, :rexml, :tab --- 51,64 ---- @output = '' @parser = nil + + begin + a = opt.to_ary + rescue NameError #NoMethodError + # backward compatibility + a = Shellwords.shellwords(opt) + end + @options = [ "-m", @format, *a ] end ! attr_accessor :program, :db, :options, :server, :blastall, :matrix, :filter attr_reader :output, :format attr_writer :parser # to change :xmlparser, :rexml, :tab *************** *** 65,68 **** --- 76,89 ---- end + def option + # backward compatibility + make_command_line(@options) + end + + def option=(str) + # backward compatibility + @options = Shellwords.shellwords(str) + end + private *************** *** 75,96 **** def exec_local(query) ! cmd = "#{@blastall} -p #{@program} -d #{@db} #{@option}" ! cmd += " -M #{@matrix}" if @matrix ! cmd += " -F #{@filter}" if @filter report = nil ! begin ! io = IO.popen(cmd, "w+") ! io.sync = true ! io.puts(query) ! io.close_write ! @output = io.read ! report = parse_result(@output) ! rescue ! raise "[Error] command execution failed : #{cmd}" ! ensure ! io.close ! end return report --- 96,107 ---- def exec_local(query) ! cmd = [ @blastall, '-p', @program, '-d', @db, *@options ] ! cmd.concat([ '-M', @matrix ]) if @matrix ! cmd.concat([ '-F', @filter ]) if @filter report = nil ! @output = call_command_local(cmd, query) ! report = parse_result(@output) return report *************** *** 100,104 **** def exec_genomenet(query) host = "blast.genome.jp" ! path = "/sit-bin/nph-blast" matrix = @matrix ? @matrix : 'blosum62' --- 111,116 ---- def exec_genomenet(query) host = "blast.genome.jp" ! #path = "/sit-bin/nph-blast" ! path = "/sit-bin/blast" #2005.08.12 matrix = @matrix ? @matrix : 'blosum62' *************** *** 110,114 **** 'dbname' => @db, 'sequence' => CGI.escape(query), ! 'other_param' => CGI.escape(@option), 'matrix' => matrix, 'filter' => filter, --- 122,126 ---- 'dbname' => @db, 'sequence' => CGI.escape(query), ! 'other_param' => CGI.escape(make_command_line_unix(@options)), 'matrix' => matrix, 'filter' => filter, *************** *** 127,133 **** begin ! result, = Net::HTTP.new(host).post(path, data.join('&')) ! @output = result.body ! report = parse_result(@output) end --- 139,160 ---- begin ! http = Net::HTTP.new(host) ! http.open_timeout = 300 ! http.read_timeout = 600 ! result, = http.post(path, data.join('&')) ! @output = result.body ! # workaround 2005.08.12 ! if /\Show all result\<\/A\>/i =~ @output.to_s then ! result, = http.get($2) ! @output = result.body ! txt = @output.to_s.split(/\/)[1] ! raise 'cannot understand response' unless txt ! txt.sub!(/\<\/pre\>.*\z/m, '') ! txt.sub!(/.*^ \-{20,}\s*/m, '') ! @output = txt.gsub(/\<\;/, '<') ! report = parse_result(@output) ! else ! raise 'cannot understand response' ! end end *************** *** 183,187 **** --- Bio::Blast#program --- Bio::Blast#db ! --- Bio::Blast#option --- Bio::Blast#server --- Bio::Blast#blastall --- 210,214 ---- --- Bio::Blast#program --- Bio::Blast#db ! --- Bio::Blast#options --- Bio::Blast#server --- Bio::Blast#blastall *************** *** 189,192 **** --- 216,224 ---- Accessors for the factory parameters. + + --- Bio::Blast#option + --- Bio::Blast#option=(str) + + Get/set options by string. == Available databases for Blast.remote(@program, @db, option, 'genomenet') Index: fasta.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/fasta.rb,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** fasta.rb 25 Aug 2004 06:29:10 -0000 1.16 --- fasta.rb 16 Aug 2005 09:38:34 -0000 1.17 *************** *** 23,26 **** --- 23,28 ---- require 'net/http' require 'cgi' unless defined?(CGI) + require 'bio/command' + require 'shellwords' module Bio *************** *** 28,37 **** class Fasta ! def initialize(program, db, option = '', server = 'local') @format = 10 @program = program @db = db - @option = "-Q -H -m #{@format} #{option}" # need -a ? @server = server --- 30,40 ---- class Fasta ! include Bio::Command::Tools ! ! def initialize(program, db, opt = [], server = 'local') @format = 10 @program = program @db = db @server = server *************** *** 40,51 **** @output = '' end ! attr_accessor :program, :db, :option, :server, :ktup, :matrix attr_reader :output def format=(num) @format = num.to_i ! @option.gsub!(/\s*-m\s+\d+/, '') ! @option += " -m #{num} " end attr_reader :format --- 43,75 ---- @output = '' + + begin + a = opt.to_ary + rescue NameError #NoMethodError + # backward compatibility + a = Shellwords.shellwords(opt) + end + @options = [ '-Q', '-H', '-m', @format.to_s, *a ] # need -a ? end ! attr_accessor :program, :db, :options, :server, :ktup, :matrix attr_reader :output + def option + # backward compatibility + make_command_line(@options) + end + + def option=(str) + # backward compatibility + @options = Shellwords.shellwords(str) + end + def format=(num) @format = num.to_i ! if i = @options.index('-m') then ! @options[i+1, 1] = @format.to_s ! else ! @options << '-m' << @format.to_s ! end end attr_reader :format *************** *** 83,102 **** def exec_local(query) ! cmd = "#{@program} #{@option} @ #{@db} #{@ktup}" report = nil ! begin ! io = IO.popen(cmd, "w+") ! io.sync = true ! io.puts(query) ! io.close_write ! @output = io.read ! report = parse_result(@output) ! rescue ! raise "[Error] command execution failed : #{cmd}" ! ensure ! io.close ! end return report --- 107,117 ---- def exec_local(query) ! cmd = [ @program, *@options ] ! cmd.concat([ '@', @db, @ktup ]) report = nil ! @output = call_command_local(cmd, query) ! report = parse_result(@output) return report *************** *** 106,110 **** def exec_genomenet(query) host = "fasta.genome.jp" ! path = "/sit-bin/nph-fasta" form = { --- 121,126 ---- def exec_genomenet(query) host = "fasta.genome.jp" ! #path = "/sit-bin/nph-fasta" ! path = "/sit-bin/fasta" #2005.08.12 form = { *************** *** 113,117 **** 'dbname' => @db, 'sequence' => CGI.escape(query), ! 'other_param' => CGI.escape(@option), 'ktup_value' => @ktup, 'matrix' => @matrix, --- 129,133 ---- 'dbname' => @db, 'sequence' => CGI.escape(query), ! 'other_param' => CGI.escape(make_command_line_unix(@options)), 'ktup_value' => @ktup, 'matrix' => @matrix, *************** *** 127,133 **** begin ! result, = Net::HTTP.new(host).post(path, data.join('&')) ! @output = result.body ! report = parse_result(@output) end --- 143,168 ---- begin ! http = Net::HTTP.new(host) ! http.open_timeout = 300 ! http.read_timeout = 600 ! result, = http.post(path, data.join('&')) ! @output = result.body ! # workaround 2005.08.12 ! if /\Show all result\<\/A\>/i =~ @output.to_s then ! result, = http.get($2) ! @output = result.body ! txt = @output.to_s.split(/\/)[1] ! raise 'cannot understand response' unless txt ! txt.sub!(/\<\/pre\>.*\z/m, '') ! txt.sub!(/.*^((T?FASTA|SSEARCH) (searches|compares))/m, '\1') ! txt.sub!(/^\
.*\n/, '') ! txt.gsub!(/\]+value\=\"[^\"]*\"[^\>]*\>/i, '') ! txt.gsub!(/\<(a|form|select|input|option|img)\s+[^\>]+\>/i, '') ! txt.gsub!(/\<\/(a|form|select|input|option|img)\>/i, '') ! @output = txt.gsub(/\<\;/, '<') ! report = parse_result(@output.dup) ! else ! raise 'cannot understand response' ! end end *************** *** 178,186 **** --- Bio::Fasta#program --- Bio::Fasta#db ! --- Bio::Fasta#option --- Bio::Fasta#server --- Bio::Fasta#ktup Accessors for the factory parameters. --- Bio::Fasta#format --- 213,226 ---- --- Bio::Fasta#program --- Bio::Fasta#db ! --- Bio::Fasta#options --- Bio::Fasta#server --- Bio::Fasta#ktup Accessors for the factory parameters. + + --- Bio::Fasta#option + --- Bio::Fasta#option=(str) + + Get/set options by string. --- Bio::Fasta#format Index: hmmer.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/hmmer.rb,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** hmmer.rb 22 Nov 2002 23:17:55 -0000 1.1 --- hmmer.rb 16 Aug 2005 09:38:34 -0000 1.2 *************** *** 22,25 **** --- 22,27 ---- require 'bio/appl/hmmer/report' + require 'bio/command' + require 'shellwords' module Bio *************** *** 27,55 **** class HMMER ! def initialize(program, hmmfile, seqfile, option = '') @program = program @hmmfile = hmmfile @seqfile = seqfile - @option = option @output = '' end ! attr_accessor :program, :hmmfile, :seqfile, :option attr_reader :output def query ! cmd = "#{@program} #{@option} #{@hmmfile} #{@seqfile}" report = nil ! begin ! io = IO.popen(cmd, 'r') ! io.sync = true ! @output = io.read ! report = parse_result(@output) ! rescue ! raise "[Error] command execution failed : #{cmd}" ! ensure ! io.close ! end return report --- 29,68 ---- class HMMER ! include Bio::Command::Tools ! ! def initialize(program, hmmfile, seqfile, opt = []) @program = program @hmmfile = hmmfile @seqfile = seqfile @output = '' + + begin + @options = opt.to_ary + rescue NameError #NoMethodError + # backward compatibility + @options = Shellwords.shellwords(opt) + end end ! attr_accessor :program, :hmmfile, :seqfile, :options attr_reader :output + def option + # backward compatibility + make_command_line(@options) + end + + def option=(str) + # backward compatibility + @options = Shellwords.shellwords(str) + end + def query ! cmd = [ @program, *@options ] ! cmd.concat([ @hmmfile, @seqfile ]) report = nil ! @output = call_command_local(cmd, nil) ! report = parse_result(@output) return report *************** *** 94,100 **** --- Bio::HMMER#hmmfile --- Bio::HMMER#seqfile ! --- Bio::HMMER#option Accessors for the factory. --- Bio::HMMER#query --- 107,118 ---- --- Bio::HMMER#hmmfile --- Bio::HMMER#seqfile ! --- Bio::HMMER#options Accessors for the factory. + + --- Bio::HMMER#option + --- Bio::HMMER#option=(str) + + Get/set options by string. --- Bio::HMMER#query From ngoto at pub.open-bio.org Wed Aug 31 01:55:37 2005 From: ngoto at pub.open-bio.org (Naohisa Goto) Date: Fri Sep 9 13:29:44 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/appl factory.rb,1.1,NONE Message-ID: <200508310555.j7V5tbdZ030222@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl In directory pub.open-bio.org:/tmp/cvs-serv30208/lib/bio/appl Removed Files: factory.rb Log Message: removed unused file lib/bio/appl/factory.rb (some functions had been moved to lib/bio/command.rb) --- factory.rb DELETED ---