File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -243,6 +243,32 @@ rule bcftools_mpileup_all_sites:
243243 "bcftools query -f '%CHROM\t %POS\t %REF\t %ALT\t %DP\t [ %AD]\t [ %ADF]\t [ %ADR]\n ' {output.mpileup:q} >>{output.query:q} 2>{log.query:q}"
244244
245245
246+ rule filter_mpileup_all_sites :
247+ threads : 1
248+ params :
249+ min_total_AD = config ["VC" ]["MIN_DEPTH" ],
250+ min_total_ADF = 0 ,
251+ min_total_ADR = 0 ,
252+ input :
253+ OUTDIR / "bcftools_mpileup_all_sites" / "{sample}.query.tsv" ,
254+ output :
255+ OUTDIR / "bcftools_mpileup_all_sites" / "{sample}.filtered.tsv" ,
256+ log :
257+ LOGDIR / "filter_mpileup_all_sites" / "{sample}.txt"
258+ run :
259+ import pandas as pd
260+ df = pd .read_csv (input [0 ], sep = "\t " )
261+ df ["ref_AD" ] = df .AD .str .split ("," ).apply (lambda values : int (values [0 ]))
262+ df ["total_AD" ] = df .AD .str .split ("," ).apply (lambda values : sum (int (n ) for n in values ))
263+ df ["total_ADF" ] = df .ADF .str .split ("," ).apply (lambda values : sum (int (n ) for n in values ))
264+ df ["total_ADR" ] = df .ADR .str .split ("," ).apply (lambda values : sum (int (n ) for n in values ))
265+ df [
266+ (df .total_AD >= params .min_total_AD ) &
267+ (df .total_ADF >= params .min_total_ADF ) &
268+ (df .total_ADR >= params .min_total_ADR )
269+ ].to_csv (output [0 ], sep = "\t " , index = False )
270+
271+
246272rule pairwise_trajectory_correlation :
247273 conda : "../envs/renv.yaml"
248274 input :
You can’t perform that action at this time.
0 commit comments