neversaint has asked for the wisdom of the Perl Monks concerning the following question:
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Getting Lines 2,3, and 4 from FASTQ file's Chunk
by BrowserUk (Patriarch) on Apr 16, 2010 at 08:01 UTC | |
|
Re: Getting Lines 2,3, and 4 from FASTQ file's Chunk
by Ratazong (Monsignor) on Apr 16, 2010 at 07:17 UTC | |
|
Re: Getting Lines 2,3, and 4 from FASTQ file's Chunk
by Sinistral (Monsignor) on Apr 16, 2010 at 12:20 UTC | |
|
Re: Getting Lines 2,3, and 4 from FASTQ file's Chunk
by umasuresh (Hermit) on Apr 16, 2010 at 14:22 UTC | |
by johngg (Canon) on Apr 16, 2010 at 20:15 UTC | |
by Anonymous Monk on Mar 22, 2011 at 15:20 UTC |