merge table with gene ID and names
1
0
Entering edit mode
6.8 years ago
lessismore ★ 1.4k

Dear all,

i have a technical problem, would like to use the merge function maybe in R to merge two tables, one (one column) with gene IDs and the other (2 columns) with gene IDs + respective gene names. There could be the case where i dont have for certain gene IDs the respective gene names. In this case i want in the merged table the original gene ID.

Could you help me? table1

TMCS09g1008676
TMCS09g1008677
TMCS09g1008678
TMCS09g1008679
TMCS09g1008680
TMCS09g1008681
TMCS09g1008682
TMCS09g1008683

table2

TMCS09g1008676  AMC
TMCS09g1008677  BBV
TMCS09g1008678  
TMCS09g1008679  BBC
TMCS09g1008680  
TMCS09g1008681  AYY
TMCS09g1008682  
TMCS09g1008683

wanted table:

AMC
BBV
TMCS09g1008678
BBC
TMCS09g1008680
AYY
TMCS09g1008682
TMCS09g1008683

thanks in advance

R bash awk • 3.4k views
ADD COMMENT
0
Entering edit mode

Check out the documentation on merge in R https://www.statmethods.net/management/merging.html

ADD REPLY
0
Entering edit mode

If the "GeneID" columns are exactly the same in both dataframes, then use cbind.

ADD REPLY
0
Entering edit mode

Why is the 3rd row of output "wanted" table is not "BBV" ?

ADD REPLY
0
Entering edit mode

yes sorry i corrected

ADD REPLY
1
Entering edit mode
6.8 years ago
theobroma22 ★ 1.2k

Try: result <- merge(t1, t2, by.x = "geneID", by.y = "respectivegenename", all = TRUE)

The native gene IDs may be listed after the "respectivegenenames".

ADD COMMENT

Login before adding your answer.

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