使用Bio :: DB :: SeqFeature :: Store从mysql数据库中获取外显子序列

时间:2014-07-02 03:01:50

标签: perl bioinformatics bioperl

我使用“bp_seqfeature_load.pl”将基因组fasta序列及其GFF3文件上传到本地mysql数据库。现在,我想在染色体1的“ - ”链上从位置100-2000提取序列,并且想要在100-2000之间打印具有fasta格式的外显子序列。下面的代码用“+”链从100-2000提取序列。你能好好纠正我的节目吗?我将这个程序用于多个查询(基因组学位置)而不仅仅是一个(100-2000)。

 #!/usr/bin/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";
 }

以下命令用于运行脚本:

./ program.pl -d database_name -u user -p password

感谢您的帮助

0 个答案:

没有答案