You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Error in if (tvar < 0) { : argument is of length zero
Calls: run_clonal_ASCAT -> recalc_psi_t -> is.segment.clonal -> <Anonymous>
Execution halted
As the error suggests, it happens in fit.copy.number -> run_clonal_ASCAT -> recalc_psi_t -> is.segment.clonal
After a long debugging session, I believe the cause of the issue is that somehow in is.segment.clonal, the segment is calculated to have negative nMajor even after nMinor gets adjusted to 0.01.
# check for big shifts in nMajor - if there's a big shift, we shouldn't trust a clonal call
nMajor.saved=nMajor
## to make sure we're always in a positive square:
#if(nMajor < 0) {
# nMajor = 0.01
#}
#
#if(nMinor < 0) {
# nMinor = 0.01
#}
#DCW - increase nMajor and nMinor together, to avoid impossible combinations (with negative subclonal fractions)
if(nMinor<0){
if(BAFreq==1){
#avoid calling infinite copy number
nMajor=1000
}else{
nMajor=nMajor+BAFreq* (0.01-nMinor) / (1-BAFreq)
}
nMinor=0.01
}
This results in the following two values test.BAF_levels = c(NA, NA) whichclosestlevel.test = integer(0)
going in to the function where the error accors calc_Pvalue_t_twotailed( BAF.size, BAFreq, BAF.sd, test.BAF_levels[whichclosestlevel.test], maxdist_BAF)
As the error suggests, it happens in
fit.copy.number -> run_clonal_ASCAT -> recalc_psi_t -> is.segment.clonal
After a long debugging session, I believe the cause of the issue is that somehow in
is.segment.clonal
, the segment is calculated to have negativenMajor
even afternMinor
gets adjusted to 0.01.battenberg/R/clonal_ascat.R
Lines 384 to 403 in 4368667
This results in the following two values
test.BAF_levels = c(NA, NA)
whichclosestlevel.test = integer(0)
going in to the function where the error accors
calc_Pvalue_t_twotailed( BAF.size, BAFreq, BAF.sd, test.BAF_levels[whichclosestlevel.test], maxdist_BAF)
battenberg/R/clonal_ascat.R
Lines 77 to 100 in 4368667
The error gets triggered, because
tvar
cannot be calculated asmu_pop
islogical(0)
I'm trying to resolve this issue by adding a new condition that sets
pval = 0
iflength(test.BAF_levels[whichclosestlevel.test]) == 0
battenberg/R/clonal_ascat.R
Lines 433 to 440 in 4368667
The text was updated successfully, but these errors were encountered: