annotate sff_to_fastq_converter.pl @ 3:bf1f8bc4abe6 default tip

minor updates for v2.6
author eskirton@lbl.gov
date Wed, 21 Dec 2011 19:42:53 -0800
parents 2d86d5b112e8
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
1 #!/usr/bin/env perl
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
2
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
3 use warnings;
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
4 use strict;
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
5 use Getopt::Long;
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
6 use File::Basename;
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
7
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
8 # VALIDATE INPUT
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
9 die("Expected 3 args") unless @ARGV == 3;
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
10 my ($sff, $extra_files_path, $fastq) = @ARGV;
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
11
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
12 # DEFINE PATHS
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
13 mkdir($extra_files_path) unless -d $extra_files_path;
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
14 my $base = basename($sff);
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
15 my $fasta = "$extra_files_path/$base.fasta";
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
16 my $qual = "$extra_files_path/$base.qual";
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
17
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
18 # GENERATE FASTA, QUAL, FASTQ
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
19 my $outf;
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
20 my $out;
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
21 eval { $out=`sffinfo -seq $sff > $fasta` };
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
22 die("ERROR: $out") if $@;
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
23 print $out;
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
24 eval { $out=`sffinfo -qual $sff > $qual` };
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
25 die("ERROR: $out") if $@;
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
26 print $out;
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
27 eval { $out=`fasta_qual_to_fastq $fasta $qual $fastq` };
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
28 die("ERROR: $out") if $@;
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
29 print $out;
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
30 unlink($fasta, $qual);
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
31 exit 0;