deeptools / deepTools

Tools to process and analyze deep sequencing data.
Other
670 stars 207 forks source link

Changing x and y-axes of plotCoverage #998

Closed EveTC closed 4 years ago

EveTC commented 4 years ago

Hello

Firstly - thank you for this tool it is proving super useful! I am using deeptools 3.5.0

I have successfully run plotCoverage on my .bam file and it has output the coverage plot.

However, is there a way to change the limits of the x and y-axis? My apologies if there is a simple solution. I am new to these types of tools and could not find a solution online.

Thanks in advance! Eve

LeilyR commented 4 years ago

At the moment it can not be given in the command line and user needs to change it here: https://github.com/deeptools/deepTools/blob/master/deeptools/plotCoverage.py#L328 I will add it into the todo list for the next release though.

EveTC commented 4 years ago

Fantastic thank you @LeilyR

zeyak commented 2 years ago

Hi,

Can I make the change to the script that I installed through conda? I couldn't find the script in the bin. I've also tried installing it through git clone but then python setup.py didn't work properly. The package was missing all the libraries like numpy, matplotlib etc.

Thanks in advance!

dpryan79 commented 2 years ago

You can edit the package after installing via conda. It will be under $PREFIX/lib. You'll need to delete __pycache for it to be recognized (within the same directory).

zeyak commented 2 years ago

Okay, thanks. I did manage to install and set up deeptools without conda. I also manipulated the script and now it looks like this:

        # Don't clip plots
        y_max = max(y_max)
        if args.plotFileFormat == "plotly":
            fig.add_traces(data)
            fig['layout']['yaxis1'].update(range=[0.0, y_max])
            fig['layout']['yaxis2'].update(range=[0.0, 1.0])
            py.plot(fig, filename=args.plotFile, auto_open=False)
        else:
            axs[0].set_ylim(0, y_max)
            axs[0].set_xlim(0, x_max)
            axs[0].set_xlabel('coverage (#reads per bp)')
            axs[0].legend(fancybox=True, framealpha=0.5)
            axs[0].set_ylabel('fraction of bases sampled')
            # plot cumulative coverage
            axs[1].set_xlim(0, x_max)
            axs[1].set_xlabel('coverage (#reads per bp)')
            axs[1].set_ylabel('fraction of bases sampled >= coverage')
            axs[1].legend(fancybox=True, framealpha=0.5)
            plt.savefig(args.plotFile, format=args.plotFileFormat)
            plt.close()

however, my plot is still cliped on the y-axis. Masurca_3_coverage