zwdzwd / sesame

🍪 SEnsible Step-wise Analysis of DNA MEthylation BeadChips
Other
61 stars 32 forks source link

could not find function "SigSetsToRGChannelSet" #130

Open yyuu33nn opened 10 months ago

yyuu33nn commented 10 months ago

help, im trying to convert SigSet to RGset , however i keep getting such message:

> SigSetsToRGChannelSet(betas_list, BPPARAM = SerialParam(), annotation = NA)
Error in SigSetsToRGChannelSet(betas_list, BPPARAM = SerialParam(), annotation = NA) : 
  could not find function "SigSetsToRGChannelSet"
> View(sdfs)
> SigSetsToRGChannelSet(betas_list)
Error in SigSetsToRGChannelSet(betas_list) : 
  could not find function "SigSetsToRGChannelSet"

and when i check > exists("SigSetsToRGChannelSet", where = getNamespace("sesame")) i got a : [1] FALSE

what i have done: remove all RData and reinstall the latest bioconductor and zwdzwd/sesame. able to read and preprocess the sigset.

Im trying to access the EPIC V2 Chip data, so i can input it into my epigenetic clock pipelines and calculate the age. following is my full code:


if (!requireNamespace("BiocManager", quietly = TRUE))
  install.packages("BiocManager")
BiocManager::install("zwdzwd/sesame", force=TRUE)

library(sesame)
exists("SigSetsToRGChannelSet", where = getNamespace("sesame"))

sesameDataCache()
tools::R_user_dir("ExperimentHub", which="cache")

# Define the path to the IDAT files
idat_path <- "/Mypath_to_IDATs"

# Search for IDAT prefixes in the specified path
idat_prefixes <- searchIDATprefixes(idat_path)

# Read each IDAT pair using lapply and the readIDATpair function
sdfs <- lapply(idat_prefixes, readIDATpair)

# To check the output
# Apply the head function to the first few elements of the list to view their contents
lapply(sdfs[1:8], head)

# Preprocessing function for IDAT files
process_idat_files <- function(data) {
  # No need to read IDAT files here, 'data' is already loaded by 'readIDATpair'
  data <- qualityMask(data)
  data <- inferInfiniumIChannel(data)
  data <- dyeBiasNL(data)
  data <- pOOBAH(data)
  betas <- getBetas(noob(data))

  return(betas)
}

# Apply the corrected preprocessing function to each loaded IDAT pair in sdfs
betas_list <- lapply(sdfs, process_idat_files)

# To see the beta values for the first few probes of the first sample
head(betas_list[[1]])

SigSetsToRGChannelSet(betas_list, BPPARAM = SerialParam(), annotation = NA)
zwdzwd commented 10 months ago

since SigSet is no longer supported. have you tried using SigDF and the updated sesamize function? https://github.com/zwdzwd/sesamize/blob/main/sesamize.R and https://zhou-lab.github.io/sesame/dev/supplemental.html#Interaction_with_Other_Tools ?

zwdzwd commented 10 months ago

Sorry, I am a bit confused, the input to SigDFsToRGChannelSet should be a list of SigDF. No need to process it to beta values. Whether to apply any preprocessing depends on need.

tamefelis commented 8 months ago

Dear Wanding,

however when we wish to proceed with the list of SigDF, the Function had failed. image

or code, really appreciate if we can have your input here. :


+   
+   if (is(sdfs, 'SigDF')) {
+     sdfs <- list(sample=sdfs)
+   }
+   
+   pt <- sdfPlatform(sdfs[[1]])
+   annotation <- guessMinfiAnnotation(pt, annotation)
+   
+   ss_all <- bplapply(sdfs, SigDFToRGChannel, BPPARAM=BPPARAM)
+   rgset <- minfi::RGChannelSet(
+     Green=do.call(cbind, lapply(ss_all, function(ss) ss$grn)), 
+     Red=do.call(cbind, lapply(ss_all, function(ss) ss$red)), 
+     annotation=c(
+       array=unname(platformSmToMinfi(pt)),
+       annotation=annotation))
+ }
> SigDFsToRGChannelSet(sdfs)
Error: BiocParallel errors
  1 remote errors, element index: 1
  7 unevaluated and other errors
  first remote error:
Error in InfI(sdf): could not find function "InfI"
Called from: .bpinit(manager = manager, X = X, FUN = FUN, ARGS = ARGS, BPPARAM = BPPARAM, 
    BPOPTIONS = BPOPTIONS, BPREDO = BPREDO)```
altuda commented 5 months ago

Hi, I am also struggling with Sesamize/RGChannelSetToSigDFs. Your contributions to Sesame are invaluable, and I would be grateful for your assistance with this issue. Thank you for all the work you've done.

grSet <- RGChannelSetToSigDFs(FlowSorted.Blood.450k[,1:4]) Error: BiocParallel errors 1 remote errors, element index: 1 3 unevaluated and other errors first remote error: Error in chipAddressToSignal(dm, manifest): could not find function "chipAddressToSignal"

approach according to vignette

grSet <- sesamize(FlowSorted.Blood.450k[,1:4]) Sesamizing 1... Sesamizing 1... Error in (function (classes, fdef, mtable) : unable to find an inherited method for function ‘mapToGenome’ for signature ‘"matrix"’

str(FlowSorted.Blood.450k) Formal class 'RGChannelSet' [package "minfi"] with 6 slots...