[BioRuby] Parse string containing GenBenk file?
Naohisa Goto
ngoto at gen-info.osaka-u.ac.jp
Fri Aug 17 04:30:27 UTC 2007
Hi,
If you have a string with single GenBank entry,
you can use Bio::GenBank.new(string).
For example,
require "bio"
str = <<__EOF__
LOCUS A00001 335 bp DNA linear PAT 11-MAY-2001
DEFINITION Cauliflower mosaic virus satellite cDNA.
ACCESSION A00001
VERSION A00001.1 GI:58418
KEYWORDS .
SOURCE Cauliflower mosaic virus
ORGANISM Cauliflower mosaic virus
Viruses; Retro-transcribing viruses; Caulimoviridae; Caulimovirus.
REFERENCE 1 (bases 1 to 335)
AUTHORS Baulcombe,D.C., Mayo,M.A., Harrison,B.D. and Bevan,M.W.
TITLE Modification of plant viruses or their effects
JOURNAL Patent: EP 0242016-A 1 21-OCT-1987;
AGRICULTURAL GENETICS COMPANY LIMITED
FEATURES Location/Qualifiers
source 1..335
/organism="Cauliflower mosaic virus"
/mol_type="unassigned DNA"
/db_xref="taxon:10641"
misc_feature 1..335
/note="satellite DNA"
ORIGIN
1 gttttgtttg atggagaatt gcgcagaggg gttatatctg cgtgaggatc tgtcactcgg
61 cggtgtggga tacctccctg ctaaggcggg ttgagtgatg ttccctcgga ctggggaccg
121 ctggcttgcg agctatgtcc gctactctca gtactacact ctcatttgag cccccgctca
181 gtttgctagc agaacccggc acatggttcg ccgataccat ggaatttcga aagaaacact
241 ctgttaggtg gtatgagtca tgacgcacgc agggagaggc taaggcttat gctatgctga
301 tctccgtgaa tgtctatcat tcctacacag gaccc
//
__EOF__
gb = Bio::GenBank.new(str)
p gb
If you have a string with multiple entries,
or the string might be other than GenBank (e.g. EMBL.),
using StringIO is better.
require 'stringio'
Bio::FlatFile.auto(StringIO.new(string))
Regards,
Naohisa Goto
ngoto at gen-info.osaka-u.ac.jp / ng at bioruby.org
> Can anyone point me to a method for creating a Bio object from a
> string that contains a Genbank file?
>
> For example, I have a Genbank file and its contents have been read
> into a single string. I am unable to use Bio::FlatFile.auto(string)
> to create a Bio object.
>
> Thanks for the help,
> Karsten
> _______________________________________________
> BioRuby mailing list
> BioRuby at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioruby
More information about the BioRuby
mailing list