Skip to content

PureCN crashes when plotting (plotTypeBAF) #399

@kmavrommatis

Description

@kmavrommatis

Describe the issue

I have segmented exomes from CNVkit and mutations called by Mutect2.
When I try PureCN on these outputs results in error

2025-11-26T12:38:04.105160918Z Error in plot.window(...) : need finite 'ylim' values
2025-11-26T12:38:04.105595439Z Calls: plotAbs ... .plotTypeBAF -> plot -> plot.default -> localWindow -> plot.window
2025-11-26T12:38:04.105602195Z In addition: Warning message:
2025-11-26T12:38:04.105606258Z In plot.default(xLogRatio, logRatio$log.ratio, ylab = "Copy Number log-ratio", :
2025-11-26T12:38:04.105610143Z NaNs produced
2025-11-26T12:38:04.105614003Z Execution halted

Although the remaining files from PureCn are created (e.g. _loh.csv)
the exit code of the program is 1, which throws off my wrapper scripts.

I have tried previous versions from 2.6.4 and I get the same error.

To Reproduce

Rscript /opt/PureCN/PureCN.R \
--out . --seed 1234 \
--alpha 0.005 --fun-segmentation Hclust \
--genome hg38 --mapping-bias-file /mapping_bias_Exome_hg38.rds \
--max-copy-number 8 --max-non-clonal 0.75 \
--max-ploidy 4 --max-purity 0.99 --min-ploidy 1.4 \
--min-purity 0.95 --model betabin --model-homozygous \
--post-optimize --sampleid sampleA \
--seg-file sampleA.call.seg --cores 8 \
--tumor sampleA.cnr \
--vcf sampleA.vcf.gz

Expected behavior
No errors.
In reality the figure output is not as important in my use case. A simple tryCatch that would catch the problem and allow the program to finish gracefully would be adequante

R version
R version 4.5.2 (2025-10-31)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions