Skip to content

Commit

Permalink
fix fasta/fastq from being determined from file name
Browse files Browse the repository at this point in the history
  • Loading branch information
teharrison committed Oct 20, 2014
1 parent 47e5766 commit 2f5e0e1
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 11 deletions.
2 changes: 1 addition & 1 deletion awecmd/awe_preprocess.pl
Expand Up @@ -90,7 +90,7 @@
}
}
# run cmd
PipelineAWE::run_cmd("filter_sequences -i $input_file -o $passed_seq -r $removed_seq $cmd_options");
PipelineAWE::run_cmd("filter_sequences -i $input_file -format $format -o $passed_seq -r $removed_seq $cmd_options");
}

# get stats
Expand Down
2 changes: 1 addition & 1 deletion awecmd/submit_to_awe.pl
Expand Up @@ -339,7 +339,7 @@
$ares = $json->decode($apost->content);
};
if ($@) {
print STDERR "ERROR: Return from shock is not JSON:\n".$apost->content."\n";
print STDERR "ERROR: Return from AWE is not JSON:\n".$apost->content."\n";
exit 1;
}
if ($ares->{error}) {
Expand Down
26 changes: 17 additions & 9 deletions bin/filter_sequences
Expand Up @@ -10,9 +10,10 @@ use File::Basename;

# read in parameters
my $infile = '';
my $format = '';

my $fasta_infile = '';
my $fastq_infile = '';
my $fasta_infile = 0;
my $fastq_infile = 0;

my $filter_ln = '';
my $filter_ambig = '';
Expand All @@ -29,7 +30,8 @@ my $fasta_out = '';
my $fasta_reject = '';

GetOptions (
'i=s' => \$infile ,
'i=s' => \$infile,
'format=s' => \$format,

'filter_ln' => \$filter_ln,
'filter_ambig' => \$filter_ambig,
Expand Down Expand Up @@ -70,13 +72,19 @@ my $usage = "
";

# identify file type from extension
&check_filenames($usage, $infile, $fasta_out, $fasta_reject);
if ( $infile =~ /\.fn?a$|\.fasta$/i) {
$fasta_infile = 1;
}
elsif ( $infile =~ /\.fastq$|\.fq$/i) {
$fastq_infile = 1;
# identify file type
if ( $format eq 'fasta' ) {
$fasta_infile = 1;
} elsif ( $format eq 'fastq' ) {
$fastq_infile = 1;
} else {
if ( $infile =~ /\.fn?a$|\.fasta$/i) {
$fasta_infile = 1;
}
elsif ( $infile =~ /\.fastq$|\.fq$/i) {
$fastq_infile = 1;
}
}

# check that input arguments are OK
Expand Down

0 comments on commit 2f5e0e1

Please sign in to comment.