bjarnedae / conumee-2

4 stars 8 forks source link

Error with CNV.segment using EPICv2 samples #6

Open simonjuleseric2 opened 1 month ago

simonjuleseric2 commented 1 month ago

When calling CNV.segment, get the following error:

"Erreur dans if (min(weights) <= 0) stop("all weights should be positive") : valeur manquante là où TRUE / FALSE est requis"

This was done when trying to analyze EPICv2 samples

bjarnedae commented 1 month ago

Hi, could you share your code for creating the annotation object and the subsequent pipeline until CNV.bin()?

simonjuleseric2 commented 1 month ago

Here is the code I'm using:

library(minfi) library(conumee) library(conumee2.0) library(minfiData) library(CopyNeutralIMA) library(readr)

Load own data:

sample_sheet <- read_csv("M:/IPA/IUPA/USERS_PUBLIC/SBU/Recherche/idat_files/EPICV2_2/samplesheet.csv") rgSet<- CNV.import(array_type = "EPICv2", 'M:/IPA/IUPA/USERS_PUBLIC/SBU/Recherche/idat_files/EPICV2_2', sample_sheet=sample_sheet) rgSet.sentrix2name<-'samplex'

Controls

RGsetCtrl <- getCopyNeutralRGSet("IlluminaHumanMethylationEPIC") MsetCtrl <- preprocessIllumina(RGsetCtrl) MsetCtrl2<-mapToGenome(MsetCtrl)

Anotation

data(exclude_regions) data(detail_regions) anno <- CNV.create_anno(array_type = "EPICv2", exclude_regions = exclude_regions, detail_regions = detail_regions)

Load

d.data <- CNV.load(rgSet) c.data <- CNV.load(MsetCtrl) colnames(c.data@intensity)<-colnames(MsetCtrl)

select probes present in controls and sample1

anno@probes<- anno@probes[(anno@probes@ranges@NAMES %in% rownames(c.data@intensity)) & (anno@probes@ranges@NAMES %in% rownames(d.data@intensity))]

y <- CNV.fit(d.data, c.data, anno) y<-CNV.detail(CNV.bin(y))

y@bin$ratio$Sample1<-y@bin$ratio$Sample1[!is.na(y@bin$ratio$Sample1)]

y <- CNV.segment(y, min.width=3)

CNV.genomeplot(y)

I'm importing an EPICv2 sample locally and using CopyNeutralIMA for controls

bjarnedae commented 1 month ago

Thank you so much for sharing your code! The error occurs due to the manipulation of the probe set within the annotation object. Probes are being removed from the object after the binning step which causes some bins to not contain probes anymore, hence the segmentation fails.

I'm aware that you're doing that to create an overlap between the EPIC and EPICv2 probes. Unfortunately, this is not supported yet. Ideally, you would use control samples that were generated with EPICv2 as well. We are currently working on an update that fixes this issue. It will be posted next week. Best regards!