Error in `*tmp*`$samples : $ operator is invalid for atomic vectors
1
0
Entering edit mode
lq.ke • 0
@dc6790f5
Last seen 28 days ago
China

Error in *tmp*$samples : $ operator is invalid for atomic vectors

> x <- as.matrix(read.delim("E:/bioinformatic/RNAseq/GSE168008_raw_count.txt", sep ="" ,row.names = 1))
> dgelist <-DGEList(counts = x)
> dim(x)
[1] 25702    10
> samplenames <- substring(colnames(x), 1, nchar(colnames(x))) 
> samplenames
 [1] "BLJ1_align"  "BLJ2_align"  "BLJ3_align"  "BLJ4_align"  "BLJ5_align" 
 [6] "BLJ6_align"  "BLJ7_align"  "BLJ8_align"  "BLJ9_align"  "BLJ10_align"
> colnames(x) <- samplenames 
> group <- as.factor(c("BM_MSC", "BM_MSC", "BM_MSC", "BM_MSC", "BM_MSC", "BM_MSC_act", 
+                      "BM_MSC_act", "BM_MSC_act", "BM_MSC_act", "BM_MSC_act"))
> x$samples$group <- group
Error in `*tmp*`$samples : $ operator is invalid for atomic vectors

Many thanks for your help!

Homo.sapiens Homo_sapiens • 107 views
ADD COMMENT
0
Entering edit mode
@james-w-macdonald-5106
Last seen 4 hours ago
United States

I believe you want

> x <- as.matrix(read.delim("E:/bioinformatic/RNAseq/GSE168008_raw_count.txt", sep ="" ,row.names = 1))
> samplenames <- substring(colnames(x), 1, nchar(colnames(x))) 
> samplenames
 [1] "BLJ1_align"  "BLJ2_align"  "BLJ3_align"  "BLJ4_align"  "BLJ5_align" 
 [6] "BLJ6_align"  "BLJ7_align"  "BLJ8_align"  "BLJ9_align"  "BLJ10_align"
> colnames(x) <- samplenames 
> group <- as.factor(c("BM_MSC", "BM_MSC", "BM_MSC", "BM_MSC", "BM_MSC", "BM_MSC_act", 
+                      "BM_MSC_act", "BM_MSC_act", "BM_MSC_act", "BM_MSC_act"))
> dgelist <-DGEList(counts = x, group = group)

Your order of operation is off, and you are trying to add the group variable to your matrix of counts rather than the DGEList you have constructed. It's easier to add the groups as part of the DGEList call anyway.

Login before adding your answer.

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