awk special parse case


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting awk special parse case
# 1  
Old 03-17-2015
awk special parse case

I have a special case that awk could be used but I do not have the skill. Trying to create a final output file (indel_parse.txt) that is created from using some information from each of the two files (attached).

Code:
 parse rules:
The header is skipped  FNR>1
1. 4 zeros after the NC_  (not always the case) and the digits before the .        [$1 in indel_name.txt] - NM_004004.5:c.34_35delGGinsT
2. g. ### (before underscore)  _### (# after the _)  [$3 in indel_position.txt] - NC_000013.10:g.20763686_20763687delinsA
3. letters after "del"
4. letters after "ins" 
  
Desired Output in indel_parse.txt:
13      20763686     20763687     GG     T

Thank you Smilie.

Last edited by cmccabe; 03-17-2015 at 02:52 PM..
# 2  
Old 03-17-2015
Sorry, that spec is inconsistent and I can't see how you get to the desired output neither from the strings given nor from the attached files. There's an NM_004004.5:c.34_35delGGinsT holding a GGinsT but contradicting condition 1. And an NC_000013.10:g.20763686_20763687delinsA that holds only an A but no GG nor T .
And, which set in the files should be selected?
# 3  
Old 03-17-2015
There is information needed in each file that is combined into an indel_parse.txt file.

Code:
From the indel_name.txt ($1)
                     4    5
NM_004004.5:c.34_35delGGinsT - 4 and 5 parsed out
 
From indel_position.txt ($3)
    1        2         3
NC_000013.10:g.20763686_20763687delinsA - 1 2 3 parsed out
 
output (indl_parse.txt) 1     2      3     4      5 combined tab deliminated
 
1         2              3       4     5 
13     20763686     20763687     GG     T 

Is there a way to create a hash of each field and then parse the desired info. from each hash, then combine them in the output? Thank you Smilie.

Last edited by cmccabe; 03-17-2015 at 04:17 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Special case to skip function in bash menu

In the bash menu below if the variant that is inputted is in the format NM_004004.3:c.274G>T the below works perfectly. My question is if the variant inputted isNM_004004.3:-c.274G>T or NM_004004.3:+c.274G>T then the code as is will throw an error due to a biological issue. Is it possible to to... (1 Reply)
Discussion started by: cmccabe
1 Replies

2. Shell Programming and Scripting

awk script to parse case with information in two fields of file

The below awk parser works for most data inputs, but I am having trouble with the last one. The problem is in the below rules steps 1 and 2 come from $2 (NC_000013.10:g.20763686_20763687delinsA) and steps 3 and 4 come from $1 (NM_004004.5:c.34_35delGGinsT). Parse Rules: The header is... (0 Replies)
Discussion started by: cmccabe
0 Replies

3. Shell Programming and Scripting

Row to columns - special case

Hi. Let me start saying that i am kinda new to bash, and have few skills in programming. I've been advised to use bash to manipulate large .csv files. I've been able to do some data filtering using fors, grep and tail commands. That was kinda easy seeing examples. But now i need to do some hard... (1 Reply)
Discussion started by: jmarmitt
1 Replies

4. Shell Programming and Scripting

Check input for lenght, special characters and letter case

I made menu script for users so they can run other script without going in shell just from menu. But i must control their input. These are criteria: Input must have 4 signs First two signs are always lower case letters Input shall not have some special signs just letters and numbers ... (1 Reply)
Discussion started by: waso
1 Replies

5. Shell Programming and Scripting

parse special character in the line

Hi all, I have a file with some module names as below. Font::AFM Data::Grove ---> libxml-perl Net::LDAP ---> perl-ldap DBI XML .... ... .... and so on ... The file has some lines with the character " -->" . Now how can I cut only the last column of the line wherever "-->" is... (4 Replies)
Discussion started by: vijaya2006
4 Replies

6. Shell Programming and Scripting

Parse file using awk and work in awk output

hi guys, i want to parse a file using public function, the file contain raw data in the below format i want to get the output like this to load it to Oracle DB MARWA1,BSS:26,1,3,0,0,0,0,0.00,22,22,22.00 MARWA2,BSS:26,1,3,0,0,0,0,0.00,22,22,22.00 this the file raw format: Number of... (6 Replies)
Discussion started by: dagigg
6 Replies

7. Shell Programming and Scripting

parse a file for a special character

hello, How to parse a file to see if a specific line is commented by '#' character? filename: file1 cat file1 ... # /usr/bin/whatever ... thank you (9 Replies)
Discussion started by: melanie_pfefer
9 Replies

8. UNIX for Dummies Questions & Answers

rename more files special case

hello all i have a big problems for me if i have more files as example test.ghrt.part01.rar test.ghrt.part02.rar test.ghrt.part03.rar test.ghrt.part04.rar test.ghrt.part05.rar test.ghrt.part06.rar test.ghrt.part07.rar test.ghrt.part08.rar test.ghrt.part09.rar test.ghrt.part10.rar... (13 Replies)
Discussion started by: ateya
13 Replies

9. SCO

Avoiding duplicates with some special case

Hi Gurus, I had a question regarding avoiding duplicates.i have a file abc.txt abc.txt ------- READER_1_1_1> HIER_28056 XML Reader: Error occurred while parsing:; line number ; column number READER_1_3_1> Sun Mar 23 23:52:48 2008 READER_1_3_1> HIER_28056 XML Reader: Error occurred while... (0 Replies)
Discussion started by: pssandeep
0 Replies

10. UNIX for Dummies Questions & Answers

how to delete whole directory in special case

Hello, Today, as a root user, i want to copy recursively all files and diretories in a source directory to a destination directory using the following command, cp -r /home/smith/* /home/bob/ However, I carelessly missed the '*' out when I executed the command. Now, i noticed a... (1 Reply)
Discussion started by: cy163
1 Replies
Login or Register to Ask a Question