Skip to content

Commit

Permalink
Add support for Snakemake
Browse files Browse the repository at this point in the history
  • Loading branch information
boyter committed May 6, 2024
1 parent 8b85895 commit ca6a31b
Show file tree
Hide file tree
Showing 6 changed files with 154 additions and 17 deletions.
5 changes: 3 additions & 2 deletions LANGUAGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ License (license,licence,copying,copying3,unlicense,unlicence,license-mit,licenc
Lisp (lisp,lsp)
LLVM IR (ll)
LOLCODE (lol,lols)
Lua (lua)
Lua (lua,luau)
Luau (luau)
Lucius (lucius)
Luna (luna)
Expand Down Expand Up @@ -205,7 +205,7 @@ PRQL (prql)
PSL Assertion (psl)
Puppet (pp)
PureScript (purs)
Python (py)
Python (py,pyw,pyi)
Q# (qs)
QCL (qcl)
QML (qml)
Expand All @@ -232,6 +232,7 @@ Shell (sh,.tcshrc)
Sieve (sieve)
SKILL (il)
Smarty Template (tpl)
Snakemake (smk,rules,snakefile)
SNOBOL (sno)
Softbridge Basic (sbl)
Solidity (sol)
Expand Down
26 changes: 13 additions & 13 deletions SCC-OUTPUT-REPORT.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<th>453</th>
<th>7424</th>
<th>1516</th>
<th>396673</th>
<th>398173</th>
<th>3929</th>
</tr><tr>
<td>processor/workers_test.go</td>
Expand Down Expand Up @@ -250,16 +250,6 @@
<td>0</td>
<td>2222</td>
<td>35</td>
</tr><tr>
<td>processor/cocomo_test.go</td>
<td></td>
<td>37</td>
<td>8</td>
<td>4</td>
<td>25</td>
<td>6</td>
<td>699</td>
<td>23</td>
</tr><tr>
<td>processor/bloom.go</td>
<td></td>
Expand All @@ -270,6 +260,16 @@
<td>2</td>
<td>1051</td>
<td>29</td>
</tr><tr>
<td>processor/cocomo_test.go</td>
<td></td>
<td>37</td>
<td>8</td>
<td>4</td>
<td>25</td>
<td>6</td>
<td>699</td>
<td>23</td>
</tr><tr>
<td>processor/helpers.go</td>
<td></td>
Expand Down Expand Up @@ -318,7 +318,7 @@
<td>0</td>
<td>4</td>
<td>0</td>
<td>170185</td>
<td>171685</td>
<td>5</td>
</tr></tbody>
<tfoot><tr>
Expand All @@ -329,7 +329,7 @@
<th>453</th>
<th>7424</th>
<th>1516</th>
<th>396673</th>
<th>398173</th>
<th>3929</th>
</tr>
<tr>
Expand Down
67 changes: 67 additions & 0 deletions examples/language/snakefile.smk
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"
69 changes: 69 additions & 0 deletions languages.json
Original file line number Diff line number Diff line change
Expand Up @@ -5979,6 +5979,75 @@
"python3"
]
},
"Snakemake": {
"complexitychecks": [
"for ",
"for(",
"while ",
"while(",
"if ",
"if(",
"elif ",
"elif(",
"else ",
"else:",
"match ",
"match(",
"try ",
"try:",
"except ",
"except(",
"finally ",
"finally:",
"with ",
"with (",
"and ",
"and(",
"or ",
"or("
],
"extensions": [
"smk",
"rules"
],
"line_comment": [
"#"
],
"multi_line": [],
"quotes": [
{
"end": "\"",
"start": "\""
},
{
"end": "'",
"start": "'"
},
{
"docString": true,
"end": "\"\"\"",
"start": "\"\"\""
},
{
"docString": true,
"end": "'''",
"start": "'''"
},
{
"docString": true,
"end": "\"\"\"",
"start": "r\"\"\""
},
{
"docString": true,
"end": "'''",
"start": "r'''"
}
],
"filenames": [
"snakefile"
]
},
"PRQL": {
"complexitychecks": [
"case ",
Expand Down
2 changes: 1 addition & 1 deletion processor/constants.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion test-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -883,7 +883,7 @@ else
fi

# Try out specific languages
for i in 'Bosque ' 'Flow9 ' 'Bitbucket Pipeline ' 'Docker ignore ' 'Q# ' 'Futhark ' 'Alloy ' 'Wren ' 'Monkey C ' 'Alchemist ' 'Luna ' 'ignore ' 'XML Schema ' 'Web Services' 'Go ' 'Java ' 'Boo ' 'License ' 'BASH ' 'C Shell ' 'Korn Shell ' 'Makefile ' 'Shell ' 'Zsh ' 'Rakefile ' 'Gemfile ' 'Dockerfile ' 'Yarn ' 'Sieve ' 'F# ' 'Elm ' 'Terraform ' 'Clojure ' 'C# ' 'LLVM IR ' 'HAML ' 'FXML ' 'DM ' 'Nushell ' 'Racket ' 'DOT ' 'YAML ' 'Teal ' 'FSL ' 'INI ' 'Hare ' 'Templ ' 'Cuda ' 'GraphQL ' 'Bicep ' 'Pkl ' 'TypeSpec ' 'LALRPOP '
for i in 'Bosque ' 'Flow9 ' 'Bitbucket Pipeline ' 'Docker ignore ' 'Q# ' 'Futhark ' 'Alloy ' 'Wren ' 'Monkey C ' 'Alchemist ' 'Luna ' 'ignore ' 'XML Schema ' 'Web Services' 'Go ' 'Java ' 'Boo ' 'License ' 'BASH ' 'C Shell ' 'Korn Shell ' 'Makefile ' 'Shell ' 'Zsh ' 'Rakefile ' 'Gemfile ' 'Dockerfile ' 'Yarn ' 'Sieve ' 'F# ' 'Elm ' 'Terraform ' 'Clojure ' 'C# ' 'LLVM IR ' 'HAML ' 'FXML ' 'DM ' 'Nushell ' 'Racket ' 'DOT ' 'YAML ' 'Teal ' 'FSL ' 'INI ' 'Hare ' 'Templ ' 'Cuda ' 'GraphQL ' 'Bicep ' 'Pkl ' 'TypeSpec ' 'LALRPOP ' 'Snakemake '
do
if ./scc "examples/language/" | grep -q "$i "; then
echo -e "${GREEN}PASSED $i Language Check"
Expand Down

0 comments on commit ca6a31b

Please sign in to comment.