-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPreQC.nf
70 lines (54 loc) · 2 KB
/
PreQC.nf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/usr/bin/env nextflow
nextflow.enable.dsl=2
// ##### Not used process to aviod warnings from sge.config ####################
process M_vcf_to_gds {script:""" """}
process M_write_gds_list {script:""" """}
process M_merge_gds {script:""" """}
process M_PCA {script:""" """}
process M_get_shared_sampleid {script:""" """}
process M_split_pheno {script:""" """}
process M_prepare_cvrt {script:""" """}
process M_SNP_info {script:""" """}
process M_QTL_analysis {script:""" """}
process M_merge_info_QTL {script:""" """}
process M_QTL_count_wrap {script:""" """}
process M_QTL_results_wrap {script:""" """}
process G_vcf_to_gds {script:""" """}
process G_write_gds_list {script:""" """}
process G_merge_gds {script:""" """}
process G_PCA_GRM {script:""" """}
process G_get_shared_sampleid {script:""" """}
process G_split_pheno {script:""" """}
process G_prepare_cvrt {script:""" """}
process G_SNP_info {script:""" """}
process G_QTL_analysis {script:""" """}
process G_merge_info_QTL {script:""" """}
process G_QTL_count_wrap {script:""" """}
process G_QTL_results_wrap {script:""" """}
process move_boxplot {script:""" """}
// ##### pre-QC ############################################################
process qc_filters {
publishDir "${params.outdir}/0_QC", mode: 'copy'
input:
tuple val(vcf_name), val(vcf_filepath)
output:
path '*'
script:
"""
vcftools \
--gzvcf $vcf_filepath \
--hwe ${params.hwe_p} \
--mac ${params.min_mac} \
--max-missing 1-${params.max_missing_allowed} \
--recode --stdout | gzip -c > ${vcf_name}_qc1.vcf.gz
bcftools view -e 'COUNT(GT="AA")=N_SAMPLES || COUNT(GT="RR")=N_SAMPLES || COUNT(GT="AR")=N_SAMPLES || COUNT(GT="RA")=N_SAMPLES' ${vcf_name}_qc1.vcf.gz -Oz -o ${vcf_name}.vcf.gz
"""
}
// ##### workflow ##############################################################
workflow {
genovcf = Channel
.fromPath(params.vcf_list)
.splitCsv(header: false)
.map {row -> tuple(row[0], row[1])}
qc_filters(genovcf)
}