Skip to content

Commit

Permalink
add sentinel files to teh rules #2
Browse files Browse the repository at this point in the history
  • Loading branch information
dariushghasemi committed Nov 20, 2024
1 parent d3f39ea commit 9ad3d72
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions workflow/Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@ configfile: "conf/config.yaml"
include: "rules/common.smk"

rule all:
input: expand("results/ld_reshaped/{seqid}", seqid = lb.phenotype_id),
input: expand("results/ld_reshaped/{seqid}.sentinel", seqid = lb.phenotype_id),


rule compute_ld:
input:
loci="/scratch/dariush.ghasemi/projects/pqtl_pipeline_finemap/results/seq.4407.10/break/{seqid}_loci.csv",
output:
ofile = "results/ld/{seqid}",
sentinel = "results/ld/{seqid}.sentinel"
params:
#loci = get_locus,
bfile = config["genotype"],
Expand Down Expand Up @@ -49,9 +50,12 @@ rule compute_ld:
--out {output.ofile}_chr"$loc" \
--threads 8 \
--memory 16000
fi
echo "====================================================================="
fi
done < "$loci_list"
touch {output.sentinel}
"""


Expand All @@ -61,13 +65,14 @@ rule reshape_ld:
ld="results/ld/{seqid}",
output:
ofile = "results/ld_reshaped/{seqid}",
sentinel= "results/ld_reshaped/{seqid}.sentinel"
resources:
runtime=lambda wc, attempt: 120 + attempt * 60,
shell:
"""
loci_list={input.loci};
ifile=echo {input.loci}
ifile=$(echo {input.loci})
ofile=$(echo {output.ofile})
while IFS=, read -r col1 col2 col3 col4_onwards; do
Expand All @@ -93,10 +98,10 @@ rule reshape_ld:
awk '{{print $6"\t"$3"\t"$7"\t"$7}}' OFS="\t" | \
sed -e '1s/SNP_B/snp1/' -e '1s/SNP_A/snp2/' -e '1s/R2/dprime/' -e '1s/R2/rsquare/' | \
sed -E 's/([0-9]+:[0-9]+):([A-Z]+):([A-Z]+)/\1_\2\/\3/g' > ${{ld_tidy}}
echo "====================================================================="
fi
done < "$loci_list"
echo "====================================================================="
touch {output.sentinel}
"""


0 comments on commit 9ad3d72

Please sign in to comment.