~ubuntu-branches/ubuntu/trusty/bioperl/trusty

« back to all changes in this revision

Viewing changes to scripts/utilities/search2BSML.PLS

  • Committer: Package Import Robot
  • Author(s): Charles Plessy
  • Date: 2013-09-22 13:39:48 UTC
  • mfrom: (3.1.11 sid)
  • Revision ID: package-import@ubuntu.com-20130922133948-c6z62zegjyp7ztou
Tags: 1.6.922-1
* New upstream release.
* Replaces and Breaks grinder (<< 0.5.3-3~) because of overlaping contents.
  Closes: #722910
* Stop Replacing and Breaking bioperl ( << 1.6.9 ): not needed anymore. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!perl -w
2
 
 
3
 
# Author:      Jason Stajich <jason-at-bioperl-dot-org>
4
 
# Description: Turn SearchIO parseable report(s) into a GFF report
5
 
#
6
 
=head1 NAME
7
 
 
8
 
search2bsml - Turn SearchIO parseable reports(s) into a BSML report
9
 
 
10
 
=head1 SYNOPSIS
11
 
 
12
 
Usage:
13
 
  search2bsml [-o outputfile] [-f reportformat] [-i inputfilename]  OR file1 file2 ..
14
 
 
15
 
=head1 DESCRIPTION
16
 
 
17
 
This script will turn a protein Search report (BLASTP, FASTP, SSEARCH, 
18
 
AXT, WABA, SIM4) into a BSML File.
19
 
 
20
 
The options are:
21
 
 
22
 
   -i infilename        - (optional) inputfilename, will read
23
 
                          either ARGV files or from STDIN
24
 
   -o filename          - the output filename [default STDOUT]
25
 
   -f format            - search result format (blast, fasta,waba,axt)
26
 
                          (ssearch is fasta format). default is blast.
27
 
   -h                   - this help menu
28
 
 
29
 
Additionally specify the filenames you want to process on the
30
 
command-line.  If no files are specified then STDIN input is assumed.
31
 
You specify this by doing: search2gff E<lt> file1 file2 file3
32
 
 
33
 
=head1 AUTHOR
34
 
 
35
 
Jason Stajich, jason-at-bioperl-dot-org
36
 
 
37
 
=cut
38
 
 
39
 
use strict;
40
 
use Getopt::Long;
41
 
use Bio::SearchIO;
42
 
 
43
 
my ($output,$input,$format,$type,$help,$cutoff);
44
 
$format = 'blast'; # by default
45
 
GetOptions(
46
 
           'i|input:s'  => \$input,
47
 
           'o|output:s' => \$output,
48
 
           'f|format:s' => \$format,
49
 
           'c|cutoff:s' => \$cutoff,
50
 
           'h|help'     => sub{ exec('perldoc',$0);
51
 
                                exit(0)
52
 
                                },
53
 
           );
54
 
# if no input is provided STDIN will be used
55
 
my $parser = new Bio::SearchIO(-format => $format, 
56
 
                               -file   => $input);
57
 
 
58
 
my $out;
59
 
if( defined $output ) {
60
 
    $out = new Bio::SearchIO(-file => ">$output",
61
 
                             -output_format => 'BSMLResultWriter');
62
 
} else { 
63
 
    $out = new Bio::SearchIO(-output_format => 'BSMLResultWriter'); # STDOUT
64
 
}
65
 
 
66
 
while( my $result = $parser->next_result ) {
67
 
    $out->write_result($result);
68
 
}
69