Esempio n. 1
0
    def view(self, spec='p', **kwargs):
        """Visualization of the Hi-C map and domains (if present). The function makes use 
        of :func:`.showMatrix`.
        
        :arg spec: a string specifies how to preprocess the matrix. Blank for no preprocessing,
                'p' for showing only data from *p*-th to *100-p*-th percentile. '_' is to suppress 
                creating a new figure and paint to the current one instead. The letter specifications 
                can be applied sequentially, e.g. 'p_'.
        :type spec: str

        :arg p: specifies the percentile threshold.
        :type p: double
        """

        dm_kwargs = {}
        keys = list(kwargs.keys())
        for k in keys:
            if k.startswith('dm_'):
                dm_kwargs[k[3:]] = kwargs.pop(k)
            elif k.startswith('domain_'):
                dm_kwargs[k[7:]] = kwargs.pop(k)

        M = self.map
        if 'p' in spec:
            p = kwargs.pop('p', 5)
            lp = kwargs.pop('lp', p)
            hp = kwargs.pop('hp', 100 - p)
            vmin = np.percentile(M, lp)
            vmax = np.percentile(M, hp)
        else:
            vmin = vmax = None

        if not 'vmin' in kwargs:
            kwargs['vmin'] = vmin
        if not 'vmax' in kwargs:
            kwargs['vmax'] = vmax

        im = showMatrix(M, **kwargs)

        domains = self.getDomainList()
        if len(domains) > 1:
            showDomains(domains, **dm_kwargs)

        return im
Esempio n. 2
0
    def view(self, spec='p', **kwargs):
        """Visualization of the Hi-C map and domains (if present). The function makes use 
        of :func:`.showMap`."""

        dm_kwargs = {}
        keys = kwargs.keys()
        for k in keys:
            if k.startswith('dm_'):
                dm_kwargs[k[3:]] = kwargs.pop(k)
            elif k.startswith('domain_'):
                dm_kwargs[k[7:]] = kwargs.pop(k)

        im = showMap(self.map, spec, **kwargs)

        domains = self.getDomainList()
        if len(domains) > 1:
            showDomains(domains, **dm_kwargs)

        return im