Workflow Steps and Code Snippets

3191 tagged steps and code snippets that match keyword samtools

Snakemake workflow: dna-seq-gatk-variant-calling (v2.1.1)

38
39
shell:
    "samtools dict {input} > {output} 2> {log} "

Snakemake workflow: dna-seq-gatk-variant-calling (v2.1.1)

38
39
shell:
    "samtools dict {input} > {output} 2> {log} "

Snakemake workflow: dna-seq-gatk-variant-calling (v2.1.1)

38
39
shell:
    "samtools dict {input} > {output} 2> {log} "

Snakemake workflow: dna-seq-gatk-variant-calling (v2.1.1)

38
39
shell:
    "samtools dict {input} > {output} 2> {log} "

WES analysis pipeline

50
51
52
53
54
55
56
57
58
shell:
    """
    gatk SamToFastq -I {input.bam} -F /dev/stdout -INTER true -NON_PF true \
    | \
    bwa mem -p -v 3 -t {threads} -T 0 \
        {input.ref} /dev/stdin - 2> >(tee {log} >&2) \
    | \
    samtools view -Shb -o {output}
    """
166
167
168
169
shell:
    """
    samtools flagstat {input} > {output}
    """

Snakemake pipeline for detection limit test from laser-microdissected samples

59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
shell:
    """
    if [[ {params.is_paired} = "True" ]] ; then
        (bowtie2 \
            -x {input.mock} \
            -1 {input.forward_} \
            -2 {input.reverse_} \
            --threads {threads} \
            --rg-id '{params.rg_id}' \
            --rg '{params.rg_extra}' \
            {params.extra} \
        | samtools sort \
            --threads {threads} \
            -m {params.samtools_mem} \
        | samtools rmdup - - \
        | samtools view \
            --reference {input.reference} \
            --output {output.cram} \
            --output-fmt cram,level=9,nthreads={threads} \
            --write-index \
        ) 2> {log} 1>&2
    else
        (bowtie2 \
            -x {input.mock} \
            -U {input.forward_} \
            --threads {threads} \
            --rg-id '{params.rg_id}' \
            --rg '{params.rg_extra}' \
            {params.extra} \
        | samtools sort \
            --threads {threads} \
            -m {params.samtools_mem} \
        | samtools rmdup -s - - \
        | samtools view \
            --reference {input.reference} \
            --output {output.cram} \
            --output-fmt cram,level=9,nthreads={threads} \
            --write-index \
        ) 2> {log} 1>&2
    fi
    """
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
shell:
    """
    if [[ {params.is_paired} = "True" ]] ; then
        (samtools view \
            --reference {input.reference} \
            --threads {threads} \
            -u \
            -o /dev/stdout \
            -f 12 \
            {input.cram} \
        | samtools fastq \
            -1 {output.forward_} \
            -2 {output.reverse_} \
            -0 /dev/null \
            -c 9 \
            --threads {threads} \
        ) 2> {log} 1>&2
    else
        (samtools view \
            --reference {input.reference} \
            --threads {threads} \
            -u \
            -o /dev/stdout \
            -f 4 \
            {input.cram} \
        | samtools fastq \
            -0 {output.forward_} \
            -c 9 \
            --threads {threads} \
        ) 2> {log} 1>&2
    fi
    """
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
shell:
    """
    if [[ {params.is_paired} == "True" ]] ; then
        (bowtie2 \
            -x {input.mock} \
            -1 {input.forward_} \
            -2 {input.reverse_} \
            --threads {threads} \
            --rg-id '{params.rg_id}' \
            --rg '{params.rg_extra}' \
            {params.extra} \
        | samtools sort \
            -l 9 \
            -M \
            -m {params.samtools_mem} \
            -o {output.cram} \
            --reference {input.reference} \
            --threads {threads} \
            --write-index \
        ) 2> {log} 1>&2
    else
        (bowtie2 \
            -x {input.mock} \
            -U {input.forward_} \
            --threads {threads} \
            --rg-id '{params.rg_id}' \
            --rg '{params.rg_extra}' \
            {params.extra} \
        | samtools sort \
            -l 9 \
            -M \
            -m {params.samtools_mem} \
            -o {output.cram} \
            --reference {input.reference} \
            --threads {threads} \
            --write-index \
        ) 2> {log} 1>&2
    fi
    """
12
13
shell:
    "samtools flagstats {input.cram} > {output.txt} 2> {log}"
tool / biotools

SAMtools

SAMtools and BCFtools are widely used programs for processing and analysing high-throughput sequencing data. They include tools for file format conversion and manipulation, sorting, querying, statistics, variant calling, and effect analysis amongst other methods.