[Bioperl-l] Extracting the exon sequence of genome from GBrowse database

firoz.imtech at gmail.com firoz.imtech at gmail.com
Tue Jul 1 21:20:29 UTC 2014


Dear All,
I have uploaded genomic fasta sequence and its GFF3 file into local mysql 
database using "bp_seqfeature_load.pl".
I want to extract sequence from position 100-2000 on "-" strand of 
Chromosome I, and want to print only sequence from 
exon between 100-2000, with fasta format. My code extracting the sequence 
from 100-2000 with "+" strand. I would appreciate If anyone could kindly correct 
this program.

Command used to run program "./program.pl -d database -u user -p password"

#!/usr/bin/env perl
use Getopt::Long;
use File::Spec;
use Bio::DB::SeqFeature::Store;
use Bio::SeqIO;
#use Carp::Always;

my $DSN;
my $ADAPTOR;
my $VERBOSE  = 1;
my $USER     = '';
my $PASS     = '';
my @gff3opt;
my @information;
GetOptions(
           'dsn=s'       => \$DSN,
           'adaptor=s'   => \$ADAPTOR,
           'user=s'      => \$USER,
           'password=s'  => \$PASS,
           'gff3opt=i{,}'    => \@gff3opt,
          ) || die <<END;

  Options:
          -d --dsn        The database name ($DSN)
          -a --adaptor    The storage adaptor to use ($ADAPTOR)
          -u --user       User to connect to database as
          -p --password   Password to use to connect to database
          -g --gff3opt    flag options to gff3_string (i.e.: pass -gffopt 1 
to recurse)

END
$ADAPTOR     ||= 'DBI::mysql';
$DSN         ||= $ADAPTOR eq 'DBI::mysql' ? 
"mysql_read_default_file=$ENV{HOME}/.my.cnf" : '';

my $store = Bio::DB::SeqFeature::Store->new(
                                            -dsn     => $DSN,
                                            -adaptor => $ADAPTOR,
                                            -user    => $USER,
                                            -pass    => $PASS,
                                           )
  or die "Couldn't create connection to the database";

# on signals, give objects a chance to call their DESTROY methods
$SIG{TERM} = $SIG{INT} = sub {   undef $store; die "Aborted..."; };
@information = $store->fetch_sequence(-seqid=>'I',-start=>100,-end=>2000);
for my $f (@information){

    print "$f\n";
}

Thanks a lot.

Firoz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.open-bio.org/pipermail/bioperl-l/attachments/20140701/71c9851e/attachment.html>


More information about the Bioperl-l mailing list