Help with 2 list in R, comparing gene ID to get refined information from both
1
0
Entering edit mode
9.9 years ago
tiago211287 ★ 1.5k

Hello Guys, I need a little help from those who know R a lot. I am still learning and despite trying alone I still get stuck in some task. For example, I have these 2 files separated by tab. And I need to compare the ensembl id's s so I can get How many Up-regulated genes X Down-regulated genes I have per chromosome and also per band. Can someone help me? I think this should be quite easy but still....to hard for a beginner like me.

File1.txt

Group1    Band    Chromosome Name    Group2    Band    Chromosome Name    Group3   Band    Chromosome Name
ENSMUSG00000004707    H3    1    ENSMUSG00000005763    H2.3    1     ENSMUSG00000098895    H2.1   1
ENSMUSG00000006403    H3    2    ENSMUSG00000008136    B    2    ENSMUSG00000046814    E4    2
ENSMUSG00000008475    G3    3    ENSMUSG00000025917    A2    3    ENSMUSG00000004707    H3    3
ENSMUSG00000009772    E4    4    ENSMUSG00000025938    A3    4    ENSMUSG00000004552    H3    4

File2.txt

Group1    Expression    Group2    Expression    Group3   Expression
ENSMUSG00000004707    Up    ENSMUSG00000025938    Up    ENSMUSG00000004552    Up
ENSMUSG00000006403   Up     ENSMUSG00000025917    Up    ENSMUSG00000004707    Up
ENSMUSG00000008475    Down    ENSMUSG00000005763    Down    ENSMUSG00000046814    Down
ENSMUSG00000009772    Down    ENSMUSG00000008136    Down    ENSMUSG00000098895    Down
Ensembl Gene-list RNA-Seq R • 4.3k views
ADD COMMENT
0
Entering edit mode
9.9 years ago
Ram 44k

Use read.table() with the header flag ON to read into a data.frame, then use frame$columnName to access data.

ADD COMMENT
0
Entering edit mode

Did not help much

ADD REPLY
0
Entering edit mode

You might wanna Google individual parts of my answer. Giving you the entire solution is easy, but not helpful in the long term.

ADD REPLY
0
Entering edit mode

I still need some help here, I am trying alone has been a while and am tired

ADD REPLY
0
Entering edit mode

Think of it this way: You have a tab separated file that you want to read to a data frame. From your other questions, you wish to manipulate these data frames by merging/joining them based on values from a common column.

Google key phrases and look for answers that might help you. In your case, "read tab separated file to R data frame" and "merge data frames based on common values" might be good starting points.

ADD REPLY
1
Entering edit mode

Thank you for trying help, I found a solution myself:

library(reshape2)
library(plyr)
table1 <- read.delim('genescol.txt',header=T)
table2 <- read.delim('genescol2.txt',header=T)
res <- merge(table1,table2,by.x='Group1',by.y="Group1")
res.count2 <- count(res,vars = c("Band","Chromosome.Name","Expression"))
ADD REPLY
1
Entering edit mode

Excellent, congratulations! You're now one step closer to becoming the R expert that will always help you out. I am glad you were able to solve it so fast.

ADD REPLY
0
Entering edit mode

Thank you very much.

ADD REPLY

Login before adding your answer.

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