How the best way to verify the up and down regulated genes in a list of DE genes, generated from DEseq?
2
5
Entering edit mode
10.0 years ago
tiago211287 ★ 1.5k

I have a table of DE genes from each experimental group. And I have a list of genes in each chromosome. I want to look the number of up and down DE genes in this table but in each chromosome.

I thought to use excel, but it turn out to be too much complicated. Can someone expert in R try to help me?

RNA-Seq R DEseq • 6.1k views
ADD COMMENT
0
Entering edit mode

Can you post few lines of both the files so that any body can give you a simple command/script ?

ADD REPLY
0
Entering edit mode

So you have a list of DEGs and a list of Genes per Chromosome and you want to count the number of up and downregulated genes in each chromosome? Can you paste the top 5 lines of each list/file?

ADD REPLY
0
Entering edit mode

komal.rathi exactly. Here is my 2 tables, the first contains the genes of each chromossome, the second, my genes with fold change, when negative the gene is downregulated, and positive up regulated. I must search the gene in the chromossome list, indentify the chromossome number, and mark it as up or down. Can you help me ? =S

I promise help other people when I learn programing.

Chromossome 1          Chromossome 2          Chromossome 3          Chromossome 4          Chromossome 5          Chromossome 6         Chromossome 7          Chromossome 8           Chromossome 9          Chromossome 10         Chromossome 11         Chromossome 12         Chromossome 13         Chromossome 14         Chromossome 15         Chromossome 16         Chromossome 17         Chromossome 18         Chromossome 19         x                      y
ENSMUSG00000101180     ENSMUSG00000086670     ENSMUSG00000051777     ENSMUSG00000095455     ENSMUSG00000067321     ENSMUSG00000087613     ENSMUSG00000094221     ENSMUSG00000084366     ENSMUSG00000074305     ENSMUSG00000089800     ENSMUSG00000102585     ENSMUSG00000008438     ENSMUSG00000099917     ENSMUSG00000104311     ENSMUSG00000090964     ENSMUSG00000102562     ENSMUSG00000024011     ENSMUSG00000086600     ENSMUSG00000084825     ENSMUSG00000081320     ENSMUSG00000102208
ENSMUSG00000025911     ENSMUSG00000037683     ENSMUSG00000102067     ENSMUSG00000082055     ENSMUSG00000078182     ENSMUSG00000092035     ENSMUSG00000096294     ENSMUSG00000074442     ENSMUSG00000056904     ENSMUSG00000071343     ENSMUSG00000081054     ENSMUSG00000040867     ENSMUSG00000069270     ENSMUSG00000048349     ENSMUSG00000079022     ENSMUSG00000102575     ENSMUSG00000023906     ENSMUSG00000093774     ENSMUSG00000047733     ENSMUSG00000082347     ENSMUSG00000103417
ENSMUSG00000026051     ENSMUSG00000083773     ENSMUSG00000103464     ENSMUSG00000083091     ENSMUSG00000015652     ENSMUSG00000079523     ENSMUSG00000019370     ENSMUSG00000089956     ENSMUSG00000002032     ENSMUSG00000097086     ENSMUSG00000082737     ENSMUSG00000103645     ENSMUSG00000057799     ENSMUSG00000091221     ENSMUSG00000067613     ENSMUSG00000103916     ENSMUSG00000089779     ENSMUSG00000104264     ENSMUSG00000025008     ENSMUSG00000081891     ENSMUSG00000102265
Gene ID's              Gene Name                                                  Fold Change     pValue
ENSMUSG00000008845     CD163 antigen                                              3,062371555     1,38E-18
ENSMUSG00000000031     H19 fetal liver mRNA                                       2,35192941      2,34E-32
ENSMUSG00000098816                                                                2,318384089     5,41E-08
ENSMUSG00000099143                                                                2,298123074     3,02E-07
ENSMUSG00000021057     ENSMUSG00000021057                                         2,22934532      4,50E-05
ENSMUSG00000063415     cytochrome P450, family 26, subfamily b, polypeptide 1     2,211513238     2,53E-06
ENSMUSG00000003477     indolethylamine N-methyltransferase                        1,942272152     2,06E-07
ENSMUSG00000034009     relaxin/insulin-like family peptide receptor 1             1,907001138     4,40E-07
ADD REPLY
0
Entering edit mode

Can you paste some data that overlaps? For e.g. here the Gene IDs in table1 are not present in table2.

ADD REPLY
7
Entering edit mode
10.0 years ago
komal.rathi ★ 4.1k

This is one way you can do it:

library(reshape2)
library(plyr)

# read table1
table1 <- read.delim('table1.txt',header=T)
table1 <- as.data.frame(t(table1))
table1$ID <- rownames(table1)
table1 <- melt(table1,id.vars = "ID")

# Now we have modified the table1 to look like this
table1
ID variable              value
Chromossome.1       V1 ENSMUSG00000101180
Chromossome.2       V1 ENSMUSG00000086670
Chromossome.3       V1 ENSMUSG00000051777
Chromossome.4       V1 ENSMUSG00000095455
Chromossome.5       V1 ENSMUSG00000067321
Chromossome.6       V1 ENSMUSG00000087613

# read table2
table2 <- read.delim('table2.txt')

# specify if a gene is up or down regulated
table2$class <- ifelse(table2$Fold.Change>0,"up","down") 

# Table2 looks like this
table2
Gene.ID.s        Gene.Name Fold.Change   pValue class
ENSMUSG00000101180       xyz       0.400     NA    up
ENSMUSG00000086670       abc       0.454     NA    up
ENSMUSG00000051777       pqr       0.330     NA    up
ENSMUSG00000095455      dlkf       1.550     NA    up
ENSMUSG00000067321       dlk       3.222     NA    up
ENSMUSG00000087613      dlkf       9.980     NA    up
# I added some junk data in table2 to match the Ensembl IDs in table1 and table2

# merge the two tables based on Ensembl IDs
res <- merge(table1,table2,by.x='value',by.y="Gene.ID.s")

# count the number of up and down regulated genes based on chromosomes
res.count <- count(res,vars = c("ID","class"))

# Result
res.count
ID class freq
Chromossome.1    up    1
Chromossome.2    up    1
Chromossome.3    up    1
Chromossome.4    up    1
Chromossome.5    up    1
Chromossome.6    up    1
ADD COMMENT
0
Entering edit mode

Jeez!! THank you very MUCH!!! I will try here right now!

ADD REPLY
0
Entering edit mode

I ve got an error because my fold change numbers are factors, and it must be converted to numeric?

I've tried as.numeric(levels(f)) but I've got only NA's.

ADD REPLY
0
Entering edit mode

You may have to do this:

table2$Fold.Change = as.numeric(as.character(table2$Fold.Change))
ADD REPLY
1
Entering edit mode
10.0 years ago
tiago211287 ★ 1.5k

It worked like a charm, thank you very much.

But using

table2$Fold.Change = as.numeric(as.character(table2$Fold.Change))

R insert only NA's

I changed to

table2$Fold.Change <- as.character(table2$Fold.Change)

and than worked just fine. I am not sure why but it worked.

Thank you very much!

ADD COMMENT

Login before adding your answer.

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