hovestadtlab / conumee2

MIT License
3 stars 5 forks source link

CNV.segment function #1

Closed SAADAT-Abu closed 8 months ago

SAADAT-Abu commented 8 months ago

I have this code

detail<-GRanges(seqnames=c("chr11","chr11"),
                 ranges = IRanges(start = c(1018812, 2719948), end = c(1024740, 2722259)))
values(detail)<- DataFrame(name = c("H19/IGF2:IG-DMR", "KCNQ1OT1:TSS-DMR"))

anno<-CNV.create_anno(array_type = "EPIC",detail_regions = detail)
Intensities <- CNV.load(myLoad$mset) # Loading intensity data
anno@probes<-anno@probes[names(anno@probes) %in% rownames(Intensities@intensity)] # Removing probes from anno absent from Intensity due to QC
Intensities@intensity<- subset(Intensities@intensity, rownames(Intensities@intensity) %in% names(anno@probes)) # Removing probes absent from anno
x <- CNV.fit(minfi.data["WT11"], minfi.data[minfi.controls], anno)
x <- CNV.bin(x)
x<-CNV.detail(x)
x <- CNV.segment(x)
CNV.genomeplot(x)

Which is giving me this error:

> x <- CNV.segment(x)
WT11 (100%)
Error in if (min(weights) <= 0) stop("all weights should be positive") : 
  missing value where TRUE/FALSE needed

I checked for missing values in Intensities but didn't found any. Would be glad to have any help.

Thanks a lot. A. Saadat

bjarnedae commented 8 months ago

Thank you for your comment! The error might occur due to the chosen preprocessing/normalization method at the beginning of the workflow. The anno object is manipulated by removing all probes that are absent in the Intensity object, even though the genomic binning was already performed based on the entirety of probes.

I would suggest to use the preprocessIllumina function from the minfi package to generate the mset object. This function achieved very accurate results in our analyses and ensures that all probes used for the anno object are also part of the Intensity object. No additional manipulation of both objects is required, thus avoiding the error message. I hope that this is helpful and please reach out if you encounter further issues.

Thanks, B. Daenekas

SAADAT-Abu commented 8 months ago

It worked. Thanks a lot.

Regards A. Saadat