Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: .nosex missing issue (Issue 349) #356

Merged
merged 1 commit into from
Nov 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 28 additions & 68 deletions src/cgr_gwas_qc/workflow/modules/plink.smk
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,10 @@ rule sample_call_rate_filter:
mem_mb=lambda wildcards, attempt: attempt * 1024,
time_hr=lambda wildcards, attempt: attempt**2,
shell:
"plink "
"--bed {input.bed} "
"--bim {input.bim} "
"--fam {input.fam} "
"--mind {params.mind} "
"--make-bed "
"--threads {threads} "
"--memory {resources.mem_mb} "
"--out {params.out_prefix}"

"""
plink --bed {input.bed} --bim {input.bim} --fam {input.fam} --mind {params.mind} --make-bed --threads {threads} --memory {resources.mem_mb} --out {params.out_prefix}
touch {output.nosex}
"""

rule snp_call_rate_filter:
input:
Expand All @@ -78,16 +72,10 @@ rule snp_call_rate_filter:
mem_mb=lambda wildcards, attempt: attempt * 1024,
time_hr=lambda wildcards, attempt: attempt**2,
shell:
"plink "
"--bed {input.bed} "
"--bim {input.bim} "
"--fam {input.fam} "
"--geno {params.geno} "
"--make-bed "
"--threads {threads} "
"--memory {resources.mem_mb} "
"--out {params.out_prefix}"

"""
plink --bed {input.bed} --bim {input.bim} --fam {input.fam} --geno {params.geno} --make-bed --threads {threads} --memory {resources.mem_mb} --out {params.out_prefix}
touch {output.nosex}
"""

rule maf_filter:
"""Filter SNPs based on minor allele frequency."""
Expand Down Expand Up @@ -147,16 +135,10 @@ rule ld_filter:
resources:
mem_mb=lambda wildcards, attempt: attempt * 1024,
shell:
"plink "
"--bed {input.bed} "
"--bim {input.bim} "
"--fam {input.fam} "
"--extract {input.to_keep} "
"--make-bed "
"--threads {threads} "
"--memory {resources.mem_mb} "
"--out {params.out_prefix}"

"""
plink --bed {input.bed} --bim {input.bim} --fam {input.fam} --extract {input.to_keep} --make-bed --threads {threads} --memory {resources.mem_mb} --out {params.out_prefix}
touch {output.nosex}
"""

rule snps_only_filter:
"""Exclude all variants with one or more multi-character allele codes"""
Expand Down Expand Up @@ -261,16 +243,10 @@ rule remove_ids:
resources:
mem_mb=lambda wildcards, attempt: attempt * 1024,
shell:
"plink "
"--bed {input.bed} "
"--bim {input.bim} "
"--fam {input.fam} "
"--remove {input.to_remove} "
"--make-bed "
"--threads {threads} "
"--memory {resources.mem_mb} "
"--out {params.out_prefix}"

"""
plink --bed {input.bed} --bim {input.bim} --fam {input.fam} --remove {input.to_remove} --make-bed --threads {threads} --memory {resources.mem_mb} --out {params.out_prefix}
touch {output.nosex}
"""

rule keep_bfile:
"""Tell snakemake to keep the file.
Expand Down Expand Up @@ -298,15 +274,10 @@ rule keep_bfile:
resources:
mem_mb=lambda wildcards, attempt: attempt * 1024,
shell:
"plink "
"--bed {input.bed} "
"--bim {input.bim} "
"--fam {input.fam} "
"--make-bed "
"--threads {threads} "
"--memory {resources.mem_mb} "
"--out {params.out_prefix}"

"""
plink --bed {input.bed} --bim {input.bim} --fam {input.fam} --make-bed --threads {threads} --memory {resources.mem_mb} --out {params.out_prefix}
touch {output.nosex}
"""

################################################################################
# Converters
Expand All @@ -332,16 +303,10 @@ rule rename_ids:
resources:
mem_mb=lambda wildcards, attempt: attempt * 1024,
shell:
"plink "
"--bed {input.bed} "
"--bim {input.bim} "
"--fam {input.fam} "
"--update-ids {input.id_map} "
"--make-bed "
"--threads {threads} "
"--memory {resources.mem_mb} "
"--out {params.out_prefix}"

"""
plink --bed {input.bed} --bim {input.bim} --fam {input.fam} --update-ids {input.id_map} --make-bed --threads {threads} --memory {resources.mem_mb} --out {params.out_prefix}
touch {output.nosex}
"""

rule bed_to_ped:
input:
Expand Down Expand Up @@ -418,15 +383,10 @@ rule ld:
resources:
mem_mb=lambda wildcards, attempt: attempt * 1024,
shell:
"sleep 10 && plink "
"--bed {input.bed} "
"--bim {input.bim} "
"--fam {input.fam} "
"--indep-pairwise 50 5 {params.r2} "
"--threads {threads} "
"--memory {resources.mem_mb} "
"--out {params.out_prefix}"

"""
sleep 10 && plink --bed {input.bed} --bim {input.bim} --fam {input.fam} --indep-pairwise 50 5 {params.r2} --threads {threads} --memory {resources.mem_mb} --out {params.out_prefix}
touch {output.nosex}
"""

rule miss:
"""Runs ``plink`` missingness statistics.
Expand Down
Loading