File: waba2gff.pl

package info (click to toggle)
bioperl 1.7.8-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 35,788 kB
  • sloc: perl: 94,019; xml: 14,811; makefile: 20
file content (34 lines) | stat: -rw-r--r-- 779 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/perl
use strict;
use Bio::SearchIO;
use Getopt::Long;
use Benchmark;

my ($infile,$outfile,$verbose);

GetOptions( 
	    'i|input:s'  => \$infile,
	    'o|output:s' => \$outfile,
	    'v|verbose'  => \$verbose,
	    );
$infile = shift unless $infile;

my $in = new Bio::SearchIO(-format => 'waba',
			   -file   => $infile, #comment out to read from STDIN
                           #-fh => \*ARGV,  # uncomment to read from STDIN
			   -verbose => $verbose);

my $out;
if( defined $outfile) {
    $out = new Bio::Tools::GFF(-file => ">$outfile");
} else {
    $out = new Bio::Tools::GFF(-verbose => $verbose);
}

while( my $r = $in->next_result ) {
    while( my $hit = $r->next_hit ) {
	while( my $hsp = $hit->next_hsp ) {
	    $out->write_feature($hsp);
	}
    }
}