I have the results of two differential protein expression experiments which are UniProtKB IDs. I used Biomart to match the these IDs with gene names but not all IDs got matched with a gene name. I want to combine these and the original UniprotKB list and align by UniprotKB ID in order to produce a single dataset. It's my first time using R to do this type of analysis so all suggestions/code examples gratefully received.
dataframe 1
Gene_1  ID_1
Gdi2    G3GR73
Pitrm1  G3GR85
    G3GRA0
Tmem43  G3GS14
Tmf1    G3GS63
Ddx3x   G3GSH5
Bdh1    G3GSJ7
Pak2    G3GSK4
Tfrc    G3GSM5
Umps    G3GSP0
Gart    G3GT56
Pgm3    G3GTC9
Cpt2    G3GTN3
Vps26b  G3GTV9
Mthfd1l G3GU10
Rbm19   G3GU41
    G3GU60
Prkab1  G3GU67
Tigar   G3GUK0
dataframe 2
Gene_2  ID_2
Bak1    A1E3K4
Pitrm1  G3GR85
Gtpbp4  G3GR93
Lbr G3GRA0
Tmem43  G3GS14
Tmf1    G3GS63
Ddx3x   G3GSH5
Bdh1    G3GSJ7
Tfrc    G3GSM5
Umps    G3GSP0
Gart    G3GT56
Pgm3    G3GTC9
Grb2    G3GTE4
Cpt2    G3GTN3
Vps26b  G3GTV9
Mthfd1l G3GU10
Rbm19   G3GU41
    G3GU60
Prkab1  G3GU67
original data
ID_3
A1E3K4
G3GR73
G3GR85
G3GR93
G3GRA0
G3GRB1
G3GRB9
G3GRD8
G3GRE1
G3GRM2
G3GRT0
G3GRW3
G3GRX2
G3GS14
G3GS63
G3GS70
G3GS82
G3GSH2
G3GSH5
I have tried cbind and match_order functions but they dont do exactly what I want. Also tried creating a dataframe from 2 of the data sets but can't as they are different sizes.
joint <- data.frame(ori$ID_3, df_1$ID_1, df_1$Gene_1)
Error in data.frame(ori$ID_3, df_1$ID_1, df_1$Gene_1) : arguments imply differing number of rows: 1255, 544
the aim is to end up with something like this for all approx 1300 entries in dataset 3
Gene_1  ID_1    Gene_2  ID_2    ID_3
        Bak1    A1E3K4  A1E3K4
Gdi2    G3GR73          G3GR73
Pitrm1  G3GR85  Pitrm1  G3GR85  G3GR85
        Gtpbp4  G3GR93  G3GR93
    G3GRA0  Lbr G3GRA0  G3GRA0
                G3GRB1
                G3GRB9
                G3GRD8
                G3GRE1
                G3GRM2
                G3GRT0
                G3GRW3
                G3GRX2
Tmem43  G3GS14  Tmem43  G3GS14  G3GS14
Tmf1    G3GS63  Tmf1    G3GS63  G3GS63
                G3GS70
                G3GS82
                G3GSH2
Ddx3x   G3GSH5  Ddx3x   G3GSH5  G3GSH5
                G3GSJ5
Bdh1    G3GSJ7  Bdh1    G3GSJ7  G3GSJ7
Pak2    G3GSK4          G3GSK4
                G3GSL6
Tfrc    G3GSM5  Tfrc    G3GSM5  G3GSM5
It's my first time using R to do this type of analysis so all suggestions/code examples gratefully received.
Update 1
Based on Stewarts code and suggestions I ended up with the following. file 1 has 2 columns and 544 observations, file 2 has 2 columns and 419 observations, file 3 has 1254 observations. The files have joined correctly but the final file has only 33 observations rather than 1254.
getwd()
file1 <- read.csv("cigr_db.csv", sep=",", header=T)
file2 <- read.csv("picr_db.csv", sep=",", header=T)
file3 <- read.csv("progen_data.csv", sep=",", header=T)
# Change the ID column name to be the same in each dataframe, so we can match on it
colnames(file1)[2] <- 'ID'
colnames(file2)[2] <- 'ID'
colnames(file3)[1] <- 'ID'
v <- plyr::join(df1, df2, type='full')
v <- plyr::join(v, df3, type='full')
v
write.csv(v, file = "all_condt.csv")````
 
    