Fetch entries with tags with editing in existing code


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Fetch entries with tags with editing in existing code
# 1  
Old 10-31-2012
Fetch entries with tags with editing in existing code

Hi all

I have to make some changes in the following code to fetch some more entries in the attached file.

Code:
awk 'k>0 {if (a[k] && k==2) { print a[1]":"a[2]":"a[3]; a[1]=a[2]=a[3]="";} a[k]=a[k]?a[k]" "$0:$0; k=0;} /^# Drug_Target_.*_Gene_Name/ {k=3;} /^# Generic/ {k=1;} /^# Brand_Name/ {k=2;} END {if (a[1]) print a[1]" "a[2]" "a[3];}' drug_bank.dat

Using above code, I am able to fetch Drug target gene name and brand name and generic names in front of those targets name but I also want to fetch following entries in front of brand name and generic name

# Mechanism_Of_Action:
# Description:
# Indication:
# Pharmacology:

I have tried to make changes but not working. Kindly guide if possible.
# 2  
Old 10-31-2012
Please convert the DOC file to a TXT file. I'm not going to load OpenOffice just for that.
This User Gave Thanks to cfajohnson For This Post:
# 3  
Old 10-31-2012
Request to check text file

Hi sir,


Kindly check the attached text file.

Mani
# 4  
Old 10-31-2012
Quote:
Originally Posted by manigrover
Hi all

I have to make some changes in the following code to fetch some more entries in the attached file.

Code reformated for legibility.
Quote:

Code:
awk '
k > 0 {
   if (a[k] && k==2) {
        print a[1]":"a[2]":"a[3]; a[1]=a[2]=a[3]=""
        }
   a[k]=a[k]?a[k]" "$0:$0; k=0
   }

/^# Drug_Target_.*_Gene_Name/ { k = 3 }
/^# Generic/ { k = 1 }
/^# Brand_Name/ { k = 2 }

END {
  if ( a[1] ) print a[1]" "a[2]" "a[3]
}
' drug_bank.dat

Using above code, I am able to fetch Drug target gene name and brand name and generic names in front of those targets name but I also want to fetch following entries in front of brand name and generic name

All that code produces for me is:
Code:
:F2fludan
 EGFR2Cxb

What, exactly, are you trying to do?
# 5  
Old 10-31-2012
Hi


Using above code, I received a file containing list with following information from each drug card mentioned in the attached file

# Drug_Target_.*_Gene_Name # Generic Name # Brand_Name

but I also want to fetch following entries in front of brand name and generic name

Description

Indication

Mechanism of action

Pharmacology


from each drug card.

so output will have four other columns with list of information as well with above information
# 6  
Old 10-31-2012

Your code doesn't produce anything like that when I run it on your file.

The first thing you should do is write code to output the data you want.

Once that is working, add code to format it.
# 7  
Old 10-31-2012
Request to check

Hi

My code is producing following results when I checked


In this output first name is generic name, second name is brand name and third name is drug gene target name. I want to put the description, indication, pharmacology and mechanism of action in front of of each row.

May be I have given u only small part of my big file therefore its not producing whole result but all othe things are fine.

Code:
Lepirudin:Refludan:F2
Cetuximab:Erbitux:FCGR2A FCGR2B FCGR2C EGFR FCGR3B C1R C1QA C1QB C1QC FCGR3A C1S FCGR1A
Dornase Alfa:Pulmozyme:Not Available
Denileukin diftitox:Ontak:IL2RA IL2RB IL2RG
Etanercept:Enbrel:C1S C1R C1QA C1QB C1QC TNF TNFRSF1B FCGR1A FCGR3A FCGR2A FCGR2B FCGR2C LTA FCGR3B
Bivalirudin:Angiomax:F2
Leuprolide:Eligard:GNRHR
Peginterferon alfa-2a:Pegasys:IFNAR2 IFNAR1
Alteplase:Activase (Genentech Inc):PLG FGA PLAUR SERPINE1
Sermorelin:Geref:GHRHR
Interferon alfa-n1:Wellferon (GlaxoSmithKline):IFNAR2 IFNAR1
Darbepoetin alfa:Aranesp:EPOR
Urokinase:Abbokinase:NID1 PLG PLAUR PLAU PLAT SERPINE1 SERPINB2 SERPINA5 LRP2 ST14
Goserelin:Zoladex:LHCGR GNRHR
Reteplase:Retavase (Centocor):PLG FGA PLAUR SERPINE1
Epoetin alfa:Epogen:EPOR
Salmon Calcitonin:Calcimar:CALCR
Interferon alfa-n3:Alferon (Interferon Sciences Inc.):IFNAR1 IFNAR2
Pegfilgrastim:Neulasta (Amgen Inc.):CSF3R ELANE
Sargramostim:Immunex:CSF2RA IL3RA CSF2RB SDC2 PRG2
Secretin:SecreFlo:SCTR
Peginterferon alfa-2b:PEG-Intron    (Schering Corp):IFNAR1 IFNAR2
Asparaginase:Elspar (Merck & Co. Inc):Not Available
Thyrotropin Alfa:Thyrogen (Genzyme Inc):TSHR
Antihemophilic Factor:Advate:LRP1 MCFD2 F10 F9 VWF PHYH ASGR2 HSPA5 CALR CANX LMAN1
Anakinra:Kineret (Amgen Inc):IL1R1
Gramicidin D:Neosporin:
Intravenous Immunoglobulin:Civacir:C4B C5 FCGR1A FCGR1B FCGR2A FCGR2B FCGR2C FCGR3A FCGR3B C3 C4A
Anistreplase:Eminase (Wulfing Pharma GmbH):PLG FGA PLAUR SERPINE1
Insulin recombinant:Novolin R (Novo Nordisk):LRP2 IGFBP7 SYTL4 INSR IGF1R RB1 CTSD IDE PCSK2 CPE PCSK1 NOV
Tenecteplase:TNKase (Genentech Inc):CANX LRP1 PLG FGA PLAUR SERPINE1 SERPINB2 CLEC3B KRT8 ANXA2 CALR
Menotropins:Repronex:FSHR LHCGR
Interferon gamma-1b:Actimmune:IFNGR1 IFNGR2

Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Fetch entries with specific pattern

Hi all, I have following sample input file which is a part of big file: ID AINX_HUMAN Reviewed; 499 AA. AC Q16352; B1AQK0; Q9BRC5; DT 30-MAY-2000, integrated into UniProtKB/Swiss-Prot. DT 23-JAN-2002, sequence version 2. DT 28-NOV-2012, entry version 123.... (2 Replies)
Discussion started by: kareena
2 Replies

2. Shell Programming and Scripting

Fetch specific entries

Hi Guys This time my input sample from a Big file like this In TTDS00002 UniProt ID P11229 TTDS00002 Name Muscarinic acetylcholine receptor M1 TTDS00002 Type of target Successful target TTDS00002 Synonyms M1 receptor TTDS00002 Disease Alzheimer's disease... (13 Replies)
Discussion started by: Priyanka Chopra
13 Replies

3. Shell Programming and Scripting

Request to check:Fetch certain entries

Hi all. Kindly check it it's urgent!! I have one big file from which which I have to fetch certain data I have attached a small part of this file. from the attached file, I have to fetch and arrange data in 3 columns 1 Generic name 2. Brand names 3. Drug... (10 Replies)
Discussion started by: manigrover
10 Replies

4. Shell Programming and Scripting

Match first column entries precisely and fetch whatever in front of it

Hi all I have 2 files: first file AABC TTYP JKBH CVBN NHJK KJHM Second file is AABC,XCYU,JUHD Alllele1 GACXT It is approved study TTYP,JKBH Allele2 PPRD It is clinical trial study JKBH Allele2 PPRD ... (5 Replies)
Discussion started by: Priyanka Chopra
5 Replies

5. Shell Programming and Scripting

Match the word or words and fetch the entries

Hi all, I have 7 words Now I have 1 file which contain data in large number of rows and columns and 6th column contain any of these words or may be more than one words among above 7 words: I want script should search for the above mentioned 7 words in the 6th column ... (9 Replies)
Discussion started by: manigrover
9 Replies

6. Shell Programming and Scripting

perl code to search existing files

Hi, I have a string like: read_lib {$lib/a.lib $lib/b.lib $lib/c.lib ..... } Now, I want to search existence of all these *.lib files in $lib directory. Please suggest- how to do it. Thanks -rkg (2 Replies)
Discussion started by: rkg
2 Replies

7. Solaris

Add existing user into an existing group

Pre: no gpasswd/adduser there is just usermod can be used, also there is no -a option for usermod. How should I add a user into a group? (4 Replies)
Discussion started by: a2156z
4 Replies

8. Shell Programming and Scripting

Unix code to fetch the first field till space in a variable

Hi, I want to get the value of the first field till space in a variable. e.g x=323 /test/personel/logs/File1 I want to get the first field till space i.e 323 in another variable ,lets say y. echo $x|cut -d' ' -f1 gives 323 but when I'm trying y=`echo $x|cut -d' ' -f1 its giving... (3 Replies)
Discussion started by: autosys_nm
3 Replies

9. Shell Programming and Scripting

fetch substring from html code

hello mates. please help me out once again. i have a html file where i want to fetch out one value from the entire html-code sample html code: ..... <b>Amount:<b> 12345</div> ... now i only want to fetch the 12345 from the html document. how to i tell sed to get me the value from... (2 Replies)
Discussion started by: scarfake
2 Replies
Login or Register to Ask a Question