Print rows where the columns have a specific condition
0
0
Entering edit mode
5 months ago
vanessagpds ▴ 10

I am trying to filter my results but I am having difficulties.

I have a tab-separated file and I would like to filter it as follows:

The lines are removed if they are not found in cosmic92 or cosmic92_noncoding, but are present in avsnp150 or ExAC.

I thank the attention.

enter image description here

awk linux bash • 294 views
ADD COMMENT
0
Entering edit mode

Please do not post the data images instead of data.

ADD REPLY
0
Entering edit mode

My apologies

Chr cosmic92    cosmic92_noncoding  avsnp150    ExAC_ALL
chr1    ID=COSV65068047;OCCURENCE=2(thyroid),2(large_intestine),1(prostate) ID=COSV65068047;OCCURENCE=2(thyroid),2(large_intestine),1(prostate) rs2465128   0.8767
chr1    ID=COSV65071416;OCCURENCE=1(thyroid)    ID=COSV65071416;OCCURENCE=1(thyroid)    rs10267 0.8989
chr1    .   .   rs9442391   0.6295
chr1    ID=COSV65070964;OCCURENCE=1(breast) ID=COSV65070964;OCCURENCE=1(breast) rs4275402   0.6376
chr1    ID=COSV55420568;OCCURENCE=2(thyroid)    ID=COSV55420568;OCCURENCE=2(thyroid)    rs17568 0.3751
ADD REPLY
0
Entering edit mode

try this (test.txt - OP text):

$ awk -F "\t" '($2 != "." || $3 !=".") {print}' test.txt

what if it is present in avsnp150, but absent in ExAC_ALL or vice versa?

ADD REPLY
0
Entering edit mode

Thank you for your answer. In this case, as long as it is present in one of the databases, the line must be ignored.

ADD REPLY
0
Entering edit mode

Then this code will work. This code filters out rows/ records if COSMIC92 (2nd column) or COSMIC92_Noncoding (3rd column) values are denoted by ..

ADD REPLY

Login before adding your answer.

Traffic: 1975 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6