-1

I have a scRNA-seq dataset and I am trying to plot the coexpression frequency of 4 genes and I decided to do this with UpSetR, However I am getting an error and I do not know how to fix it. I have my dataframe as an .RDS file and this is how it looks

head(Neurotransmitter_frequency

VGlut_exp Gad1_exp VAChT_exp Vmat_exp
AAACCCAAGAATTGTG-1 0 0 0 0
AAACCCAAGTAGGAAG-1 0 0 0 0
AAACCCAGTATCAGCT-1 0 0 0 0
AAACCCAGTGGTCTAT-1 0 0 0 0
AAACCCATCACTAGCA-1 1 0 0 0
AAACCCATCGCAGTGC-1 0 0 0 0

and this is what I have done for the UpSetR plot

library(UpSetR)
library(ggplot2)

Neurotransmitter_frequency = readRDS("/lab/Neurotransmitters_frequency.RDS")
set_variables<- c("VGlut_exp", "Gad1_exp", "VAChT_exp", "Vmat_exp")
upset(Neurotransmitter_frequency, sets = set_variables)

however I get this error:

Error in colSums(data[sets]) : 'x' must be numeric

no idea how to fix this, is it because of the row names with the cells ID? I am totally stuck, any help will be much welcome :)

zx8754
  • 52,746
  • 12
  • 114
  • 209
AvolaAMG
  • 41
  • 2
  • 2
    Ensure you have numeric, try: `lapply(Neurotransmitter_frequency[, set_variables], class)` – zx8754 Aug 10 '23 at 10:53
  • Thanks for your answer zx8754! lapply(Neurotransmitter_frequency[, set_variables], class) $VGlut_exp [1] "character" $Gad1_exp [1] "character" $VAChT_exp [1] "character" $Vmat_exp [1] "character" I guess I should change them into numeric? or into vectors ? Thank you! :) – AvolaAMG Aug 10 '23 at 14:59
  • Convert to integer: `Neurotransmitter_frequency[, set_variables] <- lapply(Neurotransmitter_frequency[, set_variables], as.integer)` – zx8754 Aug 10 '23 at 15:00
  • it works now!!!! thank you :) – AvolaAMG Aug 10 '23 at 19:25

0 Answers0