Request to check:Fetch certain entries


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Request to check:Fetch certain entries
# 8  
Old 07-23-2012
Request to check

Hi

Thanks for reply.

I did this thing

Quote:
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;} /^# Brand_Name/ {k=2;} END {if (a[1]) print a[1]" "a[2]" "a[3];}' drugbank.txt >*drugbank3.txt
but in the output file there is nor generic name now

the output is like this
Quote:
: Refludan: F2
: Erbitux: FCGR2A FCGR2B FCGR2C EGFR FCGR3B C1R C1QA C1QB C1QC FCGR3A C1S FCGR1A
: Pulmozyme: Not Available
: Ontak: IL2RA IL2RB IL2RG
: Enbrel: C1S C1R C1QA C1QB C1QC TNF TNFRSF1B FCGR1A FCGR3A FCGR2A FCGR2B FCGR2C LTA FCGR3B
: Angiomax: F2
: Eligard: GNRHR
: Pegasys: IFNAR2 IFNAR1
: Activase (Genentech Inc): PLG FGA PLAUR SERPINE1
: Geref: GHRHR
: Wellferon (GlaxoSmithKline): IFNAR2 IFNAR1
: Aranesp: EPOR
: Abbokinase: NID1 PLG PLAUR PLAU PLAT SERPINE1 SERPINB2 SERPINA5 LRP2 ST14
: Zoladex: LHCGR GNRHR
: Retavase (Centocor): PLG FGA PLAUR SERPINE1
: Epogen: EPOR
: Calcimar: CALCR
: Alferon (Interferon Sciences Inc.): IFNAR1 IFNAR2
: Neulasta (Amgen Inc.): CSF3R ELANE
: Immunex: CSF2RA IL3RA CSF2RB SDC2 PRG2
: SecreFlo: SCTR
: PEG-Intron (Schering Corp): IFNAR1 IFNAR2
: Elspar (Merck & Co. Inc): Not Available
: Thyrogen (Genzyme Inc): TSHR
: Advate: LRP1 MCFD2 F10 F9 VWF PHYH ASGR2 HSPA5 CALR CANX LMAN1
: Kineret (Amgen Inc): IL1R1
: Neosporin:
: Civacir: C4B C5 FCGR1A FCGR1B FCGR2A FCGR2B FCGR2C FCGR3A FCGR3B C3 C4A
: Eminase (Wulfing Pharma GmbH): PLG FGA PLAUR SERPINE1
: Novolin R (Novo Nordisk): LRP2 IGFBP7 SYTL4 INSR IGF1R RB1 CTSD IDE PCSK2 CPE PCSK1 NOV
: TNKase (Genentech Inc): CANX LRP1 PLG FGA PLAUR SERPINE1 SERPINB2 CLEC3B KRT8 ANXA2 CALR
: Repronex: FSHR LHCGR
: Actimmune: IFNGR1 IFNGR2
: Roferon A (Hoffmann-La Roche Inc): IFNAR1 IFNAR2
: Adiuretin: AVPR2 AVPR1A AVPR1B
: NovoSeven (Novo Nordisk): F10 HPN TFPI GGCX F7 F3
: Neumega: IL11RA
: Kepivance (Amgen Inc): FGFR2 NRP1 FGFR1 FGFR
# 9  
Old 07-23-2012
Hi,

It's in my code that you have to replace " " by ":" and not in your code " " by ": " . . .
So the right code is :
Quote:
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];}' drugbank.txt >drugbank3.txt
So now you will have the first field seperator as ":"
and the second fields separator for the drug targets as ","
# 10  
Old 11-14-2012
Changes in code to provide proper result with one additional fiield
Hi all


I am using following code to get results for brand name drug target name and generic name from my attached fiile



Code:
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];}' drugbank.txt >drugbank3.txt

But when I change the code to additional field Drug Type. It is not giving me proper results can anybody guide to make changes in this code to get drug type as well.

---------- Post updated at 10:30 PM ---------- Previous update was at 10:06 PM ----------

Hi

Its working now using the same code completely Smilie dont know why? can any body try on his or her system?Smilie

Last edited by Franklin52; 11-30-2012 at 04:43 AM.. Reason: Code tags
# 11  
Old 11-29-2012
Request to check

Hi all


I am using foloowing code for my above attached file to retrieve mechanis of action and indication alon gwith other details but its nto working properly >Can anybody check anything wrong with this code

Code:
awk 'k>0 {if (a[k] && k==2) {print a[1]":"a[2]":"a[3]":"a[4]":"a[5]":"a]6]; a[1]=a[2]=a[3]=a[4]=a[5]=a[6]"";} a[k]=a[k]?a[k]","$0:$0; k=0;} /^# Drug_Target_.*_Gene_Name/ {k=1;} /^# Generic/ {k=1;} /^# Brand_Name/ {k=2;}  /^# Drug_Type/ {k=3;} /^# Indication/ {k=5;} /^# Mechanism_ Of_ Action / {k=6;} END {if (a[1]) print a[1]":"a[2]":"a[3]":"a[4]":"a[5]":"a[6];}' drugbank.txt >drugbanknew2.txt

My output entries are not right

---------- Post updated at 08:16 PM ---------- Previous update was at 06:04 AM ----------

Please let me know if somebody has suggestions to change the above code as I need it or if somebody didnt understand the questions kindly let me know
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Urgent request to consider:Search specific name in a file and fetch specific entries

Hi all, I have 2 files, One file contain data like this FHIT CS CHRM1 PDE3A PDE3B HSP90AA1 PTK2 HTR1A ESR1 PARP1 PLA2G1B These names are mentioned in the second file(Please see attached second file) as # Drug_Target_X_Gene_Name:(Where X can be any number (1-1000) (1 Reply)
Discussion started by: manigrover
1 Replies

2. Shell Programming and Scripting

Extract certain entries from big file:Request to check

Hi all I have a big file which I have attached here. And, I have to fetch certain entries and arrange in 5 columns Name Drug DAP ID disease approved or notIn the attached file data is arranged with tab separated columns in this way: and other data is... (2 Replies)
Discussion started by: manigrover
2 Replies

3. Shell Programming and Scripting

Request to check:count specific entries

Hi all I have an input file which contains so many entries like this: And, I want to count hw many among ASN in one column are converted to LYS in third coulmns. which means output shuld contain only "ASN number LYS" Kindly let me know wny programm for this My input is ASN 217 LYS... (2 Replies)
Discussion started by: manigrover
2 Replies

4. Shell Programming and Scripting

Request to check: Not printing all entries

Dear all, I am facing one problem in my input file there are many Entries which starts from *FIELD * AV (checked the attached file) I want all the entries in the output file which start from *FIELD * AV I have written this programm but its not printing all the entries with *FIELD... (4 Replies)
Discussion started by: manigrover
4 Replies

5. Shell Programming and Scripting

Request to check:remove entries more than once in different column

Hi I have a file 12m 345693460 12 1234 12 1234 34 345 34 345 And I want output fiel as 12m 345693460 12 1234 34 345 hw can it be done Thanks (1 Reply)
Discussion started by: manigrover
1 Replies

6. Shell Programming and Scripting

Request to check:remove entries with N/A mentioned

Hi I have a file with following entries 122 N/A 123 5654656 123423 43534543 4544 45435 435454 N/A i Have to remove entries with N/A so that only 123 5654656 123423 43534543 4544 45435 remain in output file can anybody guide for a code/unix/perl (2 Replies)
Discussion started by: manigrover
2 Replies

7. Shell Programming and Scripting

Request to check:remove entries with blank spaces

Hi I want to remove entries with blank spaces in my input file: 123 234 456 678 56789 345346456 589 3454 345456 3454566............................ (2 Replies)
Discussion started by: manigrover
2 Replies

8. Shell Programming and Scripting

Request to check:remove entries more than once

Hi I have a file like this 1234 2345 567889 567889 2345 234899420 83743 2345 67890 67890 ................ so on I want to delete entries which are more than once like 2345, 567889 and 67890 so that these appear once (4 Replies)
Discussion started by: manigrover
4 Replies

9. Shell Programming and Scripting

Request to check:remove entries with N/A entries

Hi I have a file with numerous entries some entries are 1 mani 2 kavya 3 N/A 4 Praveeen 5 N/A and so on How to remove entries with N/A so the result will be 1 mani 2 kavya 3 Praveeen (6 Replies)
Discussion started by: manigrover
6 Replies

10. Shell Programming and Scripting

Request to check:find out common entries

I have to compare 2 files which means 2 files with common entries in same column and separate those common entries in a diferent file as well right before those entries common so that I can separat common and Uncommon entries in rows in 2 different files. Is it possible For eg. one file ... (3 Replies)
Discussion started by: manigrover
3 Replies
Login or Register to Ask a Question