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.

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.

Please convert the DOC file to a TXT file. I'm not going to load OpenOffice just for that.

1 Like

Hi sir,

Kindly check the attached text file.

Mani

Code reformated for legibility.

All that code produces for me is:

:F2fludan
 EGFR2Cxb

What, exactly, are you trying to do?

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

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.

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.

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