blib/script/gff_to_bed.pl untested

filter: Statementstmt 0.0% 0 / 44 Branchbran 0.0% 0 / 12 Conditioncond 0.0% 0 / 3 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 9 Podpod n/a totaltotal 0.0% 0 / 68 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 #!/usr/bin/env perl
2  
3 use warnings;
4 use strict;
5  
6 use Data::Dumper;
7 use Carp;
8  
9 use 5.010;
10  
11 use SolCompara;
12 use Bio::Gonzales::Feat::IO::GFF3;
13 use Bio::Gonzales::Feat::IO::BED;
14  
15 use Getopt::Long qw(:config auto_help);
16 my ( $parent, $child ) = qw/mRNA exon/;
17  
18 my $verbose;
19 my $track_name;
20 GetOptions(
21 "track_name=s" => \$track_name,
22 "parent_type=s" => \$parent,
23 "child_type=s" => \$child,
24 'verbose' => \$verbose
25 );
26  
27 my ( $infile, $outfile ) = @ARGV;
28 die "$infile is no file" unless ( -f $infile );
29  
30 ($track_name = $infile) =~ s/\W/_/g unless($track_name);
31  
32 my $gffin = Bio::Gonzales::Feat::IO::GFF3->new( file => $infile, );
33  
34 my $bedout = Bio::Gonzales::Feat::IO::BED->new(
35 ( $outfile ? ( file => $outfile ) : ( fh => \*STDOUT ) ),
36 mode => '>',
37 track_name => $track_name
38 );
39  
40 while ( my $f = $gffin->next_feat ) {
41 next unless ( $f->type eq $parent || $f->type eq $child );
42 print STDERR "." if ($verbose);
43 $bedout->write_feat($f);
44 }
45 $bedout->close;
46  
47 print "\n" if ($verbose);