示例#1
0
 def test_plot_boxplot(self):
     distribs = numpy.array(
         [
             [0, 0, 0, 0, 0, 1, 3, 5, 3, 1],
             [0, 0, 0, 0, 1, 3, 5, 3, 1, 0],
             [0, 1, 3, 5, 3, 1, 0, 0, 0, 0],
             [1, 3, 5, 3, 1, 0, 0, 0, 0, 0],
         ]
     )
     mpl_params = {
         "set_xlabel": {"args": ["Samples"], "kwargs": {}},
         "set_ylabel": {"args": ["Depth"], "kwargs": {}},
     }
     with NamedTemporaryFile(suffix=".png") as fhand:
         plot_boxplot_from_distribs(distribs, fhand=fhand, mpl_params=mpl_params)
def plot_called_gts_distrib_per_depth(h5, depths, data_dir,
                                      chunk_size=SNPS_PER_CHUNK):
    # Distribution of the number of samples with a depth higher than
    # given values
    distribs, _ = calc_called_gts_distrib_per_depth(h5, depths=depths,
                                                    chunk_size=chunk_size)
    
    fpath = join(data_dir, 'gts_distribution_per_depth.png')
    title = 'Distribution of the number of samples with a depth higher than'
    title += ' given values'
    mpl_params = {'set_xlabel': {'args': ['Depth'], 'kwargs': {}},
                  'set_ylabel': {'args': ['Number of samples'], 'kwargs': {}},
                  'set_title': {'args': [title], 'kwargs': {}},
                  'set_xticklabels': {'args': [depths],
                                      'kwargs': {'rotation': 90}}}
    plot_boxplot_from_distribs(distribs, fhand=open(fpath, 'w'),
                               figsize=(15, 10), mpl_params=mpl_params,
                               color='tan')
示例#3
0
 def test_plot_boxplot(self):
     distribs = numpy.array([[0, 0, 0, 0, 0, 1, 3, 5, 3, 1],
                             [0, 0, 0, 0, 1, 3, 5, 3, 1, 0],
                             [0, 1, 3, 5, 3, 1, 0, 0, 0, 0],
                             [1, 3, 5, 3, 1, 0, 0, 0, 0, 0]])
     mpl_params = {
         'set_xlabel': {
             'args': ['Samples'],
             'kwargs': {}
         },
         'set_ylabel': {
             'args': ['Depth'],
             'kwargs': {}
         }
     }
     with NamedTemporaryFile(suffix='.png') as fhand:
         plot_boxplot_from_distribs(distribs,
                                    fhand=fhand,
                                    mpl_params=mpl_params)
示例#4
0
def plot_called_gts_distrib_per_depth(h5,
                                      depths,
                                      data_dir,
                                      chunk_size=SNPS_PER_CHUNK):
    # Distribution of the number of samples with a depth higher than
    # given values
    distribs, _ = calc_called_gts_distrib_per_depth(h5,
                                                    depths=depths,
                                                    chunk_size=chunk_size)

    fpath = join(data_dir, 'gts_distribution_per_depth.png')
    title = 'Distribution of the number of samples with a depth higher than'
    title += ' given values'
    mpl_params = {
        'set_xlabel': {
            'args': ['Depth'],
            'kwargs': {}
        },
        'set_ylabel': {
            'args': ['Number of samples'],
            'kwargs': {}
        },
        'set_title': {
            'args': [title],
            'kwargs': {}
        },
        'set_xticklabels': {
            'args': [depths],
            'kwargs': {
                'rotation': 90
            }
        }
    }
    plot_boxplot_from_distribs(distribs,
                               fhand=open(fpath, 'w'),
                               figsize=(15, 10),
                               mpl_params=mpl_params,
                               color='tan')