find common entries and match the number with long sequence and cut that sequence in output


Login or Register for Dates, Times and to Reply

 
Thread Tools Search this Thread
# 1  
find common entries and match the number with long sequence and cut that sequence in output

Hi all,

I have a file like this


Code:
ID   3BP5L_HUMAN             Reviewed;         393 AA.
AC   Q7L8J4; Q96FI5; Q9BQH8; Q9C0E3;
DT   05-FEB-2008, integrated into UniProtKB/Swiss-Prot.
DT   05-JUL-2004, sequence version 1.
DT   05-SEP-2012, entry version 71.
FT   COILED       59    140       Potential.
FT   COILED      169    272       Potential.
SQ   SEQUENCE   393 AA;  43499 MW;  3693431765F90FDC CRC64;
     MAELRQVPGG RETPQGELRP EVVEDEVPRS PVAEEPGGGG SSSSEAKLSP REEEELDPRI
     QEELEHLNQA SEEINQVELQ LDEARTTYRR ILQESARKLN TQGSHLGSCI EKARPYYEAR
     RLAKEAQQET QKAALRYERA VSMHNAAREM VFVAEQGVMA DKNRLDPTWQ EMLNHATCKV
     NEAEEERLRG EREHQRVTRL CQQAEARVQA LQKTLRRAIG KSRPYFELKA QFSQILEEHK
     AKVTELEQQV AQAKTRYSVA LRNLEQISEQ IHARRRGGLP PHPLGPRRSS PVGAEAGPED
     MEDGDSGIEG AEGAGLEEGS SLGPGPAPDT DTLSLLSLRT VASDLQKCDS VEHLRGLSDH
     VSLDGQELGT RSGGRRGSDG GARGGRHQRS VSL

The expected output is:

first line: whatever in front of ID 1 alphanumeric number before Human

next lines :whatever in front of "FT "and "coiled" in digits

next lines :search for number mentioned before word coiled and cut the velow sequence accoridngly that

so 59-140 shoul dbe onse ssequence and 169-272 other sequence

Code:
3BP5L
COILED       59    140       
COILED      169    272
MAELRQVPGG RETPQGELRP EVVEDEVPRS PVAEEPGGGG SSSSEAKLSP REEEELDPRI
     QEELEHLNQA SEEINQVELQ LDEARTTYRR ILQESARKLN TQGSHLGSCI EKARPYYEAR
     RLAKEAQQET QKAALRYERA VSMHNAAREM (should belong to number 59-140 although I just did it myself as an example)

VFVAEQGVMA DKNRLDPTWQ EMLNHATCKV
     NEAEEERLRG EREHQRVTRL CQQAEARVQA LQKTLRRAIG KSRPYFELKA QFSQILEEHK
     AKVTELEQQV AQAKTRYSVA LRNLEQISEQ IHARRRGGLP PHPLGPRRSS PVGAEAGPED
     MEDGDSGIEG AEGAGLEEGS SLGPGPAPDT DTLSLLSLRT VASDLQKCDS VEHLRGLSDH
     VSLDGQELGT RSGGRRGSDG GARGGRHQRS VSL(this should belong to number 169-272 although I just did it myself as an example)

in above answers i PUT SEQUENCES JUST AN Example but I want to cut the sequences of these numbers from the whole sequence and write in the output.
# 2  
Is 59 zero based as in start with the 60th character, and is 140 1-based, as in stop with the 140th character (I guss it could be zero-based stop before the cahracter at offset 140)?

The values are indented and divided into groups -- is that what the file looks like? You want the same indentation and division in the output?

ksh/bash can read the 6 fields into an array of variables, save the pairs of numbers in a secondary array, mathematically decompose the numbers into line, field and offset, and compose the output with the same white space. Some line's field values will set a state variable, and the right state begins the field cutting. Initial state says you capture and print from the ID line, second state is look for and print from the FT COILED lines or find SQ SEQUENCE, and SQ SEQUENCE says start looking for the subset of output fields. I assume the COILED lines are forward sequenced.

Last edited by DGPickett; 09-19-2012 at 02:23 PM..
Login or Register for Dates, Times and to Reply

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Extraction of upstream and downstream regions from long sequence file

Hello, here I am posting my query again with modified data input files. see my query is : i have two input files file1 and file2. file1 is smalldata.fasta >gi|546671471|gb|AWWX01449637.1| Bubalus bubalis breed Mediterranean WGS:AWWX01:contig449636, whole genome shotgun sequence... (20 Replies)
Discussion started by: harpreetmanku04
20 Replies

2. Shell Programming and Scripting

Need append sequence number

Hi, Need to add sequnce number to one of the csv file and please find below actual requirement. Input file ABC,500 XXQ,700 ADF,400, ART,200 Out put file should be 1,ABC,500 2,XXQ,700 3,ADF,400, 4,ART,200 (3 Replies)
Discussion started by: siva83
3 Replies

3. Shell Programming and Scripting

Hex number sequence help

Need some help doing this ... with awk maybe Input 0DF6 0DF7 0DF8 0DF9 0DFA 0DFB 0DFC 0DFD 0DFF 0E00 0E01 0E02 0E03 0E04 0E05 0E06 (11 Replies)
Discussion started by: greycells
11 Replies

4. Shell Programming and Scripting

fuzzy sequence match in a text file

Hi Forum: I have struggle with it and decide to use my eye ball to accomplish this. Basically I am looking for sequence of date inside a file. If one of the sequence repeat 2-3 time or skip once; it's still consider a match. input text file: Sep 6 A Sep 6 A Sep 10 A Sep 7 B Sep 8... (7 Replies)
Discussion started by: chirish
7 Replies

5. Shell Programming and Scripting

How to take the missing sequence Number?

Am using unix aix KSH... I have the files called MMRR0106.DAT MMRR0206.DAT MMRR0406.DAT MMRR0506.DAT MMRR0806.DAT .... ... MMRR3006.DAT MMRR0207.DAT These files are in one dircetory /venky ? I want the output like this ? Missing files are : MMRR0306.DAT MMRR0606.DAT... (7 Replies)
Discussion started by: Venkatesh1
7 Replies

6. Shell Programming and Scripting

Perl : print the sequence number without missing number

Dear Perl users, I need your help to solve my problem below. I want to print the sequence number without missing number within the range. E.g. my sequence number : 1 2 3 4 5 6 7 8 11 12 13 14 my desired output: 1 -8 , 11-14 my code below but still problem with the result: 1 - 14 1 -... (2 Replies)
Discussion started by: mandai
2 Replies

7. Shell Programming and Scripting

First number sequence from string

Hi, I have a string like: DBMS stats (Number Used | Percentage of total): 10 | 1.00% I have a sed command to extract numbers from this string: sed "s///g;s/^$/-1/;" Output: 10100 However what I want the sed command to return is only the first number(regardless of its size) i.e.... (3 Replies)
Discussion started by: mccartj5
3 Replies

8. Shell Programming and Scripting

Changing the sequence number

Hi, I have a data as follow: 1 400 2 239 3 871 4 219 5 543 6 ... 7 ... .. ... .. ... 99 818 100 991 I want to replace the sequence number (column 1) that start from 150. The output should like this: 150 400 151 239 (3 Replies)
Discussion started by: nica
3 Replies

9. UNIX for Dummies Questions & Answers

cmd sequence to find & cut out a specific string

A developer of mine has this requirement - I couldn't tell her quickly how to do it with UNIX commands or a quick script so she's writing a quick program to do it - but that got my curiousity up and thought I'd ask here for advice. In a text file, there are some records (about half of them)... (4 Replies)
Discussion started by: LisaS
4 Replies

10. UNIX for Dummies Questions & Answers

sequence number checking

Hi there, I'm wanting to produce a shell script that will check through some file names and identify a skip in sequence (four digit seq num in file name). I have played on the idea of havng a file that has a sorted list of file names which I can read line at a time and cut out the sequence... (1 Reply)
Discussion started by: nhatch
1 Replies

Featured Tech Videos