marbl / merqury

k-mer based assembly evaluation
Other
272 stars 19 forks source link

Error in zero_range(range) when plot spectra-asm #68

Closed xiaoaozqd closed 1 year ago

xiaoaozqd commented 2 years ago

When I Plot spectra-asm.hist, there is an error:

Rscript plot_spectra_cn.R -f hap.spectra-asm.hist -o hap.spectra-asm -z hap.dist_only.hist Loading required package: argparse Loading required package: ggplot2 Loading required package: scales [1] "x_max: 2177.5" "x_max: 2180"
[1] "y_max: 127518.6" [1] "## Line graph" Error in zero_range(range) : x must be length 1 or 2 Calls: spectra_cn_plot ... expand_limits_continuous_trans -> expand_range4 -> expand_range -> zero_range Execution halted

################# cat hap.dist_only.hist

Agenome-only 0 16117 Bgenome-only 0 18953 shared 0 1572

wc hap.spectra-asm.hist

81312 243936 1396046 hap.spectra-asm.hist

arangrhie commented 2 years ago

Hi @xiaoaozqd,

Could you try something like

Rscript plot_spectra_cn.R -f hap.spectra-asm.hist -o hap.spectra-asm -z hap.dist_only.hist -m 250 -n 1000 -t line

-m and -n defines the x_max and y_max.

plot_spectra_cn.R tries to auto-detect cutoffs to place the 1-copy and 2-copy peak in the plot. It could fail to detect the peak on some corner cases. Try to adjust -m and -n until you see the plot as you'd like.

Best, Arang