How to subselect in a dataframe with multiple conditions by columns

Not tested, due to lack of a reprex. See the FAQ: How to do a minimal reproducible example reprex for beginners.

x <- tcga_tumors_copy
setA <- edges_conjugateABC$A
setB <- edges_conjugateABC$B

x1 <- x[which(x["source"] %in% setA])
x2 <- x[which(x["dest"] %in% setB])

result <- intersect(x1,x2)