bamdst icon indicating copy to clipboard operation
bamdst copied to clipboard

How to use multiple args in '--cutoffdepth'

Open HEKntg opened this issue 6 years ago • 3 comments

like --cutoffdepth 500, 750, 1000 seems bamdst can only recognize the first number

HEKntg avatar Jul 04 '18 07:07 HEKntg

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.

shiquan avatar Jul 09 '18 08:07 shiquan

Thanks!

HEKntg avatar Jul 09 '18 08:07 HEKntg

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]

gudeqing avatar Aug 24 '23 07:08 gudeqing

now support, thanks to @biolxy

shiquan avatar Apr 30 '24 14:04 shiquan