Hello everyone,
first of all, thanks for providing this handy package!
When troubleshooting my own issues with purity being reported as NA, I noticed that when checking for a pure and diploid tumor (
|
if(all(seg$tcn[seg$chrom<nX]==2 & seg$lcn[seg$chrom<nX]%in%c(1, NA))|max(mafR.clust[seg$chrom<nX & seg$nhet>min.nhet], na.rm = TRUE) < 0.05){ |
), the check whether any of the cluster
mafR is below the threshold of 0.05 has a misspecified selection vector. The
mafR.clus object is a vector of
length(unique(seg$segclust)), but the selection vector has
nrow(seg) elements. In the worst case, this could lead to a sample being reported as diploid and no tumor purity being reported when that is not acutally the case, but
seg$chrom < nX & seg$nhet > min.nhet happened to be
FALSE for all elements where the
mafR.clust vector was not
NA (i.e., when
all the segments, whose id/position corresponded to a segclust
ID/position with a non-NA
mafR.clust value, happend to be below the
nhet threshold). I don't know how likely this is, but it can't be ruled out that some of the open issues reporting
Warning message: In max(mat$chrom) : no non-missing arguments to max; returning -Inf (which is the result of
max not getting any non-
NA input), namely
#39,
#46, and
#86, may have encountered this issue when it can't be ruled out that it's strictly due to not enough segments passing the
nhet threshold.
In any case, subsetting by a vector that is almost always too long is something that is hard to spot when reading the code, so as far as I can tell this should be fixed. I'd propose just replacing it with seg$mafR.clust[seg$chrom < nX & seg$nhet > min.nhet], and getting rid of the the mafR.clust object entirely, since AFAICT, the mafR.clust column in the seg dataframe is already uniform for each cluster.
Hello everyone,
first of all, thanks for providing this handy package!
When troubleshooting my own issues with purity being reported as
NA, I noticed that when checking for a pure and diploid tumor (facets/R/facets-emcncf.R
Line 58 in f3c93ee
mafRis below the threshold of 0.05 has a misspecified selection vector. ThemafR.clusobject is a vector oflength(unique(seg$segclust)), but the selection vector hasnrow(seg)elements. In the worst case, this could lead to a sample being reported as diploid and no tumor purity being reported when that is not acutally the case, butseg$chrom < nX & seg$nhet > min.nhethappened to beFALSEfor all elements where themafR.clustvector was notNA(i.e., when all the segments, whose id/position corresponded to a segclust ID/position with a non-NAmafR.clustvalue, happend to be below thenhetthreshold). I don't know how likely this is, but it can't be ruled out that some of the open issues reportingWarning message: In max(mat$chrom) : no non-missing arguments to max; returning -Inf(which is the result ofmaxnot getting any non-NAinput), namely #39, #46, and #86, may have encountered this issue when it can't be ruled out that it's strictly due to not enough segments passing thenhetthreshold.In any case, subsetting by a vector that is almost always too long is something that is hard to spot when reading the code, so as far as I can tell this should be fixed. I'd propose just replacing it with
seg$mafR.clust[seg$chrom < nX & seg$nhet > min.nhet], and getting rid of the themafR.clustobject entirely, since AFAICT, themafR.clustcolumn in thesegdataframe is already uniform for each cluster.