[Bioperl-l] Extracting sequences from MySQL DB with Bio::DB::GFF

Darwin Sorento Dichmann dichmann at berkeley.edu
Thu Oct 14 21:16:29 EDT 2010


Greetings, 

I am trying to extract sequences from a MySQL DB with Bio::DB::GFF. The database is the same as I use for my gbrowse2 and it works fine for that. Also, I can extract all sorts of features but not sequence. 

When I run this script I thought I'd get a sequence output but apparently I get the memory address instead. 

I have very little experience with perl or other programming, but I try to follow the directions in the manual. I suspect that I overlook something very basic and any help would be greatly appreciated. 

Thanks,
Darwin 



The script:
------------
#! usr/bin/perl -w
# module to test if Bio::DB::GFF can be used to extract sequences from frog2 database.

use strict;
use Bio::Seq;
use Bio::SeqIO;
use Bio::DB::GFF;

# Open database
my $db = Bio::DB::GFF->
new( 	-adaptor => 'DBI::mysql',
     	-dsn     => 'frog2',
		-user => 'darwin',
		-password => '****',
		);

# fetch scaffold_1 (1-100000)
my $segment = $db->segment('scaffold_1', 1 => 100000) or die;

# get its DNA
 my $dna = $segment->seq or die;
print $segment, "\n";
print $dna,"\n";

# get an iterator on all curated features of type 'exon' or 'intron'
# this prints all exons and intron with transcript name on screen
	my $iterator = $segment->get_seq_stream(-type     => ['mRNA']);
	while (my $s = $iterator->next_seq) {
    print $s,"\n";
}

exit;
---------------

The output:
Macintosh:perlscripts darwin$ perl frog2_parser.pl 
scaffold_1:1,100000
Bio::PrimarySeq=HASH(0x100bb4d68)
mRNA:pick(xt42f011730m)
mRNA:pick(xt42f014902m)
mRNA:pick(xt42f016160m)
mRNA:pick(xt42f017353m)
mRNA:pick(xt42f029332m)
---------------


More information about the Bioperl-l mailing list