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:
objectCompute pileups, scores, and peaks from FWTrack/PETrack alignments.
- treat
Treatment track (FWTrack or PETrackI/PETrackII).
- ctrl
Control track (FWTrack or PETrackI/PETrackII).
- d
Fragment extension size for treatment (unused in PE mode).
- ctrl_d_s
Fragment extension size for control.
- treat_scaling_factor
Scaling factor for treatment.
- ctrl_scaling_factor_s
Scaling factors for control.
- lambda_bg
Minimum local bias to fill missing values.
- chromosomes
Common chromosome names in treat/control.
- pseudocount
Pseudocount used for logLR/FE/logFE calculations.
- bedGraph_filename_prefix
Prefix for pileup/lambda bedGraph outputs.
- end_shift
Shift applied to read ends before extension.
- trackline
Whether to emit UCSC track lines in bedGraph outputs.
- save_bedGraph
Whether to save pileup/lambda bedGraph files.
- save_SPMR
Whether to save pileup normalized per million reads.
- no_lambda_flag
Whether to ignore local lambda (use global only).
- PE_mode
Whether treatment is paired-end.
- 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.
- Parameters:
scoring_function_symbols (
list) – Symbols for score functions. Use'p'(pscore),'q'(qscore),'f'(fold change), or's'(subtraction). Example:['p', 'q'].lvl1_cutoff_s (
list) – Cutoffs for highly enriched regions.lvl2_cutoff_s (
list) – Cutoffs for linkage regions.min_length (
typedef) – Minimum peak length.lvl1_max_gap (
typedef) – Maximum gap to merge nearby peaks.lvl2_max_gap (
typedef) – Maximum length of linkage regions.cutoff_analysis (
_fake_callable) – Whether to compute cutoff-vs-peak metrics.
- Returns:
(PeakIO, BroadPeakIO)for level-1 peaks and broad regions.- Return type:
tuple
Examples
lvl1, broad = caller.call_broadpeaks(['p'], [5.0], [2.0])
- call_peaks(scoring_function_symbols, score_cutoff_s, min_length=200, max_gap=50, call_summits=False, cutoff_analysis=False)
Call narrow peaks for all chromosomes.
- Parameters:
scoring_function_symbols (
list) – Symbols for score functions. Use'p'(pscore),'q'(qscore),'f'(fold change), or's'(subtraction). Example:['p', 'q'].score_cutoff_s (
list) – Cutoff values corresponding toscoring_function_symbols.min_length (
typedef) – Minimum peak length.max_gap (
typedef) – Maximum gap of insignificant regions within a peak.call_summits (
_fake_callable) – Whether to call sub-peaks (summits).cutoff_analysis (
_fake_callable) – Whether to compute cutoff-vs-peak metrics.
- Returns:
Collection of called peaks.
- Return type:
Examples
peaks = caller.call_peaks(['p'], [5.0], min_length=200)
- chr_pos_treat_ctrl: list
- chromosomes: list
- ctrl: object
- ctrl_d_s: list
- ctrl_scaling_factor_s: list
- cutoff_analysis_filename: bytes
- d: int
- destroy()
Remove temporary pileup files created during peak calling.
- enable_trackline()
Enable UCSC track line output when writing bedGraphs.
- end_shift: int
- lambda_bg: float
- no_lambda_flag: _fake_callable
- optimal_p_cutoff: float
- 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: cykhash.Float32to32Map
- pseudocount: double
- 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: float
- MACS3.Signal.CallPeakUnit.clean_up_ndarray(x)
Resize
xto zero length, releasing its underlying buffer.
- 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.get_from_multiple_scores(multiple_score_arrays, index)
Return scores at
indexfrom each array inmultiple_score_arrays.- Return type:
list
- MACS3.Signal.CallPeakUnit.getitem_then_subtract(peakset, start)
Return peak starts relative to
startfor axillary metrics.- Return type:
list