Beispiel #1
0
 def hist_ORF_CDS_logscale(self,
                           alpha=0.5,
                           bins=40,
                           xlabel="Length",
                           ylabel="#"):
     self.hist_ORF_CDS_linearscale(alpha, bins, xlabel, ylabel)
     pylab.yscale("log")
Beispiel #2
0
    def hist_ZMW_subreads(self,
                          alpha=0.5,
                          hold=False,
                          fontsize=12,
                          grid=True,
                          xlabel="Number of ZMW passes",
                          ylabel="#",
                          label="",
                          title="Number of ZMW passes"):
        """Plot histogram of number of reads per ZMW (number of passes)

        :param float alpha: transparency of the histograms
        :param bool hold:
        :param int fontsize:
        :param bool grid:
        :param str xlabel:
        :param str ylabel:
        :param str label: label of the histogram (for the legend)
        :param str title:

        .. plot::
            :include-source:

            from sequana.pacbio import BAMPacbio
            from sequana import sequana_data
            b = BAMPacbio(sequana_data("test_pacbio_subreads.bam"))
            b.hist_ZMW_subreads()
        """
        if self._nb_pass is None:
            self._get_ZMW_passes()

        max_nb_pass = max(self._nb_pass.keys())
        k = range(1, max_nb_pass + 1)
        val = [self._nb_pass[i] for i in k]

        # histogram nb passes
        if hold is False:
            pylab.clf()
        pylab.bar(k, val, alpha=alpha, label=label)
        if len(k) < 5:
            pylab.xticks(range(6), range(6))

        pylab.xlabel(xlabel, fontsize=fontsize)
        pylab.ylabel(ylabel, fontsize=fontsize)
        pylab.yscale('log')
        pylab.title(title, fontsize=fontsize)
        if grid is True:
            pylab.grid(True)
Beispiel #3
0
    def hist_ZMW_subreads(self, hold=False, fontsize=12,
                            grid=True,xlabel="Number of ZMW passes",ylabel="#"):
        """
        Plot histogram of number of reads per ZMW
        """
        if self._nb_pass is None:
            self._get_ZMW_passes()

        max_nb_pass = max(self._nb_pass.keys())
        k = range(1,max_nb_pass+1)
        val = [self._nb_pass[i] for i in k]

        # histogram nb passes
        if hold is False:
            pylab.clf()
        pylab.hist(k, weights=val, bins=max_nb_pass)
        pylab.xlabel(xlabel, fontsize=fontsize)
        pylab.ylabel(ylabel, fontsize=fontsize)
        pylab.yscale('log')
        pylab.title("Number of ZMW passes",fontsize=fontsize)
        if grid is True:
            pylab.grid(True)
Beispiel #4
0
 def hist_ORF_CDS_logscale(self, alpha=0.5, bins=40, xlabel="Length", ylabel="#"):
     self.hist_ORF_CDS_linearscale(alpha, bins, xlabel, ylabel)
     pylab.yscale("log")