ryanlayer / samplot

Plot structural variant signals from many BAMs and CRAMs
MIT License
512 stars 67 forks source link

Prevent cutting of coverage peak tip #113

Open leiendeckerlu opened 4 years ago

leiendeckerlu commented 4 years ago

Hi there,

any hint how I can prevent that samplot cuts off the tips of the coverage track? Or otherwise, is there a possibility to manually set the coverage range that should be plotted, so that I can manually add some margin on the top?

image

Many thanks, Lukas

jbelyeu commented 4 years ago

Hi Lukas! This behavior is intended to prevent small spikes in coverage from throwing off the scale of overall coverage plots. Can you share why this is an issue, just to help us understand the use case?

As for a fix, try the --same_yaxis_scales option. I believe that should prevent the cutoff and if not I'm happy to work with you on another solution.

leiendeckerlu commented 4 years ago

Hey,

for me, it is really just a personal preference. I would like to put together some plots for a publication and to me, this cutoff looks like I would wanna hide something.

I tried as you suggested with the --same_yaxis_scales option, however it throws the following error

python /Software/samplot/samplot/src/samplot.py \
-b Sample-171.mkD.sorted.bam \
-n Sample-171 \
-o test.svg -c MCV \
-s 1 -e 7900 \
--coverage_only \
--same_yaxis_scales

Error message:

Traceback (most recent call last): File "/Software/samplot/samplot/src/samplot.py", line 1341, in if curr_max > max_coverage: TypeError: '>' not supported between instances of 'list' and 'int'

jbelyeu commented 4 years ago

looks like you're using a very old version of samplot. I'd recommend installing from conda (conda install -c bioconda samplot). In addition to fixing many bugs, that will install samplot as a command-line tool rather than a raw script, allowing you to execute with out having to use the full path. Your command above will become:

samplot plot \
    -b Sample-171.mkD.sorted.bam \
    -n Sample-171 \
    -o test.svg -c MCV \
    -s 1 -e 7900 \
    --coverage_only \
    --same_yaxis_scales
jbelyeu commented 4 years ago

in my version the yaxis still gets trimmed a tiny bit with that arg, so I've pushed a change to fix it in samplot version 1.0.19. The new version will take a few hours or perhaps a day to go live on conda

leiendeckerlu commented 3 years ago

Hey,

so I tried now to switch to the conda install to install samplot in a miniconda py 2.7 environment I'm however stuck with samplot 1.0.10:

[lukas.leiendecker@clip-login-0 samplot_py27]$ conda install samplot
Collecting package metadata (current_repodata.json): done
Solving environment: done

# All requested packages already installed.

[lukas.leiendecker@clip-login-0 samplot_py27]$ samplot
usage: samplot [-h] [-v] {plot,vcf} ...
samplot: error: too few arguments
[lukas.leiendecker@clip-login-0 samplot_py27]$ samplot --version
samplot 1.0.10
[lukas.leiendecker@clip-login-0 samplot_py27]$ conda update samplot
Collecting package metadata (current_repodata.json): done
Solving environment: done

# All requested packages already installed.

[lukas.leiendecker@clip-login-0 samplot_py27]$

if I do the same execise with py 3.8 I get the following error:

[lukas.leiendecker@clip-login-0 samplot]$ conda install samplot
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: /
Found conflicts! Looking for incompatible packages.
This can take several minutes.  Press CTRL-C to abort.
failed

UnsatisfiableError: The following specifications were found to be incompatible with each other:

Output in format: Requested package -> Available versions

[lukas.leiendecker@clip-login-0 samplot]$

any idea what the problem in any of the two cases is?

Thanks, Lukas

jbelyeu commented 3 years ago

Not sure. I'd guess there's an issue with your conda installation (conda is fragile, I find myself re-installing due to similar problems regularly). You could try specifying the version on install: conda install samplot=1.0.19

leiendeckerlu commented 3 years ago

manage with the help of HPC to get the 1.0.19, but it still cuts off the tip. When I open the PDF/SVG in Illustrator though I can see that it is being indeed plotted but just hidden in a different layer...

ryanlayer commented 3 years ago

can you share a snip of the BAM that contains the region of interest and the common you used to generate the image?

On Wed, Sep 23, 2020 at 8:51 AM Lukas Leiendecker notifications@github.com wrote:

manage with the help of HPC to get the 1.0.19, but it still cuts off the tip. When I open the PDF/SVG in Illustrator though I can see that it is being indeed plotted but just hidden in a different layer...

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ryanlayer/samplot/issues/113#issuecomment-697482211, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEUGUIMYYPG5HKQ3ZME6LTSHIDNRANCNFSM4RQEMOCA .