I'm quite new in R and I want to do something with my data in R. can anybody help me how to implement this in R ?
I have data matrix(mydata1) like as follow, and I want to add second columns for it from second database.
my first data matrix is like :
> mydata1[1:4,1:3]
Gene ID lung.cancer lung.cancer.1 lung.cancer.2
hsa-miR-616* 3.653241 1.00000 1.838179
hsa-miR-1296 2.688751 36.12798 43.823880
hsa-miR-338-5p 29.893947 2.21830 48.048856
hsa-miR-452* 5.693279 1015.58508 35.165157
>
and my second database is like :
> Database
ENS ID Gene ID
ENSG00000221263 hsa-mir-548p
ENSG00000207941 hsa-miR-616
ENSG00000207800 hsa-mir-504
ENSG00000222831 hsa-mir-1537
ENSG00000207582 hsa-mir-30b
ENSG00000199153 hsa-miR-338-5p
ENSG00000215998 hsa-mir-935
ENSG00000207804 hsa-mir-599
I want add new column after Gene ID
called ENS ID
for my first data matrix (mydata1
), such that,
it take Gene ID from mydata1
and search for it in Database
and if it's found, add it's corresponding ENS ID
to mydata1
in a new columns .
The expected output would look like :
Gene ID ENS ID lung.cancer lung.cancer.1 lung.cancer.2
hsa-miR-616* ENSG00000207941 5.653241 1.00000 1.838179
hsa-miR-1296 7.688751 36.12798 3.823880
hsa-miR-338-5p ENSG00000199153 29.893947 42.21830 8.048856
hsa-miR-452* 52.693279 115.58508 15.165157