ClinCNV icon indicating copy to clipboard operation
ClinCNV copied to clipboard

Error in returnAllowedChromsBaf -> returnBAlleleFreqs

Open sunyihong opened this issue 9 months ago • 8 comments

Hello, when I run somatic CNV, I got this error:

[1] "We are reading BAF files. It may take time - especially if you have a lot of SNV positions. 2024-05-14 10:40:39" Min. 1st Qu. Median Mean 3rd Qu. Max. 0.4007 0.4545 0.4841 0.4856 0.5141 0.5988 Error in if (!is.na(potentiallyHeterozygous)) { : the condition has length > 1 Calls: returnAllowedChromsBaf -> returnBAlleleFreqs Execution halted

any suggestions? thank you

sunyihong avatar May 14 '24 03:05 sunyihong

Hi, could you put a piece of code

print(potentiallyHeterozygous)

at the line 119 in this file

https://github.com/imgag/ClinCNV/blob/master/somatic/bafSegmentation.R

and send me the output?

It should be a simple vector and its summary seems to be sensible, but R somehow thinks it is not a simple vector, I guess...

GermanDemidov avatar May 14 '24 06:05 GermanDemidov

No, don't do this, replace

!is.na(potentiallyHeterozygous)

with length(potentiallyHeterozygous ) > 0

and let me know if it works!

GermanDemidov avatar May 14 '24 07:05 GermanDemidov

Hi, then I got the new error: [1] "We have found sample with name A1_1_n in our normal.cov file! We will try to analyse it. Remember - we still have to calculate all the parameters (the most time consuming step)..." [1] "We are reading BAF files. It may take time - especially if you have a lot of SNV positions. 2024-05-14 15:55:11" Min. 1st Qu. Median Mean 3rd Qu. Max. 0.4007 0.4545 0.4841 0.4856 0.5141 0.5988 [1] "Heterozygous allele shift for particular sample 0.484142" Error in if (is.na(prob)) { : the condition has length > 1 Calls: returnAllowedChromsBaf ... apply -> FUN -> determineHeterozygousPositionsOverdispersed Execution halted

sunyihong avatar May 14 '24 08:05 sunyihong

in old R versions it was an acceptable code style but I think it fails with the newer ones...

is.na(prob) in https://github.com/imgag/ClinCNV/blob/master/somatic/helpersBalleleFreq.R has to be replaced any(is.na(prob)), in two places. Could you do it and tell me the next error, if any?

Which R version do you use? Because if it is the new one I probably have to adapt the rest of the script and make a new release.

GermanDemidov avatar May 14 '24 08:05 GermanDemidov

The R version I used is 4.2.2, and I changed the code following your advice, got below error:

1] "We are reading BAF files. It may take time - especially if you have a lot of SNV positions. 2024-05-14 16:47:41" Min. 1st Qu. Median Mean 3rd Qu. Max. 0.4007 0.4545 0.4841 0.4856 0.5141 0.5988 [1] "Heterozygous allele shift for particular sample 0.484142" Error in if ((prob > 0.05)) { : the condition has length > 1 Calls: returnAllowedChromsBaf ... apply -> FUN -> determineHeterozygousPositionsOverdispersed Execution halted

sunyihong avatar May 14 '24 09:05 sunyihong

But I use R version 4.1.2 without any code change, it works!

sunyihong avatar May 14 '24 09:05 sunyihong

Hi @sunyihong - so it works for you now?

I will debug the tool for the newest version, seems that something fundamentally changed in the language (so many conditions failed, damn), so I'll try to hunt it down, but probably not today

GermanDemidov avatar May 14 '24 09:05 GermanDemidov

Yes! Thanks!!!

sunyihong avatar May 14 '24 09:05 sunyihong