Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Branch: master
Fetching contributors…

Cannot retrieve contributors at this time

executable file 40 lines (33 sloc) 0.806 kB
#!/usr/bin/perl
use strict;
my ($USAGE) = "\nUSAGE: $0 <input fastq file> <output fasta file>\n";
if (!defined($ARGV[0]) || !defined($ARGV[1])) {
die $USAGE;
}
# retrieve args
my $fastq = $ARGV[0];
my $fasta = $ARGV[1];
&write_fasta;
sub write_fasta {
my $newline;
my $label;
open(FASTQ, "<$fastq") || die "cannot open fastq file $fastq\n";
open(FASTA, ">$fasta") || die $!;
while(<FASTQ>) {
my $position = tell();
if($_ =~ m/^\@/) {
$_ =~ s/^\@/>/;
chomp;
$newline = <FASTQ>;
chomp($newline);
if(!($newline =~ m/^\@/)) {
#} else {
print FASTA "$_\n$newline\n";
}
seek FASTQ, $position, 0;
}
}
close(FASTQ);
close(FASTA);
print "Done!\n\n";
}
Jump to Line
Something went wrong with that request. Please try again.