Yes, my 'NormalizedMatrix' has row names.
These are my files:
The count matrix from RSEM is "Rsemcount"
"671H.genes.results" "86302H.genes.results" "11015D.genes.results""671D.genes.results" "86302D.genes.results"
"GFHJ01000001.1" 0.00 0.00 0.00 0.00 0.00
"GFHJ01000002.1" 2.00 4.00 1.00 9.00 1.00
"GFHJ01000003.1" 0.00 0.00 0.00 0.00 1.00
"GFHJ01000004.1" 1.00 19.00 2.00 17.00 0.00
"GFHJ01000005.1" 0.00 0.00 0.00 0.00 0.00
"GFHJ01000006.1" 1.00 7.00 0.00 3.00 0.00
I did the following in R:
In=read.table("Rsemcount", stringsAsFactors = F, row.names= 1, header = T)
Data=data.matrix(In)
sizes=MedianNorm(Data)
NormData=GetNormalizedMat(Data,sizes)
head(NormData)
X671H.genes.results X86302H.genes.results X11015D.genes.results X671D.genes.results
GFHJ01000001.1 0.000000 0.000000 0.000000 0.0000000
GFHJ01000002.1 3.462638 1.574628 2.914371 2.2445692
GFHJ01000003.1 0.000000 0.000000 0.000000 0.0000000
GFHJ01000004.1 1.731319 7.479485 5.828742 4.2397418
GFHJ01000005.1 0.000000 0.000000 0.000000 0.0000000
GFHJ01000006.1 1.731319 2.755600 0.000000 0.7481897
X86302D.genes.results
GFHJ01000001.1 0.000000
GFHJ01000002.1 1.736781
GFHJ01000003.1 1.736781
I have combined the list of DE genes for 3 treatments in file combineddelist
head combineddelist
GFHJ01002875.1
GFHJ01004450.1
GFHJ01004863.1
GFHJ01004888.1
GFHJ01004990.1
GFHJ01005067.1
GenesOfInterest=read.table("combineddelist", stringsAsFactors = F, header = F)
GenesOfInterest
V1
1 GFHJ01002875.1
2 GFHJ01004450.1
3 GFHJ01004863.1
4 GFHJ01004888.1
5 GFHJ01004990.1
6 GFHJ01005067.1
7 GFHJ01005131.1
heatmap.2(NormData[GenesOfInterest,], scale="row", trace="none", Colv=F)
Error in NormData[GenesOfInterest, ] : invalid subscript type 'list'
I tried read.list to read the DE genes list but the function is not found.
I am new to RNASeq and R. Please, help me how to use row names as vectors for my DE gene list.
Your GenesOfInterest is not a vector, it is a data.frame that you created with the read.table function. You have to supply a vector to subset your matrix. In this case the data.frame is only one column wide, which means that it consists of a single vector.
So your last command should be
This forum is mainly to support the packages distributed via bioconductor and answer question related to them. Since your questions is more about general R usage and not actually about any package that is part of bioconductor you have to try to read up on R on your own or find other fora that are better suited for those type of questions.
Good luck!