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

Adding support for Snakemake #1045

Merged
merged 1 commit into from
May 2, 2024
Merged
Show file tree
Hide file tree
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
7 changes: 7 additions & 0 deletions languages.json
Original file line number Diff line number Diff line change
Expand Up @@ -1343,6 +1343,13 @@
"multi_line_comments": [["\\\"", "\\\""]],
"extensions": ["cs.st", "pck.st"]
},
"Snakemake": {
"line_comment": ["#"],
"doc_quotes": [["\\\"\\\"\\\"", "\\\"\\\"\\\""], ["'''", "'''"]],
"quotes": [["\\\"", "\\\""], ["'", "'"]],
"extensions": ["smk", "rules"],
"filenames": ["snakefile"]
},
"Solidity": {
"name": "Solidity",
"line_comment": ["//"],
Expand Down
67 changes: 67 additions & 0 deletions tests/data/Snakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# 67 lines 50 code 4 comments 13 blanks
"""
A sample Snakefile for testing line counting
"""

SAMPLES = ["A", "B"]


# This is a
# multiline
# comment
rule all:
input:
"plots/quals.svg"


'''Sometimes even some
comments in single quote
fences.'''
rule bwa_map:
input:
"data/genome.fa", # Inline comments are also supported
"data/samples/{sample}.fastq"
output:
"mapped_reads/{sample}.bam"
shell:
"bwa mem {input} | samtools view -Sb - > {output}"


rule samtools_sort:
input:
"mapped_reads/{sample}.bam"
output:
"sorted_reads/{sample}.bam"
shell:
"samtools sort -T sorted_reads/{wildcards.sample} "
"-O bam {input} > {output}"


rule samtools_index:
input:
"sorted_reads/{sample}.bam"
output:
"sorted_reads/{sample}.bam.bai"
shell:
"samtools index {input}"


rule bcftools_call:
input:
fa="data/genome.fa",
bam=expand("sorted_reads/{sample}.bam", sample=SAMPLES),
bai=expand("sorted_reads/{sample}.bam.bai", sample=SAMPLES)
output:
"calls/all.vcf"
shell:
"bcftools mpileup -f {input.fa} {input.bam} | "
"bcftools call -mv - > {output}"


rule plot_quals:
input:
"calls/all.vcf"
output:
"plots/quals.svg"
script:
"scripts/plot-quals.py"