newbie25 has asked for the wisdom of the Perl Monks concerning the following question:
File 2 is the complement of 1 and looks like this (its a quality assessment of the above data):>GK9PVB108JH8SN rank=0000021 x=3781.0 y=885.0 length=137 TGATTATGAGTTAGATGTTCGCTCTGAGGTTTCAACGATGCTTCAAGATTCCTAATTCGC GTTGCGACTCTCGAGTATGCGTTCTATTCACATTTCTGTTGTCGTACATATTTGACTCAC GATCTTGATTTCTTATC <br> >GK9PVB108JYDQ5 rank=0000032 x=3965.0 y=143.0 length=53 GTTTTCAACGCTGGTTCGAGATTTCCTAATTTCACATTGCGACTCTCGAGTGC
What I want is a file that combines these to put the quality data under the corresponding sequence>GK9PVB108JH8SN rank=0000021 x=3781.0 y=885.0 length=137 40 38 38 30 30 30 38 40 40 30 30 30 36 40 40 40 40 40 40 40 40 40 40 4 +0 39 34 34 14 14 14 14 13 19 14 18 25 32 32 34 27 >GK9PVB108JYDQ5 rank=0000032 x=3965.0 y=143.0 length=53 25 21 21 23 23 37 31 31 31 37 37 39 38 40 40 40 40 40 40 40 40 39 39 3 +9 39 35 23 25 25 37 34 35 36 37 37 37 37 37 39 39 40 40 40 40 39 38 3 +5 33 33 33 32 31 19
The script I have written is:eg: >GK9PVB108JYDQ5 rank=0000032 x=3965.0 y=143.0 length=53 GTTTTCAACGCTGGTTCGAGATTTCCTAATTTCACATTGCGACTCTCGAGTGC >GK9PVB108JYDQ5 rank=0000032 x=3965.0 y=143.0 length=53 25 21 21 23 23 37 31 31 31 37 37 39 38 40 40 40 40 40 40 40 40 39 39 3 +9 39 35 23 25 25 37 34 35 36 37 37 37 37 37 39 39 40 40 40 40 39 38 3 +5 33 33 33 32 31 19
The problem is that this adds the second file line by line into the first file instead of underneath it. eg:use warnings; use strict; open( F1, "subsettest.txt" ) or die "file1: $!"; open( F2, "subsettest1.txt" ) or die "file2: $!"; while ( my$s1 = <F1> ) { my$s2 = <F2>; if ( $s1 =~ /^>/ ) { print $s1; } else { chomp $s1; print "$s1\n$s2"; } } close F1; close F2; exit;
What am I missing?!?!!>GK9PVB108I6QD3 rank=0000053 x=3650.5 y=393.0 length=71 ACACTTTAGCGGGACATTATTACAAGAAGGTACCTGAACCACATCGGGTTTCCTTGCTTC 40 40 38 34 21 21 21 30 36 40 35 33 33 36 32 32 33 29 28 26 26 28 31 2 +6 26 31 24 24 23 23 34 25 27 27 32 32 22 22 22 23 32 32 34 34 34 19 1 +9 19 27 26 26 16 16 14 14 29 29 27 27 31 TTCAACGGTAA
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: combine 2 fasta files into 1
by NetWallah (Canon) on Jul 30, 2010 at 20:25 UTC | |
Re: combine 2 fasta files into 1
by BioLion (Curate) on Jul 31, 2010 at 10:06 UTC | |
Re: combine 2 fasta files into 1
by Generoso (Prior) on Jul 30, 2010 at 21:21 UTC | |
by Generoso (Prior) on Jul 30, 2010 at 21:34 UTC | |
by newbie25 (Initiate) on Jul 30, 2010 at 22:58 UTC | |
by Generoso (Prior) on Aug 03, 2010 at 17:45 UTC |