in reply to Getting Lines 2,3, and 4 from FASTQ file's Chunk

Another simple solution:
use strict; use warnings; while(<DATA>) { chomp; my $line = $_; # skip the first line of every chunk if ($line =~/^@/) { } # print the remaining lines else { print "$line\n"; } } __DATA__ @SRR016086.1 308GJAAXX:2:1:911:957 length=36 CCCCCCCCCCACCCCCCCACACCACAAACACACCAC +SRR016086.1 308GJAAXX:2:1:911:957 length=36 (IIIIIIII:&H68;I-3%/)*-/4$$')(0&$&,$ @SRR016086.2 308GJAAXX:2:1:916:735 length=36 AGATCAGTTTTGCACTCCACTTAAGTTTGTTCATAT +SRR016086.2 308GJAAXX:2:1:916:735 length=36 I*IIIIIIIIIII%%CI()I2E6.I5;>+"=C+#%I @SRR016086.3 308GJAAXX:2:1:908:956 length=36 CCCCCCCCCAACACAAAAACAAAATCCAAAACAATA +SRR016086.3 308GJAAXX:2:1:908:956 length=36 II@III50I*9I+<00%.<9/,%-"$*2('&"&)""

Replies are listed 'Best First'.
Re^2: Getting Lines 2,3, and 4 from FASTQ file's Chunk
by johngg (Canon) on Apr 16, 2010 at 20:15 UTC

    It is a simple solution but it would be even simpler if you avoided the un-necessary chomp and assignment to $line, and used an unless statement modifier. I don't know if it is safe to assume that every record begins with an "@" symbol.

    while ( <DATA> ) { print unless m{^\@}; }

    I hope this is of interest.

    Cheers,

    JohnGG

Re^2: Getting Lines 2,3, and 4 from FASTQ file's Chunk
by Anonymous Monk on Mar 22, 2011 at 15:20 UTC
    Skipping lines based on '@' at the start is dangerous as quality values (line 4) can be '@'!