-
Notifications
You must be signed in to change notification settings - Fork 2
/
fqConverter.pl
executable file
·40 lines (33 loc) · 1.09 KB
/
fqConverter.pl
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
35
36
37
38
39
40
#!/bin/env perl
use 5.010;
use strict;
use warnings;
use Bio::SeqIO;
use Bio::Seq::Quality;
use Getopt::Long;
use File::Basename;
my $scriptName = (fileparse($0))[0];
my ($source, $target)=('fastq-illumina','fastq');
GetOptions(
's|source=s' => \$source,
't|target=s' => \$target,
'h|help' => sub{usage()}
);
$ARGV[0]='/dev/stdin' unless defined $ARGV[0];
my $in = Bio::SeqIO->new(-format => $source, -file => "$ARGV[0]");
my $out= Bio::SeqIO->new(-format => $target, -file => ">/dev/stdout");
while(my $data = $in->next_dataset){
$out->write_seq(Bio::Seq::Quality->new(%$data));
}
sub usage{
print <<HELP;
Usage: perl $scriptName input.fq >output.fq
If input.fq isn't specified, input from STDIN
If output.fq isn't specified, output to STDOUT
Option:
-s --source STR The quality format of your source fastq file ([fastq-illumina], fastq-solexa, fastq)
-t --target STR The quality format of your target fastq file (fastq-illumina, fastq-solexa, [fastq])
-h --help This help information screen
HELP
exit(-1);
}