This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Print rows where the columns have a specific condition

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

Please do not post the data images instead of data.

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

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?

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

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

0 answers

No answers yet.

Log in to answer this question.