~ubuntu-branches/ubuntu/saucy/bioperl/saucy-proposed

« back to all changes in this revision

Viewing changes to scripts/Bio-SeqFeature-Store/bp_seqfeature_gff3.PLS

  • Committer: Bazaar Package Importer
  • Author(s): Charles Plessy
  • Date: 2009-03-10 07:19:11 UTC
  • mfrom: (1.2.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20090310071911-fukqzw54pyb1f0bd
Tags: 1.6.0-2
* Removed patch system (not used):
  - removed instuctions in debian/rules;
  - removed quilt from Build-Depends in debian/control.
* Re-enabled tests:
  - uncommented test command in debian/rules;
  - uncommented previously missing build-dependencies in debian/control.
  - Re-enabled tests and uncommented build-dependencies accordingly.
* Removed libmodule-build-perl and libtest-harness-perl from
  Build-Depends-Indep (provided by perl-modules).
* Better cleaning of empty directories using find -type d -empty -delete
  instead of rmdir in debian/rules (LP: #324001).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env perl
 
2
# $Id: bp_seqfeature_gff3.PLS 15088 2008-12-04 02:49:09Z bosborne $
 
3
# AUTHOR: malcolm.cook@stowers-institute.org
 
4
 
 
5
use strict;
 
6
 
 
7
use Getopt::Long;
 
8
use File::Spec;
 
9
use Bio::DB::SeqFeature::Store;
 
10
 
 
11
#use Carp::Always;
 
12
 
 
13
my $DSN;
 
14
my $ADAPTOR;
 
15
my $VERBOSE  = 1;
 
16
my $USER     = '';
 
17
my $PASS     = '';
 
18
my @gff3opt;
 
19
 
 
20
GetOptions(
 
21
           'dsn=s'       => \$DSN,
 
22
           'adaptor=s'   => \$ADAPTOR,
 
23
           'user=s'      => \$USER,
 
24
           'password=s'  => \$PASS,
 
25
           'gff3opt=i{,}'    => \@gff3opt,
 
26
          ) || die <<END;
 
27
Usage: $0 [options] -- [WHICH FEATURES]
 
28
  output GFF3 for selected database features
 
29
  Options:
 
30
          -d --dsn        The database name ($DSN)
 
31
          -a --adaptor    The storage adaptor to use ($ADAPTOR)
 
32
          -u --user       User to connect to database as
 
33
          -p --password   Password to use to connect to database
 
34
          -g --gff3opt    flag options to gff3_string (i.e.: pass -gffopt 1 to recurse)
 
35
 
 
36
         WHICH FEATURES: any remaining options after '--' will select
 
37
         a subset of features. The arguments are identical to those
 
38
         accepted by Bio::DB::SeqFeature::Store->features().
 
39
 
 
40
END
 
41
 
 
42
$ADAPTOR     ||= 'DBI::mysql';
 
43
$DSN         ||= $ADAPTOR eq 'DBI::mysql' ? "mysql_read_default_file=$ENV{HOME}/.my.cnf" : '';
 
44
 
 
45
my $store = Bio::DB::SeqFeature::Store->new(
 
46
                                            -dsn     => $DSN,
 
47
                                            -adaptor => $ADAPTOR,
 
48
                                            -user    => $USER,
 
49
                                            -pass    => $PASS,
 
50
                                           )
 
51
  or die "Couldn't create connection to the database";
 
52
 
 
53
# on signals, give objects a chance to call their DESTROY methods
 
54
$SIG{TERM} = $SIG{INT} = sub {   undef $store; die "Aborted..."; };
 
55
 
 
56
my $seq_stream = $store->get_seq_stream(@ARGV)  or die "failed to get_seq_stream(@ARGV)"; 
 
57
while (my $seq = $seq_stream->next_seq) {
 
58
  print $seq->gff3_string(@gff3opt) . "\n";
 
59
}
 
60
 
 
61
exit 0;