plotting venndiagram and find the overlap in R for rsid between model and vcf files.
1
0
Entering edit mode
2.6 years ago
rheab1230 ▴ 140

Hello, I want to plot overlap between two datasets. My first dataset is:

enter image description here

dput(rsid_en_vcf[1:43,])
c("rs782629217", "rs782403204", "rs199529001", "rs147880041", 
"rs141826009", "rs199826048", "rs200558688", "rs782114919", "rs41304577", 
"rs200311430", "rs147114528", "rs200635479", "rs41288741", "rs782167952", 
"rs6560827", "rs200242637", "rs144539776", "rs41305669", "rs41288743", 
"rs41288743", "rs369736529", "rs148025238", "rs41298226", "rs782272071", 
"rs9329304", "rs9329305", "rs137895574", "rs142619172", "rs144154384", 
"rs782777737", "rs782796368", "rs782443786", "rs782246853", "rs150779790", 
"rs782304204", "rs9329306", "rs144740103", "rs4431953", "rs189892388;rs75953774", 
"rs61839057", "rs61839058", "rs145405488", "rs782307404")

My second dataset is:

enter image description here

dput(en_Brain_Cortex7[1:10,])
structure(list(RSID1 = c("rs2085346", "rs12765102", "rs11250286", 
"rs1876899", "rs11250293", "rs4880776", "rs7094850", "rs883660", 
"rs4880780", "rs4880487")), row.names = c(NA, -10L), class = c("tbl_df", 
"tbl", "data.frame"))

I want to plot a venndiagram with overlap for these two datasets. This is what I did:

venn.diagram(
    x = list(rsid_en_vcf,en_Brain_Cortex7),
    category.names = c("elasticnet_model","rsid_vcf"),
    filename = 'venn_diagramm.png',
    output=TRUE
)

But it gives an error:

Error:
! Must subset rows with a valid subscript vector.
i Logical subscripts must match the size of the indexed input.
x Input has size 157608 but subscript `!duplicated(x, fromLast = fromLast, ...)` has size 0.
rsid venndiagram overlap • 1.2k views
ADD COMMENT
0
Entering edit mode

not a real answer to your specific question but you could try some online tools to get a venn diagram (if getting the venn is the goal of all this).

eg. DrawVenn

ADD REPLY
1
Entering edit mode
2.6 years ago

When you consult the documentation of the function with ?venn.diagram, you will see that x needs to be A list of vectors (e.g., integers, chars), with each component corresponding to a separate circle in the Venn diagram.

If you run for example class(en_Brain_Cortex7), it will however return you [1] "tbl_df" "tbl" "data.frame". So you need to provide the function with the data in the correct format. class(en_Brain_Cortex7$RSID1) for example is "character" (chars).

So

venn.diagram(
    x = list(en_Brain_Cortex7[,"RSID1"], rsid_en_vcf[,1]),
    category.names = c("elasticnet_model","rsid_vcf"),
    filename = 'venn_diagramm.png',
    output=TRUE
)

should work. (Be careful that the columns are indeed characters and not factors). Possibly, you also need to take care of chained entries like rs189892388;rs75953774 in rsid_en_vcf...

ADD COMMENT

Login before adding your answer.

Traffic: 1953 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