bamdst
bamdst copied to clipboard
How to use multiple args in '--cutoffdepth'
like --cutoffdepth 500, 750, 1000 seems bamdst can only recognize the first number
The similar question has been reported here https://github.com/shiquan/bamdst/issues/3. I have added this requestion in my todo list. And I will close this issue after update.
Thanks!
Hi, I think a good alternative way is to derive needed metrics using a small python script, it is fast and easy, such as:
for sample, task in bamdst_task_dict.items():
stat_file = os.path.join(task.wkdir, task.outputs['coverage_report'].value)
depth_file = os.path.join(task.wkdir, task.outputs['depth_file'].value)
with open(stat_file) as f:
target_info = dict()
for line in f:
if line.startswith('#'):
continue
name, value = line.strip().split('\t')
if '%' in value:
value = round(float(value.replace('%', ''))*0.01, 4)
else:
value = float(value)
target_info[name] = value
# 计算均一性
data = pd.read_table(depth_file, header=0, low_memory=False)
mean_coverage = data['Cover depth'].mean()
target_info['[Target] Coverage (>=0.2*MeanDepth)'] = sum(data['Cover depth'] >= mean_coverage*0.2)/data.shape[0]
target_info['[Target] Coverage (>=0.5*MeanDepth)'] = sum(data['Cover depth'] >= mean_coverage*0.5)/data.shape[0]
target_info['[Target] Coverage (>=200x)'] = sum(data['Cover depth'] >= 200)/data.shape[0]
target_info['[Target] Coverage (>=300x)'] = sum(data['Cover depth'] >= 300)/data.shape[0]
target_info['[Target] Coverage (>=500x)'] = sum(data['Cover depth'] >= 500)/data.shape[0]
target_info['[Target] Coverage (>=1000x)'] = sum(data['Cover depth'] >= 1000)/data.shape[0]
target_info['[Target] Coverage (>=2000x)'] = sum(data['Cover depth'] > 2000)/data.shape[0]
target_info['[Target] Coverage (>=5000x)'] = sum(data['Cover depth'] > 5000)/data.shape[0]
target_info['[Target] Coverage (>=10000x)'] = sum(data['Cover depth'] > 10000)/data.shape[0]
now support, thanks to @biolxy