コード例 #1
0
ファイル: Occupancy.py プロジェクト: wzthu/NucleoATAC
 def callPeaks(self):
     """Call peaks of occupancy profile"""
     peaks = call_peaks(self.occ.smoothed_vals, sep = self.params.sep, min_signal = self.params.min_occ)
     for peak in peaks:
         tmp = OccPeak(peak + self.start, self)
         if tmp.occ_lower > self.params.min_occ and tmp.reads > 0:
             self.peaks[peak] = tmp
コード例 #2
0
 def findAllNucs(self):
     """Find peaks in data"""
     self.nuc_collection = {}
     combined = self.norm_signal.vals + self.smoothed.vals
     #find peaks in normalized sigal
     cands1 = call_peaks(combined,
                         min_signal=0,
                         sep=self.params.redundant_sep,
                         boundary=self.params.nonredundant_sep // 2,
                         order=self.params.redundant_sep // 2)
     for i in cands1:
         nuc = Nucleosome(i + self.start, self)
         if nuc.nuc_cov > self.params.min_reads:
             nuc.getLR(self)
             if nuc.lr > self.params.min_lr:
                 nuc.getZScore(self)
                 if nuc.z >= self.params.min_z:
                     nuc.getOcc(self)
                     self.nuc_collection[i] = nuc
     self.sorted_nuc_keys = np.array(sorted(self.nuc_collection.keys()))
     self.nonredundant = reduce_peaks(
         self.sorted_nuc_keys,
         [self.nuc_collection[x].z
          for x in self.sorted_nuc_keys], self.params.nonredundant_sep)
     self.redundant = np.setdiff1d(self.sorted_nuc_keys, self.nonredundant)
コード例 #3
0
 def findAllNucs(self):
     """Find peaks in data"""
     self.nuc_collection = {}
     combined = self.norm_signal.vals + self.smoothed.vals
     # find peaks in normalized sigal
     cands1 = call_peaks(
         combined,
         min_signal=0,
         sep=self.params.redundant_sep,
         boundary=self.params.nonredundant_sep / 2,
         order=self.params.redundant_sep / 2,
     )
     for i in cands1:
         nuc = Nucleosome(i + self.start, self)
         if nuc.nuc_cov > self.params.min_reads:
             nuc.getLR(self)
             if nuc.lr > self.params.min_lr:
                 nuc.getZScore(self)
                 if nuc.z >= self.params.min_z:
                     nuc.getOcc(self)
                     self.nuc_collection[i] = nuc
     self.sorted_nuc_keys = np.array(sorted(self.nuc_collection.keys()))
     self.nonredundant = reduce_peaks(
         self.sorted_nuc_keys,
         map(lambda x: self.nuc_collection[x].z, self.sorted_nuc_keys),
         self.params.nonredundant_sep,
     )
     self.redundant = np.setdiff1d(self.sorted_nuc_keys, self.nonredundant)
コード例 #4
0
ファイル: test_utils.py プロジェクト: xubeisi/NucleoATAC
 def test_call_peaks_case1(self):
     """test case1 for call_peaks"""
     peaks = call_peaks(np.array([1, 2, 3, 2, 1, 4, 1, 2, 1, 0, 0]),
                        min_signal=1,
                        sep=3)
     self.assertTrue(np.array_equal(peaks, np.array([2, 5])))
コード例 #5
0
ファイル: test_utils.py プロジェクト: JordiAlbert/NucleoATAC
 def test_call_peaks_case1(self):
     """test case1 for call_peaks"""
     peaks = call_peaks(np.array([1,2,3,2,1,4,1,2,1,0,0]),min_signal=1,sep=3)
     self.assertTrue(np.array_equal(peaks,np.array([2,5])))