Exemplo n.º 1
0
def test_genome_coverage_scale(testdir, mock_testclass):
    sample = 'POLR2A'
    bed = sample + '.bed'
    cov = sample + '-cov.bed'
    bw = sample + '-cov.bw'
    genome = 'human.sizes'
    scale = 1.5
    Bed.count_bed = MagicMock()
    gc.coverage = MagicMock()
    Bed.bedgraph_to_bigwig = MagicMock()
    gc.genome_coverage(sample, genome, scale=scale)
    Bed.count_bed.assert_not_called()
    gc.coverage.assert_called_once_with(bed, cov, genome, sample, scale, None, ())
    Bed.bedgraph_to_bigwig.assert_called_once_with(cov, bw, genome)
Exemplo n.º 2
0
def test_genome_coverage_three(testdir, mock_testclass):
    sample = 'POLR2A'
    bed = sample + '.bed'
    cov = sample + '-cov.bed'
    bw = sample + '-cov.bw'
    genome = 'human.sizes'
    count = 2000000
    Bed.count_bed = MagicMock(return_value=count)
    gc.coverage = MagicMock()
    Bed.bedgraph_to_bigwig = MagicMock()
    gc.genome_coverage(sample, genome, genomecov_args=('-3'))
    Bed.count_bed.assert_called_once_with(bed)
    gc.coverage.assert_called_once_with(bed, cov, genome, sample, BASE_SCALE / count, None, ('-3'))
    Bed.bedgraph_to_bigwig.assert_called_once_with(cov, bw, genome)
Exemplo n.º 3
0
def test_genome_coverage_positivestrand(testdir, mock_testclass):
    sample = 'POLR2A'
    bed = sample + '.bed'
    cov = sample + '-cov-pos.bed'
    bw = sample + '-cov-pos.bw'
    genome = 'human.sizes'
    strand = '+'
    count = 2000000
    Bed.count_bed = MagicMock(return_value=count)
    gc.coverage = MagicMock()
    Bed.bedgraph_to_bigwig = MagicMock()
    gc.genome_coverage(sample, genome, scale=None, strand=strand)
    Bed.count_bed.assert_called_once_with(bed)
    gc.coverage.assert_called_once_with(bed, cov, genome, sample, BASE_SCALE / count, strand, ())
    Bed.bedgraph_to_bigwig.assert_called_once_with(cov, bw, genome)
Exemplo n.º 4
0
def test_genome_coverage_suffix(testdir, mock_testclass):
    sample = 'POLR2A'
    input_suffix = '-forcov'
    output_suffix = '-outcov'
    bed = sample + input_suffix + '.bed'
    cov = sample + output_suffix + '.bed'
    bw = sample + output_suffix + '.bw'
    genome = 'human.sizes'
    count = 2000000
    Bed.count_bed = MagicMock(return_value=count)
    gc.coverage = MagicMock()
    Bed.bedgraph_to_bigwig = MagicMock()
    gc.genome_coverage(sample, genome, input_suffix=input_suffix, output_suffix=output_suffix)
    Bed.count_bed.assert_called_once_with(bed)
    gc.coverage.assert_called_once_with(bed, cov, genome, sample, BASE_SCALE / count, None, ())
    Bed.bedgraph_to_bigwig.assert_called_once_with(cov, bw, genome)
Exemplo n.º 5
0
def test_genome_coverage_scale_and_controlsuffix(testdir, mock_testclass):
    sample = 'POLR2A'
    bed = sample + '.bed'
    cov = sample + '-cov.bed'
    bw = sample + '-cov.bw'
    genome = 'human.sizes'
    control_suffix = '-input'
    control = sample + control_suffix + '.bed'
    count = 2000000
    control_count = 300000
    scale = BASE_SCALE / (count * control_count)
    Bed.count_bed = MagicMock(side_effect=[count, control_count])
    gc.coverage = MagicMock()
    Bed.bedgraph_to_bigwig = MagicMock()
    gc.genome_coverage(sample, genome, scale=1.5, control_suffix=control_suffix)
    Bed.count_bed.assert_any_call(bed)
    Bed.count_bed.assert_any_call(control)
    gc.coverage.assert_called_once_with(bed, cov, genome, sample, scale, None, ())
    Bed.bedgraph_to_bigwig.assert_called_once_with(cov, bw, genome)
Exemplo n.º 6
0
def test_genome_coverage_scale_and_spikesuffix(testdir, mock_testclass):
    sample = 'POLR2A'
    bed = sample + '.bed'
    cov = sample + '-cov.bed'
    bw = sample + '-cov.bw'
    genome = 'human.sizes'
    spike_suffix = '-pombe'
    spiked = sample + spike_suffix + '.bed'
    count = 2000000
    spiked_count = 400000
    scale = BASE_SCALE * spiked_count / count
    Bed.count_bed = MagicMock(side_effect=[count, spiked_count])
    gc.coverage = MagicMock()
    Bed.bedgraph_to_bigwig = MagicMock()
    gc.genome_coverage(sample, genome, scale=1.5, spike_suffix=spike_suffix)
    Bed.count_bed.assert_any_call(bed)
    Bed.count_bed.assert_any_call(spiked)
    gc.coverage.assert_called_once_with(bed, cov, genome, sample, scale, None, ())
    Bed.bedgraph_to_bigwig.assert_called_once_with(cov, bw, genome)