I am using the perl script (shuffleSequences_fastq.pl) to prepare the intervaled fastq file for velvet and I got the first read in read1 followed by the first read in read2 BUT then I got 3 different reads of reads 2 followed by their correspondence in read1 and so on- I was wondering if this ok or is this below script right?
a read1
a read2
b read1
b read2
c read2
d read2
c read1
d read1 and so on
shuffleSequences_fastq.pl
#!/usr/bin/perl
if (!@ARGV) {
print "Usage: $0 forward_reads.fa reverse_reaads.fa outfile.fa\n";
print "\tforward_reads.fa / reverse_reads.fa : paired reads to be merged\n";
print "\toutfile.fa : outfile to be created\n";
system.exit(0);
}
$filenameA = $ARGV[0];
$filenameB = $ARGV[1];
$filenameOut = $ARGV[2];
die "Could not open $filenameA" unless (-e $filenameA);
die "Could not open $filenameB" unless (-e $filenameB);
open FILEA, "< $filenameA";
open FILEB, "< $filenameB";
open OUTFILE, "> $filenameOut";
my ($lineA, $lineB);
$lineA = <FILEA>;
$lineB = <FILEB>;
while(defined $lineA) {
print OUTFILE $lineA;
$lineA = <FILEA>;
while (defined $lineA && $lineA !~ m/>/) {
print OUTFILE $lineA;
$lineA = <FILEA>;
}
print OUTFILE $lineB;
$lineB = <FILEB>;
while (defined $lineB && $lineB !~ m/>/) {
print OUTFILE $lineB;
$lineB = <FILEB>;
}
}
a read1
a read2
b read1
b read2
c read2
d read2
c read1
d read1 and so on
shuffleSequences_fastq.pl
#!/usr/bin/perl
if (!@ARGV) {
print "Usage: $0 forward_reads.fa reverse_reaads.fa outfile.fa\n";
print "\tforward_reads.fa / reverse_reads.fa : paired reads to be merged\n";
print "\toutfile.fa : outfile to be created\n";
system.exit(0);
}
$filenameA = $ARGV[0];
$filenameB = $ARGV[1];
$filenameOut = $ARGV[2];
die "Could not open $filenameA" unless (-e $filenameA);
die "Could not open $filenameB" unless (-e $filenameB);
open FILEA, "< $filenameA";
open FILEB, "< $filenameB";
open OUTFILE, "> $filenameOut";
my ($lineA, $lineB);
$lineA = <FILEA>;
$lineB = <FILEB>;
while(defined $lineA) {
print OUTFILE $lineA;
$lineA = <FILEA>;
while (defined $lineA && $lineA !~ m/>/) {
print OUTFILE $lineA;
$lineA = <FILEA>;
}
print OUTFILE $lineB;
$lineB = <FILEB>;
while (defined $lineB && $lineB !~ m/>/) {
print OUTFILE $lineB;
$lineB = <FILEB>;
}
}
Comment