本文整理匯總了Python中joblib.Parallel.query方法的典型用法代碼示例。如果您正苦於以下問題:Python Parallel.query方法的具體用法?Python Parallel.query怎麽用?Python Parallel.query使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類joblib.Parallel
的用法示例。
在下文中一共展示了Parallel.query方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: find_TADs
# 需要導入模塊: from joblib import Parallel [as 別名]
# 或者: from joblib.Parallel import query [as 別名]
def find_TADs(self, data, gammalist=range(10, 110, 10), segmentation='potts',
minlen=3, drop_gamma=False, n_jobs='auto'):
'''
Finds TADs in data with a list of gammas. Returns a pandas DataFrame
with columns 'Start', 'End' and 'Gamma'. Use genome_intervals_to_chr on
the returned object to get coordinates in bed-style format and not in
coordinates of concatenated genome.
If *drop_gamma*, drops the 'Gamma' column (useful when using 1 gamma)
'''
raise DeprecationWarning('Will be deprecated or rewritten to use'\
'lavaburst: github.com/nezar-compbio/lavaburst')
if n_jobs is 'auto': #Empirical values on my computer; with >8 Gb memory try increasing n_jobs
if segmentation == 'potts':
n_jobs = 3
elif segmentation == 'armatus':
n_jobs = 6
if ~np.isfinite(data).any():
print 'Non-finite values in data, substituting them with zeroes'
data[~np.isfinite(data)] = 0
Wcomm, Wnull, pass_mask, length = _precalculate_TADs_in_array(data)
f = _calculate_TADs
if n_jobs >= 1:
from joblib import Parallel, delayed
domains = Parallel(n_jobs=n_jobs, max_nbytes=1e6)(
delayed(f)(Wcomm, Wnull, pass_mask, length, g, segmentation)
for g in gammalist)
elif n_jobs is None or n_jobs == False or n_jobs == 0:
domains = []
for g in gammalist:
domains_g = f(Wcomm, Wnull, pass_mask, length, g, segmentation)
domains.append(domains_g)
domains = pd.concat(domains, ignore_index=True)
domains = domains.query('End-Start>='+str(minlen)).copy()
domains = domains.sort(columns=['Gamma', 'Start', 'End'])
domains.reset_index(drop=True, inplace=True)
domains[['Start', 'End']] = domains[['Start', 'End']].astype(int)
domains[['Start', 'End']] *= self.resolution
domains = domains[['Start', 'End', 'Score', 'Gamma']]
if drop_gamma:
domains.drop('Gamma', axis=1, inplace=True)
domains = self.genome_intervals_to_chr(domains).reset_index(drop=True)
return domains