MACS3.Signal.CallPeakUnit module

Compute MACS3 peak-calling scores and helper statistics.

This code is free software; you can redistribute it and/or modify it under the terms of the BSD License (see the file LICENSE included with the distribution).

class MACS3.Signal.CallPeakUnit.CallerFromAlignments(treat, ctrl, d=200, ctrl_d_s=[200, 1000, 10000], treat_scaling_factor=1.0, ctrl_scaling_factor_s=[1.0, 0.2, 0.02], stderr_on=False, pseudocount=1, end_shift=0, lambda_bg=0, save_bedGraph=False, bedGraph_filename_prefix='PREFIX', bedGraph_treat_filename='TREAT.bdg', bedGraph_control_filename='CTRL.bdg', cutoff_analysis_filename='TMP.txt', save_SPMR=False)

Bases: object

Compute pileups, scores, and peaks from FWTrack/PETrack alignments.

PE_mode: _fake_callable
bedGraph_control_filename: bytes
bedGraph_ctrl_f: PointerInstance
bedGraph_filename_prefix: bytes
bedGraph_treat_f: PointerInstance
bedGraph_treat_filename: bytes
call_broadpeaks(scoring_function_symbols, lvl1_cutoff_s, lvl2_cutoff_s, min_length=200, lvl1_max_gap=50, lvl2_max_gap=400, cutoff_analysis=False)

This function try to find enriched regions within which, scores are continuously higher than a given cutoff for level 1, and link them using the gap above level 2 cutoff with a maximum length of lvl2_max_gap.

scoring_function_s: symbols of functions to calculate score. ‘p’ for pscore, ‘q’ for qscore, ‘f’ for fold change, ‘s’ for subtraction. for example: [‘p’, ‘q’]

lvl1_cutoff_s: of: list cutoffs at highly enriched regions, corresponding to scoring functions.

lvl2_cutoff_s: of: list cutoffs at less enriched regions, corresponding to scoring functions.

min_length : minimum peak length, default 200.

lvl1_max_gap : maximum gap to merge nearby enriched peaks, default 50.

lvl2_max_gap : maximum length of linkage regions, default 400.

Return both general PeakIO for: object highly enriched regions and gapped broad regions in BroadPeakIO.

call_peaks(scoring_function_symbols, score_cutoff_s, min_length=200, max_gap=50, call_summits=False, cutoff_analysis=False)

Call peaks for all chromosomes. Return a PeakIO object.

scoring_function_s: symbols of functions to calculate score. ‘p’ for pscore, ‘q’ for qscore, ‘f’ for fold change, ‘s’ for subtraction. for example: [‘p’, ‘q’] score_cutoff_s : cutoff values corresponding to scoring functions min_length : minimum length of peak max_gap : maximum gap of ‘insignificant’ regions within a peak. Note, for PE_mode, max_gap and max_length are both as: set fragment length. call_summits : boolean. Whether or not call sub-peaks. save_bedGraph : whether or not to save pileup and control into a bedGraph file

chr_pos_treat_ctrl: list
chromosomes: list
ctrl: object
ctrl_d_s: list
ctrl_scaling_factor_s: list
cutoff_analysis_filename: bytes
d: typedef
destroy()

Remove temporary pileup files created during peak calling.

enable_trackline()

Enable UCSC track line output when writing bedGraphs.

end_shift: typedef
lambda_bg: typedef
no_lambda_flag: _fake_callable
optimal_p_cutoff: typedef
pileup_data_files: dict
pileup_treat_ctrl_a_chromosome(chrom)

After this function is called, self.chr_pos_treat_ctrl will be reand: set assigned to the pileup values of the given chromosome.

pqtable: Float32to32Map
pseudocount: typedef
pvalue_all_done: _fake_callable
pvalue_length: dict
pvalue_npeaks: dict
save_SPMR: _fake_callable
save_bedGraph: _fake_callable
set_pseudocount(pseudocount)

Update the pseudocount used in scoring.

trackline: _fake_callable
treat: object
treat_scaling_factor: typedef
MACS3.Signal.CallPeakUnit.apply_multiple_cutoffs(multiple_score_arrays, multiple_cutoffs)

Count how many scores exceed their corresponding cutoffs.

Return type:

_fake_callable

MACS3.Signal.CallPeakUnit.bool(*args, **kwargs)
MACS3.Signal.CallPeakUnit.chi2_k1_cdf(x)

Return CDF of chi-square(1) evaluated at x.

Return type:

typedef

MACS3.Signal.CallPeakUnit.chi2_k2_cdf(x)

Return CDF of chi-square(2) evaluated at x.

Return type:

typedef

MACS3.Signal.CallPeakUnit.chi2_k4_cdf(x)

Return CDF of chi-square(4) evaluated at x.

Return type:

typedef

MACS3.Signal.CallPeakUnit.clean_up_ndarray(x)

Resize x to zero length, releasing its underlying buffer.

MACS3.Signal.CallPeakUnit.erf(*args, **kwargs)
MACS3.Signal.CallPeakUnit.exp(*args, **kwargs)
MACS3.Signal.CallPeakUnit.fclose(*args, **kwargs)
MACS3.Signal.CallPeakUnit.find_optimal_cutoff(x, y)

Return the best cutoff x and y.

We assume that total peak length increase exponentially while decreasing cutoff value. But while cutoff decreases to a point that background noises are captured, total length increases much faster. So we fit a linear model by taking the first 10 points, then look for the largest cutoff that

*Currently, it is coded as a useless function.

Return type:

tuple

MACS3.Signal.CallPeakUnit.fopen(*args, **kwargs)
MACS3.Signal.CallPeakUnit.fprintf(*args, **kwargs)
MACS3.Signal.CallPeakUnit.get_from_multiple_scores(multiple_score_arrays, index)

Return scores at index from each array in multiple_score_arrays.

Return type:

list

MACS3.Signal.CallPeakUnit.get_logFE(x, y)

Return log10 fold enrichment for x over y.

Return type:

typedef

MACS3.Signal.CallPeakUnit.get_logLR_asym(t)

Return asymmetric log10 likelihood ratio for parameters t.

Return type:

typedef

MACS3.Signal.CallPeakUnit.get_pscore(t)

Return cached -log10 Poisson tail probability for t.

Return type:

typedef

MACS3.Signal.CallPeakUnit.get_subtraction(x, y)

Return the difference x - y.

Return type:

typedef

MACS3.Signal.CallPeakUnit.getitem_then_subtract(peakset, start)

Return peak starts relative to start for axillary metrics.

Return type:

list

MACS3.Signal.CallPeakUnit.left_forward(data, pos, window_size)

Return incremental count entering pos from the left window.

Return type:

typedef

MACS3.Signal.CallPeakUnit.left_sum(data, pos, width)

Return cumulative sum within width bases to the left of pos.

Return type:

typedef

MACS3.Signal.CallPeakUnit.log10(*args, **kwargs)
MACS3.Signal.CallPeakUnit.log10_chi2_k1_cdf(x)

Return log10 CDF of chi-square(1) evaluated at x.

Return type:

typedef

MACS3.Signal.CallPeakUnit.log10_chi2_k2_cdf(x)

Return log10 CDF of chi-square(2) evaluated at x.

Return type:

typedef

MACS3.Signal.CallPeakUnit.log10_chi2_k4_CDF(x)

Return log10 CDF of chi-square(4) evaluated at x.

Return type:

typedef

MACS3.Signal.CallPeakUnit.log1p(*args, **kwargs)
MACS3.Signal.CallPeakUnit.mean_from_value_length(value, length)

take of: list values and of: list corresponding lengths, calculate the mean. An important function for bedGraph type of data.

Return type:

typedef

MACS3.Signal.CallPeakUnit.median_from_value_length(value, length)
Return type:

typedef

MACS3.Signal.CallPeakUnit.right_forward(data, pos, window_size)

Return incremental count exiting pos toward the right window.

Return type:

typedef

MACS3.Signal.CallPeakUnit.right_sum(data, pos, width)

Return cumulative sum within width bases to the right of pos.

Return type:

typedef

MACS3.Signal.CallPeakUnit.sqrt(*args, **kwargs)