From raoul.bonnal at itb.cnr.it Tue May 20 10:37:22 2008 From: raoul.bonnal at itb.cnr.it (Raoul Jean Pierre Bonnal) Date: Tue, 20 May 2008 16:37:22 +0200 Subject: [BioRuby] Fasta and Bio::Sequence Message-ID: <1211294242.5759.4.camel@454-2> Dear list, converting a "CUSTOM" fasta entry to Bio::Sequence with to_seq a lot of things are missing: primary_accession, sequence_version and entry_id, probably setting accession and entry to entry.entry_id and sequence_version to Zero by default would be a good choice. What do you think ? -- Ra From ngoto at gen-info.osaka-u.ac.jp Wed May 21 07:00:24 2008 From: ngoto at gen-info.osaka-u.ac.jp (Naohisa GOTO) Date: Wed, 21 May 2008 20:00:24 +0900 Subject: [BioRuby] Fasta and Bio::Sequence In-Reply-To: <1211294242.5759.4.camel@454-2> References: <1211294242.5759.4.camel@454-2> Message-ID: <20080521110025.05B681CBC4E1@idnmail.gen-info.osaka-u.ac.jp> Hi Ra, On Tue, 20 May 2008 16:37:22 +0200 Raoul Jean Pierre Bonnal wrote: > Dear list, > converting a "CUSTOM" fasta entry to Bio::Sequence with to_seq a lot of > things are missing: primary_accession, sequence_version and entry_id, > probably setting accession and entry to entry.entry_id and > sequence_version to Zero by default would be a good choice. > What do you think ? To distinguish whether the values are comming from the data, being set by user or given as default values, I prefer not to set default values if possible. For entry_id, I think it is given by the fasta definition line. For "accession", because accession is mainly used in GenBank/EMBL/DDBJ data and their variants, and no accession may be given for other data, I think nil is the best by default. It is good to parse the "gi|gi-number|gb|accession|locus" in fasta defline and to set accession from the parse result. (the parser is already available in BioRuby.) In case of sequence_version, it might not be a number in some cases. (for example, "hg18" and "mm9" for human and mouse genomes.) So, I think nil is also good by default. -- Naohisa Goto ng at bioruby.org / ngoto at gen-info.osaka-u.ac.jp From ngoto at gen-info.osaka-u.ac.jp Thu May 29 09:00:30 2008 From: ngoto at gen-info.osaka-u.ac.jp (Naohisa GOTO) Date: Thu, 29 May 2008 22:00:30 +0900 Subject: [BioRuby] [BioRuby-cvs] bioruby/lib/bio reference.rb,1.24,1.25 In-Reply-To: <200805291125.m4TBPlWZ015209@dev.open-bio.org> References: <200805291125.m4TBPlWZ015209@dev.open-bio.org> Message-ID: <20080529130031.E7B361CBC3F1@idnmail.gen-info.osaka-u.ac.jp> On Thu, 29 May 2008 11:25:47 +0000 Pjotr Prins wrote: > Update of /home/repository/bioruby/bioruby/lib/bio > In directory dev.open-bio.org:/tmp/cvs-serv15189 > > Modified Files: > reference.rb > Log Message: > - Improved bibtex support (optional output of abstract - strip empty fields) > - Put generated URL into separate method I don't agree with the changes about URL because Bio::Reference is not only for PubMed data but also for general bibliography reference data but your changes about the url is too specific for PubMed. -- Naohisa Goto ng at bioruby.org / ngoto at gen-info.osaka-u.ac.jp > > Index: reference.rb > =================================================================== > RCS file: /home/repository/bioruby/bioruby/lib/bio/reference.rb,v > retrieving revision 1.24 > retrieving revision 1.25 > diff -C2 -d -r1.24 -r1.25 > *** reference.rb 5 Apr 2007 23:35:39 -0000 1.24 > --- reference.rb 29 May 2008 11:25:44 -0000 1.25 > *************** > *** 71,77 **** > attr_reader :abstract > > - # An URL String. > - attr_reader :url > - > # MeSH terms in an Array. > attr_reader :mesh > --- 71,74 ---- > *************** > *** 128,132 **** > @medline = hash['medline'] # 98765432 > @abstract = hash['abstract'] > - @url = hash['url'] > @mesh = hash['mesh'] > @affiliations = hash['affiliations'] > --- 125,128 ---- > *************** > *** 232,241 **** > lines << "%P #{@pages}" unless @pages.empty? > lines << "%M #{@pubmed}" unless @pubmed.to_s.empty? > ! if @pubmed > ! cgi = "http://www.ncbi.nlm.nih.gov/entrez/query.fcgi" > ! opts = "cmd=Retrieve&db=PubMed&dopt=Citation&list_uids" > ! @url = "#{cgi}?#{opts}=#{@pubmed}" > ! end > ! lines << "%U #{@url}" unless @url.empty? > lines << "%X #{@abstract}" unless @abstract.empty? > @mesh.each do |term| > --- 228,232 ---- > lines << "%P #{@pages}" unless @pages.empty? > lines << "%M #{@pubmed}" unless @pubmed.to_s.empty? > ! lines << "%U #{url}" unless url.empty? > lines << "%X #{@abstract}" unless @abstract.empty? > @mesh.each do |term| > *************** > *** 299,318 **** > # *Arguments*: > # * (optional) _section_: BiBTeX section as String > # *Returns*:: String > ! def bibtex(section = nil) > section = "article" unless section > authors = authors_join(' and ', ' and ') > pages = @pages.sub('-', '--') > ! return <<-"END".gsub(/\t/, '') > ! @#{section}{PMID:#{@pubmed}, > ! author = {#{authors}}, > ! title = {#{@title}}, > ! journal = {#{@journal}}, > ! year = {#{@year}}, > ! volume = {#{@volume}}, > ! number = {#{@issue}}, > ! pages = {#{pages}}, > ! } > ! END > end > > --- 290,317 ---- > # *Arguments*: > # * (optional) _section_: BiBTeX section as String > + # * (optional) _keywords_: Array of additional keywords, e.g. ['abstract'] > # *Returns*:: String > ! def bibtex(section = nil, add_keywords = []) > section = "article" unless section > authors = authors_join(' and ', ' and ') > pages = @pages.sub('-', '--') > ! keywords = "author title journal year volume number pages url".split(/ /) > ! bib = "@#{section}{PMID:#{@pubmed},\n" > ! (keywords+add_keywords).each do | kw | > ! if kw == 'author' > ! ref = authors > ! elsif kw == 'title' > ! # strip final dot from title > ! ref = @title.sub(/\.$/,'') > ! elsif kw == 'number' > ! ref = @issue > ! elsif kw == 'url' > ! ref = url > ! else > ! ref = eval('@'+kw) > ! end > ! bib += " #{kw.ljust(12)} = {#{ref}},\n" if ref != '' > ! end > ! bib+"}\n" > end > > *************** > *** 500,503 **** > --- 499,513 ---- > end > > + # Returns a valid URL for pubmed records > + # > + # *Returns*:: String > + def url > + if @pubmed != '' > + cgi = "http://www.ncbi.nlm.nih.gov/entrez/query.fcgi" > + opts = "cmd=Retrieve&db=PubMed&dopt=Citation&list_uids" > + return "#{cgi}?#{opts}=#{@pubmed}" > + end > + '' > + end > > private > *************** > *** 527,530 **** > --- 537,541 ---- > end > > + > end > > > _______________________________________________ > bioruby-cvs mailing list > bioruby-cvs at lists.open-bio.org > http://lists.open-bio.org/mailman/listinfo/bioruby-cvs From pjotr2008 at thebird.nl Thu May 29 09:57:20 2008 From: pjotr2008 at thebird.nl (Pjotr Prins) Date: Thu, 29 May 2008 15:57:20 +0200 Subject: [BioRuby] [BioRuby-cvs] bioruby/lib/bio reference.rb,1.24,1.25 In-Reply-To: <20080529130031.E7B361CBC3F1@idnmail.gen-info.osaka-u.ac.jp> References: <200805291125.m4TBPlWZ015209@dev.open-bio.org> <20080529130031.E7B361CBC3F1@idnmail.gen-info.osaka-u.ac.jp> Message-ID: <20080529135719.GA23699@thebird.nl> The reason was preventing code duplication - url is generated in two places. The url method does test for pubmed. Also, in general it is nice to be able to use reference.url for other purposes. That does what it says. Feel free to change it again. I thought it was an improvement. Isn't that class up for redesign anyway? Pj. On Thu, May 29, 2008 at 10:00:30PM +0900, Naohisa GOTO wrote: > On Thu, 29 May 2008 11:25:47 +0000 > Pjotr Prins wrote: > > > Update of /home/repository/bioruby/bioruby/lib/bio > > In directory dev.open-bio.org:/tmp/cvs-serv15189 > > > > Modified Files: > > reference.rb > > Log Message: > > - Improved bibtex support (optional output of abstract - strip empty fields) > > - Put generated URL into separate method > > I don't agree with the changes about URL because Bio::Reference is > not only for PubMed data but also for general bibliography reference > data but your changes about the url is too specific for PubMed. > > -- > Naohisa Goto > ng at bioruby.org / ngoto at gen-info.osaka-u.ac.jp > > > > > Index: reference.rb > > =================================================================== > > RCS file: /home/repository/bioruby/bioruby/lib/bio/reference.rb,v > > retrieving revision 1.24 > > retrieving revision 1.25 > > diff -C2 -d -r1.24 -r1.25 > > *** reference.rb 5 Apr 2007 23:35:39 -0000 1.24 > > --- reference.rb 29 May 2008 11:25:44 -0000 1.25 > > *************** > > *** 71,77 **** > > attr_reader :abstract > > > > - # An URL String. > > - attr_reader :url > > - > > # MeSH terms in an Array. > > attr_reader :mesh > > --- 71,74 ---- > > *************** > > *** 128,132 **** > > @medline = hash['medline'] # 98765432 > > @abstract = hash['abstract'] > > - @url = hash['url'] > > @mesh = hash['mesh'] > > @affiliations = hash['affiliations'] > > --- 125,128 ---- > > *************** > > *** 232,241 **** > > lines << "%P #{@pages}" unless @pages.empty? > > lines << "%M #{@pubmed}" unless @pubmed.to_s.empty? > > ! if @pubmed > > ! cgi = "http://www.ncbi.nlm.nih.gov/entrez/query.fcgi" > > ! opts = "cmd=Retrieve&db=PubMed&dopt=Citation&list_uids" > > ! @url = "#{cgi}?#{opts}=#{@pubmed}" > > ! end > > ! lines << "%U #{@url}" unless @url.empty? > > lines << "%X #{@abstract}" unless @abstract.empty? > > @mesh.each do |term| > > --- 228,232 ---- > > lines << "%P #{@pages}" unless @pages.empty? > > lines << "%M #{@pubmed}" unless @pubmed.to_s.empty? > > ! lines << "%U #{url}" unless url.empty? > > lines << "%X #{@abstract}" unless @abstract.empty? > > @mesh.each do |term| > > *************** > > *** 299,318 **** > > # *Arguments*: > > # * (optional) _section_: BiBTeX section as String > > # *Returns*:: String > > ! def bibtex(section = nil) > > section = "article" unless section > > authors = authors_join(' and ', ' and ') > > pages = @pages.sub('-', '--') > > ! return <<-"END".gsub(/\t/, '') > > ! @#{section}{PMID:#{@pubmed}, > > ! author = {#{authors}}, > > ! title = {#{@title}}, > > ! journal = {#{@journal}}, > > ! year = {#{@year}}, > > ! volume = {#{@volume}}, > > ! number = {#{@issue}}, > > ! pages = {#{pages}}, > > ! } > > ! END > > end > > > > --- 290,317 ---- > > # *Arguments*: > > # * (optional) _section_: BiBTeX section as String > > + # * (optional) _keywords_: Array of additional keywords, e.g. ['abstract'] > > # *Returns*:: String > > ! def bibtex(section = nil, add_keywords = []) > > section = "article" unless section > > authors = authors_join(' and ', ' and ') > > pages = @pages.sub('-', '--') > > ! keywords = "author title journal year volume number pages url".split(/ /) > > ! bib = "@#{section}{PMID:#{@pubmed},\n" > > ! (keywords+add_keywords).each do | kw | > > ! if kw == 'author' > > ! ref = authors > > ! elsif kw == 'title' > > ! # strip final dot from title > > ! ref = @title.sub(/\.$/,'') > > ! elsif kw == 'number' > > ! ref = @issue > > ! elsif kw == 'url' > > ! ref = url > > ! else > > ! ref = eval('@'+kw) > > ! end > > ! bib += " #{kw.ljust(12)} = {#{ref}},\n" if ref != '' > > ! end > > ! bib+"}\n" > > end > > > > *************** > > *** 500,503 **** > > --- 499,513 ---- > > end > > > > + # Returns a valid URL for pubmed records > > + # > > + # *Returns*:: String > > + def url > > + if @pubmed != '' > > + cgi = "http://www.ncbi.nlm.nih.gov/entrez/query.fcgi" > > + opts = "cmd=Retrieve&db=PubMed&dopt=Citation&list_uids" > > + return "#{cgi}?#{opts}=#{@pubmed}" > > + end > > + '' > > + end > > > > private > > *************** > > *** 527,530 **** > > --- 537,541 ---- > > end > > > > + > > end > > > > > > _______________________________________________ > > bioruby-cvs mailing list > > bioruby-cvs at lists.open-bio.org > > http://lists.open-bio.org/mailman/listinfo/bioruby-cvs > > > _______________________________________________ > BioRuby mailing list > BioRuby at lists.open-bio.org > http://lists.open-bio.org/mailman/listinfo/bioruby -- mobile nr: 0651172281 (work) From raoul.bonnal at itb.cnr.it Tue May 20 14:37:22 2008 From: raoul.bonnal at itb.cnr.it (Raoul Jean Pierre Bonnal) Date: Tue, 20 May 2008 16:37:22 +0200 Subject: [BioRuby] Fasta and Bio::Sequence Message-ID: <1211294242.5759.4.camel@454-2> Dear list, converting a "CUSTOM" fasta entry to Bio::Sequence with to_seq a lot of things are missing: primary_accession, sequence_version and entry_id, probably setting accession and entry to entry.entry_id and sequence_version to Zero by default would be a good choice. What do you think ? -- Ra From ngoto at gen-info.osaka-u.ac.jp Wed May 21 11:00:24 2008 From: ngoto at gen-info.osaka-u.ac.jp (Naohisa GOTO) Date: Wed, 21 May 2008 20:00:24 +0900 Subject: [BioRuby] Fasta and Bio::Sequence In-Reply-To: <1211294242.5759.4.camel@454-2> References: <1211294242.5759.4.camel@454-2> Message-ID: <20080521110025.05B681CBC4E1@idnmail.gen-info.osaka-u.ac.jp> Hi Ra, On Tue, 20 May 2008 16:37:22 +0200 Raoul Jean Pierre Bonnal wrote: > Dear list, > converting a "CUSTOM" fasta entry to Bio::Sequence with to_seq a lot of > things are missing: primary_accession, sequence_version and entry_id, > probably setting accession and entry to entry.entry_id and > sequence_version to Zero by default would be a good choice. > What do you think ? To distinguish whether the values are comming from the data, being set by user or given as default values, I prefer not to set default values if possible. For entry_id, I think it is given by the fasta definition line. For "accession", because accession is mainly used in GenBank/EMBL/DDBJ data and their variants, and no accession may be given for other data, I think nil is the best by default. It is good to parse the "gi|gi-number|gb|accession|locus" in fasta defline and to set accession from the parse result. (the parser is already available in BioRuby.) In case of sequence_version, it might not be a number in some cases. (for example, "hg18" and "mm9" for human and mouse genomes.) So, I think nil is also good by default. -- Naohisa Goto ng at bioruby.org / ngoto at gen-info.osaka-u.ac.jp From ngoto at gen-info.osaka-u.ac.jp Thu May 29 13:00:30 2008 From: ngoto at gen-info.osaka-u.ac.jp (Naohisa GOTO) Date: Thu, 29 May 2008 22:00:30 +0900 Subject: [BioRuby] [BioRuby-cvs] bioruby/lib/bio reference.rb,1.24,1.25 In-Reply-To: <200805291125.m4TBPlWZ015209@dev.open-bio.org> References: <200805291125.m4TBPlWZ015209@dev.open-bio.org> Message-ID: <20080529130031.E7B361CBC3F1@idnmail.gen-info.osaka-u.ac.jp> On Thu, 29 May 2008 11:25:47 +0000 Pjotr Prins wrote: > Update of /home/repository/bioruby/bioruby/lib/bio > In directory dev.open-bio.org:/tmp/cvs-serv15189 > > Modified Files: > reference.rb > Log Message: > - Improved bibtex support (optional output of abstract - strip empty fields) > - Put generated URL into separate method I don't agree with the changes about URL because Bio::Reference is not only for PubMed data but also for general bibliography reference data but your changes about the url is too specific for PubMed. -- Naohisa Goto ng at bioruby.org / ngoto at gen-info.osaka-u.ac.jp > > Index: reference.rb > =================================================================== > RCS file: /home/repository/bioruby/bioruby/lib/bio/reference.rb,v > retrieving revision 1.24 > retrieving revision 1.25 > diff -C2 -d -r1.24 -r1.25 > *** reference.rb 5 Apr 2007 23:35:39 -0000 1.24 > --- reference.rb 29 May 2008 11:25:44 -0000 1.25 > *************** > *** 71,77 **** > attr_reader :abstract > > - # An URL String. > - attr_reader :url > - > # MeSH terms in an Array. > attr_reader :mesh > --- 71,74 ---- > *************** > *** 128,132 **** > @medline = hash['medline'] # 98765432 > @abstract = hash['abstract'] > - @url = hash['url'] > @mesh = hash['mesh'] > @affiliations = hash['affiliations'] > --- 125,128 ---- > *************** > *** 232,241 **** > lines << "%P #{@pages}" unless @pages.empty? > lines << "%M #{@pubmed}" unless @pubmed.to_s.empty? > ! if @pubmed > ! cgi = "http://www.ncbi.nlm.nih.gov/entrez/query.fcgi" > ! opts = "cmd=Retrieve&db=PubMed&dopt=Citation&list_uids" > ! @url = "#{cgi}?#{opts}=#{@pubmed}" > ! end > ! lines << "%U #{@url}" unless @url.empty? > lines << "%X #{@abstract}" unless @abstract.empty? > @mesh.each do |term| > --- 228,232 ---- > lines << "%P #{@pages}" unless @pages.empty? > lines << "%M #{@pubmed}" unless @pubmed.to_s.empty? > ! lines << "%U #{url}" unless url.empty? > lines << "%X #{@abstract}" unless @abstract.empty? > @mesh.each do |term| > *************** > *** 299,318 **** > # *Arguments*: > # * (optional) _section_: BiBTeX section as String > # *Returns*:: String > ! def bibtex(section = nil) > section = "article" unless section > authors = authors_join(' and ', ' and ') > pages = @pages.sub('-', '--') > ! return <<-"END".gsub(/\t/, '') > ! @#{section}{PMID:#{@pubmed}, > ! author = {#{authors}}, > ! title = {#{@title}}, > ! journal = {#{@journal}}, > ! year = {#{@year}}, > ! volume = {#{@volume}}, > ! number = {#{@issue}}, > ! pages = {#{pages}}, > ! } > ! END > end > > --- 290,317 ---- > # *Arguments*: > # * (optional) _section_: BiBTeX section as String > + # * (optional) _keywords_: Array of additional keywords, e.g. ['abstract'] > # *Returns*:: String > ! def bibtex(section = nil, add_keywords = []) > section = "article" unless section > authors = authors_join(' and ', ' and ') > pages = @pages.sub('-', '--') > ! keywords = "author title journal year volume number pages url".split(/ /) > ! bib = "@#{section}{PMID:#{@pubmed},\n" > ! (keywords+add_keywords).each do | kw | > ! if kw == 'author' > ! ref = authors > ! elsif kw == 'title' > ! # strip final dot from title > ! ref = @title.sub(/\.$/,'') > ! elsif kw == 'number' > ! ref = @issue > ! elsif kw == 'url' > ! ref = url > ! else > ! ref = eval('@'+kw) > ! end > ! bib += " #{kw.ljust(12)} = {#{ref}},\n" if ref != '' > ! end > ! bib+"}\n" > end > > *************** > *** 500,503 **** > --- 499,513 ---- > end > > + # Returns a valid URL for pubmed records > + # > + # *Returns*:: String > + def url > + if @pubmed != '' > + cgi = "http://www.ncbi.nlm.nih.gov/entrez/query.fcgi" > + opts = "cmd=Retrieve&db=PubMed&dopt=Citation&list_uids" > + return "#{cgi}?#{opts}=#{@pubmed}" > + end > + '' > + end > > private > *************** > *** 527,530 **** > --- 537,541 ---- > end > > + > end > > > _______________________________________________ > bioruby-cvs mailing list > bioruby-cvs at lists.open-bio.org > http://lists.open-bio.org/mailman/listinfo/bioruby-cvs From pjotr2008 at thebird.nl Thu May 29 13:57:20 2008 From: pjotr2008 at thebird.nl (Pjotr Prins) Date: Thu, 29 May 2008 15:57:20 +0200 Subject: [BioRuby] [BioRuby-cvs] bioruby/lib/bio reference.rb,1.24,1.25 In-Reply-To: <20080529130031.E7B361CBC3F1@idnmail.gen-info.osaka-u.ac.jp> References: <200805291125.m4TBPlWZ015209@dev.open-bio.org> <20080529130031.E7B361CBC3F1@idnmail.gen-info.osaka-u.ac.jp> Message-ID: <20080529135719.GA23699@thebird.nl> The reason was preventing code duplication - url is generated in two places. The url method does test for pubmed. Also, in general it is nice to be able to use reference.url for other purposes. That does what it says. Feel free to change it again. I thought it was an improvement. Isn't that class up for redesign anyway? Pj. On Thu, May 29, 2008 at 10:00:30PM +0900, Naohisa GOTO wrote: > On Thu, 29 May 2008 11:25:47 +0000 > Pjotr Prins wrote: > > > Update of /home/repository/bioruby/bioruby/lib/bio > > In directory dev.open-bio.org:/tmp/cvs-serv15189 > > > > Modified Files: > > reference.rb > > Log Message: > > - Improved bibtex support (optional output of abstract - strip empty fields) > > - Put generated URL into separate method > > I don't agree with the changes about URL because Bio::Reference is > not only for PubMed data but also for general bibliography reference > data but your changes about the url is too specific for PubMed. > > -- > Naohisa Goto > ng at bioruby.org / ngoto at gen-info.osaka-u.ac.jp > > > > > Index: reference.rb > > =================================================================== > > RCS file: /home/repository/bioruby/bioruby/lib/bio/reference.rb,v > > retrieving revision 1.24 > > retrieving revision 1.25 > > diff -C2 -d -r1.24 -r1.25 > > *** reference.rb 5 Apr 2007 23:35:39 -0000 1.24 > > --- reference.rb 29 May 2008 11:25:44 -0000 1.25 > > *************** > > *** 71,77 **** > > attr_reader :abstract > > > > - # An URL String. > > - attr_reader :url > > - > > # MeSH terms in an Array. > > attr_reader :mesh > > --- 71,74 ---- > > *************** > > *** 128,132 **** > > @medline = hash['medline'] # 98765432 > > @abstract = hash['abstract'] > > - @url = hash['url'] > > @mesh = hash['mesh'] > > @affiliations = hash['affiliations'] > > --- 125,128 ---- > > *************** > > *** 232,241 **** > > lines << "%P #{@pages}" unless @pages.empty? > > lines << "%M #{@pubmed}" unless @pubmed.to_s.empty? > > ! if @pubmed > > ! cgi = "http://www.ncbi.nlm.nih.gov/entrez/query.fcgi" > > ! opts = "cmd=Retrieve&db=PubMed&dopt=Citation&list_uids" > > ! @url = "#{cgi}?#{opts}=#{@pubmed}" > > ! end > > ! lines << "%U #{@url}" unless @url.empty? > > lines << "%X #{@abstract}" unless @abstract.empty? > > @mesh.each do |term| > > --- 228,232 ---- > > lines << "%P #{@pages}" unless @pages.empty? > > lines << "%M #{@pubmed}" unless @pubmed.to_s.empty? > > ! lines << "%U #{url}" unless url.empty? > > lines << "%X #{@abstract}" unless @abstract.empty? > > @mesh.each do |term| > > *************** > > *** 299,318 **** > > # *Arguments*: > > # * (optional) _section_: BiBTeX section as String > > # *Returns*:: String > > ! def bibtex(section = nil) > > section = "article" unless section > > authors = authors_join(' and ', ' and ') > > pages = @pages.sub('-', '--') > > ! return <<-"END".gsub(/\t/, '') > > ! @#{section}{PMID:#{@pubmed}, > > ! author = {#{authors}}, > > ! title = {#{@title}}, > > ! journal = {#{@journal}}, > > ! year = {#{@year}}, > > ! volume = {#{@volume}}, > > ! number = {#{@issue}}, > > ! pages = {#{pages}}, > > ! } > > ! END > > end > > > > --- 290,317 ---- > > # *Arguments*: > > # * (optional) _section_: BiBTeX section as String > > + # * (optional) _keywords_: Array of additional keywords, e.g. ['abstract'] > > # *Returns*:: String > > ! def bibtex(section = nil, add_keywords = []) > > section = "article" unless section > > authors = authors_join(' and ', ' and ') > > pages = @pages.sub('-', '--') > > ! keywords = "author title journal year volume number pages url".split(/ /) > > ! bib = "@#{section}{PMID:#{@pubmed},\n" > > ! (keywords+add_keywords).each do | kw | > > ! if kw == 'author' > > ! ref = authors > > ! elsif kw == 'title' > > ! # strip final dot from title > > ! ref = @title.sub(/\.$/,'') > > ! elsif kw == 'number' > > ! ref = @issue > > ! elsif kw == 'url' > > ! ref = url > > ! else > > ! ref = eval('@'+kw) > > ! end > > ! bib += " #{kw.ljust(12)} = {#{ref}},\n" if ref != '' > > ! end > > ! bib+"}\n" > > end > > > > *************** > > *** 500,503 **** > > --- 499,513 ---- > > end > > > > + # Returns a valid URL for pubmed records > > + # > > + # *Returns*:: String > > + def url > > + if @pubmed != '' > > + cgi = "http://www.ncbi.nlm.nih.gov/entrez/query.fcgi" > > + opts = "cmd=Retrieve&db=PubMed&dopt=Citation&list_uids" > > + return "#{cgi}?#{opts}=#{@pubmed}" > > + end > > + '' > > + end > > > > private > > *************** > > *** 527,530 **** > > --- 537,541 ---- > > end > > > > + > > end > > > > > > _______________________________________________ > > bioruby-cvs mailing list > > bioruby-cvs at lists.open-bio.org > > http://lists.open-bio.org/mailman/listinfo/bioruby-cvs > > > _______________________________________________ > BioRuby mailing list > BioRuby at lists.open-bio.org > http://lists.open-bio.org/mailman/listinfo/bioruby -- mobile nr: 0651172281 (work)