Retrieving sequence data from other file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Retrieving sequence data from other file
# 1  
Old 10-01-2013
Retrieving sequence data from other file

Hello experts Smilie,

I am new to programming and will need your help.. I have 2 very large files with the following format:

FILE1:
Code:
>MLP1019 PL4
>MLP7456 PL3
>MLP9268 PL9
>MLP6245 PL1

FILE2:
Code:
>MLP1019
STNAPLQTSNTWVSYQPSMMMSLQ
>MLP7456
PPYWYWNSAVMIFYVQPLSLLAVLLA
>MLP9268
WNANWLSPQUVSTQYWFFWFQALN
>MLP6245
TTANPLQYAVWWVSLIFIFPPALQMIF

Does anyone know how I can make an output that looks like below. I need to have the ">MLP____", "PL_", and the sequence corresponding to them.

OUTPUT:
Code:
>MLP1019 PL4
STNAPLQTSNTWVSYQPSMMMSLQ
>MLP7456 PL3
PPYWYWNSAVMIFYVQPLSLLAVLLA
>MLP9268 PL9
WNANWLSPQUVSTQYWFFWFQALN
>MLP6245 PL1
TTANPLQYAVWWVSLIFIFPPALQMIF

Thanks so much in advance!

Last edited by Scrutinizer; 10-01-2013 at 05:19 PM.. Reason: code tags
# 2  
Old 10-01-2013
Using awk:
Code:
 awk 'NR==FNR{A[$1]=$2;next}A[$1]{$2=A[$1]}1' FILE1 FILE2

This User Gave Thanks to Yoda For This Post:
# 3  
Old 10-01-2013
Code:
awk 'NR==FNR {A[$1]=$2; next} ($1 in A) {$1=$1 FS A[$1]} 1' FILE1 FILE2

This User Gave Thanks to MadeInGermany For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help with merge data with a reference sequence

I have two input file.: File 1 is a large reference sequence (A large Fasta sequence); File 1 (is a file which first line is the header description and line other ">" is its corresponding word and counting from 1 till end of file); >Data_1 ASWDADAQTWQQGSAAAAASDAFAFA . . File 2 is... (31 Replies)
Discussion started by: cpp_beginner
31 Replies

2. UNIX for Advanced & Expert Users

Checking missing data's sequence (shell script | UNIX command)

Dear All members, i have some trouble here, i want to ask your help. The case is: I have some data, it's like: -ABCD1234 -ABCD1235 -ABCD1237 -BCDE1111 -BCDE1112 -BCDE1114 there is some missing data's sequence (the format is: ABCD = name 1234 = sequence). I want to print the... (2 Replies)
Discussion started by: septian.tri
2 Replies

3. UNIX for Dummies Questions & Answers

retrieving data between two strings

I have input file like AAA AAA CCC CCC CCC EEE EEE EEE EEE FFF FFF GGG GGG i was trying to retrieve data between two strings using sed. sed -n /CCC/,/FFF/p input_file Am getting output like CCC CCC CCC (22 Replies)
Discussion started by: NareshN
22 Replies

4. Shell Programming and Scripting

Retrieving data from 65th col (of each line) ?

Hello Friends, I am in situation where I have to note down few SQL queries from specific hexdump format. Here is an example (the query text starts at 65th character on each line) ---------------------- 0x000007FEB0E701C0 : 7365 6C65 6374 2063 7573 746E 6F2C 2020 select custno, ... (9 Replies)
Discussion started by: Sunusernewbie
9 Replies

5. Linux

Retrieving Data from VHD File (Virtual Machine Harddrive)

Hello, I had Gentoo installed on a Microsoft Windows Hyper-V virtual machine. The system shutdown properly but the RAID array on the drive it was on failed. We had a backup that was poorly configured and as such we didn't back up all of the data we needed. Therefore, after getting the RAID... (0 Replies)
Discussion started by: ckoeber
0 Replies

6. Shell Programming and Scripting

Retrieving File name

Hi All.. I have a Filename as FAB1_600015_CONRAD.A0_7XYZ12345.000_LT-SWET.01_LTPA25L_20110622-161429_07_WFR12345_20110622-161429_20110712-125228.data.dis I want to get the result as... (5 Replies)
Discussion started by: asheshrocky
5 Replies

7. UNIX and Linux Applications

Retrieving data from a database and store to a file

Hi I'm using and Oracle 10g Database. I want to write a script to retrieve data from the database and store it toa file. I'm using simple sql statements such as Select * from celltable I don't know how to specify the database name etc. I have this but it doesn't work ... (1 Reply)
Discussion started by: ladyAnne
1 Replies

8. UNIX for Dummies Questions & Answers

Retrieving PID from a file

Hello I need to retrieve the content of a file in the shell script file(.sh file). I store the Process ID of the a process in file.Only the PID is available in that file. Inside the shell script i want to retireve the content(PID) and need to check for the existence of the Process.Basically... (5 Replies)
Discussion started by: appleforme1415
5 Replies

9. Shell Programming and Scripting

Using loop reading a file,retrieving data from data base.

Hi All, I am having trouble through, I am reading the input from tab delimited file containing several records, e.g. line1 field1 field2 field3 so on.. line2 field1 field2 field3 so on.. .. .. on the basis of certain fields for each record in input file, I have to retrieve... (1 Reply)
Discussion started by: Sonu4lov
1 Replies

10. UNIX for Dummies Questions & Answers

Retrieving data

Friends, I have a data with 3 columns: 30 41 1 39 19 4 14 25 3 .... .... ..... I want to retrieve any data in the first column that is greater 15. What is the best way to do this? Thanks! (2 Replies)
Discussion started by: bobo
2 Replies
Login or Register to Ask a Question