
JackieZhou
New User
Jan 20, 2013, 1:40 PM
Post #1 of 5
(1858 views)
|
Question about merging two files in perl
|
Can't Post
|
|
I have two files, file1 is as below: @HW-ST997:122 AGAT + #11B @HW-ST997:120 GATC + #BCI @HW-ST997:112 AGCT + # :BDI --------------------- Explanation: every four lines represent a sequence, the first line is the head (ID) of that sequence. I have file2 as below: @HW-ST997:120 @HW-ST997:112 @HW-ST997:110 @HW-ST997:108 ------------------------ Explanation: In file2, there are IDs of the sequences. What I want to do is to keep only the sequences in file1 whose IDs can be found in file2. Notice, I want to keep the whole thing, I mean, not only the IDs, but also the 2nd, 3rd, 4th lines for each sequence information. How to implement that in perl? Thank you very much, Jackie
|