MACS3.Signal.PeakModel module
Module Description: Build shifting model
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).
- exception MACS3.Signal.PeakModel.NotEnoughPairsException(value)
Bases:
Exception
- class MACS3.Signal.PeakModel.PeakModel(opt, treatment, max_pairnum=500)
Bases:
objectPeak Model class.
- alternative_d = None
- build()
Build the model. Main function of PeakModel class.
1. prepare self.d, self.scan_window, self.plus_line, self.minus_line and self.shifted_line.
find paired + and - strand peaks
find the best d using x-correlation
-
bw:
typedef
- d = None
-
d_min:
typedef
-
debug:
object
-
error:
object
-
gz:
typedef
-
info:
object
-
lmfold:
typedef
-
max_pairnum:
typedef
-
max_tags:
typedef
- min_tags = None
- minus_line = None
-
peaksize:
typedef
- plus_line = None
- scan_window = None
- shifted_line = None
-
summary:
str
-
tag_expansion_size:
typedef
-
treatment:
object
-
umfold:
typedef
-
warn:
object
- xcorr = None
- ycorr = None
- MACS3.Signal.PeakModel.bool(*args, **kwargs)
- MACS3.Signal.PeakModel.smooth(x, window_len=11, window='hanning')
smooth the data using a window with requested size.
This method is based on the convolution of a scaled window with the signal. The signal is prepared by introducing reflected copies of the signal (with the window size) in both ends so that transient parts are minimized in the beginning and end part of the output signal.
- input:
x: the input signal window_len: the dimension of the smoothing window; should be
an odd integer
- window: the type of window from ‘flat’, ‘hanning’, ‘hamming’,
‘bartlett’, ‘blackman’ flat window will produce a moving average smoothing.
- output:
the smoothed signal
example:
t=linspace(-2,2,0.1) x=sin(t)+randn(len(t))*0.1 y=smooth(x)
see also:
numpy.hanning, numpy.hamming, numpy.bartlett, numpy.blackman, numpy.convolve scipy.signal.lfilter
- TODO: the window parameter could be the window itself if an array
instead of a string
- NOTE: length(output) != length(input), to correct this: return
y[(window_len/2-1):-(window_len/2)] instead of just y.