gravatar for leonmcswain

3 hours ago by

I have seen some other posts on here but after going through them Im not finding a solution. I am using limma to do DE analysis on 763 patient microarrays, 4 groups total. My expression object is a matrix with rownames as genes and colnames as patient ID.

When I try to run the code I get the error:

> fit <- lmFit(as.numeric(Merge_DF_Avg2), design)
Error in lmFit(as.numeric(Merge_DF_Avg2), design) : 
  row dimension of design doesn't match column dimension of data object

The dimensions seem correct:

> dim(design)
[1] 763   4

> dim(Merge_DF_Avg2)
[1] 20341   763

> class(Merge_DF_Avg2)
[1] "matrix" "array"

Here is the code:

#Data wrangle for limma
>Merge_DF_Avg <-readRDS("C:/Users/12298/Desktop/Data_Analytics/Taylor_2017/Finalized_Expression_Array_avgs.rds")
>Merge_DF_Avg2 <- Merge_DF_Avg %>% na.omit() %>% pivot_wider(values_from=avg, names_from=Gene_Name) %>% t() %>% janitor::row_to_names(row_number = 1)
>Patient_Cat <- as.vector(as.numeric(Merge_DF_Avg2[1,]))
>Merge_DF_Avg2 <- Merge_DF_Avg2[-c(1,2),] #Taking out patient cat and unidentified gene rows

#limma design
>design <- model.matrix(~ 0 + factor(Patient_Cat))
>colnames(design) <- c("SHH", "Group3", "Group4", "WNT")
>fit <- lmFit(as.numeric(Merge_DF_Avg2), design)

I am using the example code provided by the limma package pdf to guide me.



Source link