use strict;
use Maasha::Biopieces;
use Maasha::Common;
+use Maasha::Fastq;
use Maasha::Fasta;
use Maasha::Calc;
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-my ( $options, $in, $out, $index, $tmp_dir, $tmp_in, $tmp_out, $fh_in, $fh_out, $record, $entry, $line, @fields );
+my ( $options, $in, $out, $index, $tmp_dir, $tmp_in, $tmp_out, $fh_in, $fh_out, $record, $entry, $line, @fields, $type, $args );
$options = Maasha::Biopieces::parse_options(
[
while ( $record = Maasha::Biopieces::get_record( $in ) )
{
- if ( $entry = Maasha::Fasta::biopiece2fasta( $record ) ) {
+ if ( $entry = Maasha::Fastq::biopiece2fastq( $record ) )
+ {
+ Maasha::Common::error( "Mixed FASTA and FASTQ entries in stream" ) if defined $type and $type ne "FASTQ";
+ Maasha::Fastq::put_entry( $entry, $fh_out );
+
+ $type = "FASTQ";
+ }
+ elsif ( $entry = Maasha::Fasta::biopiece2fasta( $record ) )
+ {
+ Maasha::Common::error( "Mixed FASTA and FASTQ entries in stream" ) if defined $type and $type ne "FASTA";
Maasha::Fasta::put_entry( $entry, $fh_out );
+
+ $type = "FASTA";
}
Maasha::Biopieces::put_record( $record, $out );
close $fh_out;
+$args = "";
+$args = "-f" if $type eq "FASTA";
+
if ( $options->{ 'verbose' } ) {
- Maasha::Common::run( "bowtie", "-f $index $tmp_in $tmp_out" );
+ Maasha::Common::run( "bowtie", "$args $index $tmp_in $tmp_out" );
} else {
- Maasha::Common::run( "bowtie", "-f $index $tmp_in $tmp_out > /dev/null 2>&1" );
+ Maasha::Common::run( "bowtie", "$args $index $tmp_in $tmp_out > /dev/null 2>&1" );
}
unlink $tmp_in;