This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Extracting selected gene interaction from an interanction file

I have a text file "Interaction" with gene gene interactions in this format

a1cf    apobec1
a1cf    ep300
a2m     actb
a2m     ambp
a2m     apoa1
a2m     app
a2m     bmp1
a2m     cdc42
a2m     f2
a2m     ep300

The first column is the source and the second column is the target. Now I have another text file "SelectedGenes" with some selected genes, in it, in this form

a2m
ep300 
apao1
alcf

I want to find the interaction of the genes present in the SelectedGenes file in the Interaction file in a way that interactions should have genes from SelectedGenes file in both the columns. The result should be

a2m     ep300
a2m     apoa1
a1cf    ep300
rna-seq gene r

1 answer

Among other things:

help("%in%")

Log in to answer this question.