What I want to do is to extract line 2, 3 and 4 of each chunk from the above file. I've tried Bioperl with this script but fail:@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('&"&)""
Nor with my attempted homebrew method, in which I'm stuck with the logic.use Bio::SeqIO; my $file = $ARGV[0] || "test.fastq"; my $in = Bio::SeqIO->new(-file => $file , '-format' => 'fastq'); while ( my $seq = $in->next_seq() ) { print "$seq->id\n"; }
What's the right way to do it?my $INFILE_file_name = $file; # input file name open ( INFILE, '<', $INFILE_file_name ) or croak "$0 : failed to open input $INFILE_file_name : $!\n"; my $count = 0; my $seqlinec = 2; while ( <INFILE> ) { chomp; # Trying to catch line 2 of each chunk.. if ( $seqlinc eq $count ) { print "$_\n"; } $seqlinec += 4; } close ( INFILE ); # close input file
In reply to Getting Lines 2,3, and 4 from FASTQ file's Chunk by neversaint
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |