dhammarstrom / generefer

2 stars 2 forks source link

normfinder / Error: Unsupported index type: factor #1

Open antoinefelden opened 5 years ago

antoinefelden commented 5 years ago

Hi,

I encountered the following "Error: Unsupported index type: factor" when running normfinder(cpm_filt_tmm_for_HK, ctVal=TRUE, group = TRUE, cq = "value") with

> head(cpm_filt_tmm_for_HK)
     sample      value         gene   group
1 nth_CS297  17.991638 LOC105678280 Ahipara
2 nth_CS297 287.127637 LOC105678292 Ahipara
3 nth_CS297  46.293755 LOC105678279 Ahipara
4 nth_CS297  17.518951 LOC105678278 Ahipara
5 nth_CS297  64.964881 LOC105678296 Ahipara
6 nth_CS297   3.131549 LOC105669935 Ahipara

> str(cpm_filt_tmm_for_HK)
'data.frame':   122316 obs. of  4 variables:
 $ sample: Factor w/ 12 levels "nth_CS297","nth_CS298",..: 1 1 1 1 1 1 1 1 1 1 ...
 $ value : num  18 287.1 46.3 17.5 65 ...
 $ gene  : chr  "LOC105678280" "LOC105678292" "LOC105678279" "LOC105678278" ...
 $ group : chr  "Ahipara" "Ahipara" "Ahipara" "Ahipara" ...

> str(row.names(cpm_filt_tmm_for_HK))
 chr [1:122316] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" "13" "14" "15" "16" "17" ...
> str(colnames(cpm_filt_tmm_for_HK))
 chr [1:4] "sample" "value" "gene" "group"

Any idea where the problem might come from?

isaaczhao23 commented 2 years ago

Hi,

I encountered the following "Error: Unsupported index type: factor" when running normfinder(cpm_filt_tmm_for_HK, ctVal=TRUE, group = TRUE, cq = "value") with

> head(cpm_filt_tmm_for_HK)
     sample      value         gene   group
1 nth_CS297  17.991638 LOC105678280 Ahipara
2 nth_CS297 287.127637 LOC105678292 Ahipara
3 nth_CS297  46.293755 LOC105678279 Ahipara
4 nth_CS297  17.518951 LOC105678278 Ahipara
5 nth_CS297  64.964881 LOC105678296 Ahipara
6 nth_CS297   3.131549 LOC105669935 Ahipara

> str(cpm_filt_tmm_for_HK)
'data.frame': 122316 obs. of  4 variables:
 $ sample: Factor w/ 12 levels "nth_CS297","nth_CS298",..: 1 1 1 1 1 1 1 1 1 1 ...
 $ value : num  18 287.1 46.3 17.5 65 ...
 $ gene  : chr  "LOC105678280" "LOC105678292" "LOC105678279" "LOC105678278" ...
 $ group : chr  "Ahipara" "Ahipara" "Ahipara" "Ahipara" ...

> str(row.names(cpm_filt_tmm_for_HK))
 chr [1:122316] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" "13" "14" "15" "16" "17" ...
> str(colnames(cpm_filt_tmm_for_HK))
 chr [1:4] "sample" "value" "gene" "group"

Any idea where the problem might come from?

I'm guessing you probably need to convert sample column from a factor type to a column type before running normfinder cpm_filt_tmm_for_HK$sample = as.character(cpm_filt_tmm_for_HK$sample)