Skip to content

Commit 6a95549

Browse files
feat: annotate access patterns (#369)
* feat: annotate access patterns * naming * polish * min snakemake version * fmt * update super linter * minor * use mega-linter
1 parent 2f5ef0d commit 6a95549

10 files changed

Lines changed: 27 additions & 55 deletions

File tree

.github/workflows/main.yml

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -13,40 +13,8 @@ concurrency:
1313

1414

1515
jobs:
16-
Formatting:
17-
runs-on: ubuntu-latest
18-
steps:
19-
- uses: actions/checkout@v2
20-
with:
21-
# Full git history is needed to get a proper
22-
# list of changed files within `super-linter`
23-
fetch-depth: 0
24-
- name: Formatting
25-
uses: github/super-linter@v5
26-
env:
27-
VALIDATE_ALL_CODEBASE: false
28-
DEFAULT_BRANCH: master
29-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30-
VALIDATE_SNAKEMAKE_SNAKEFMT: true
31-
32-
Linting:
33-
runs-on: ubuntu-latest
34-
steps:
35-
- uses: actions/checkout@v2
36-
with:
37-
fetch-depth: 0
38-
- name: Lint workflow
39-
uses: snakemake/snakemake-github-action@v2
40-
with:
41-
directory: .
42-
snakefile: workflow/Snakefile
43-
args: "--lint"
44-
4516
Testing:
4617
runs-on: ubuntu-latest
47-
needs:
48-
- Linting
49-
- Formatting
5018
strategy:
5119
fail-fast: true
5220
matrix:

workflow/Snakefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from snakemake.utils import min_version
22

3-
min_version("8.13.0")
3+
min_version("9.1.0")
44

55

66
configfile: "config/config.yaml"
@@ -13,6 +13,10 @@ scattergather:
1313
calling=16,
1414

1515

16+
inputflags:
17+
access.sequential,
18+
19+
1620
# Allow users to fix the underlying OS via singularity.
1721
container: "docker://continuumio/miniconda3"
1822

workflow/rules/annotation.smk

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
rule annotate_candidate_variants:
22
input:
33
calls="results/candidate-calls/{group}.{caller}.{scatteritem}.bcf",
4-
cache="resources/vep/cache",
5-
plugins="resources/vep/plugins",
6-
fasta=genome,
4+
cache=access.random("resources/vep/cache"),
5+
plugins=access.random("resources/vep/plugins"),
6+
fasta=access.random(genome),
77
fai=genome_fai,
88
output:
99
calls="results/candidate-calls/{group}.{caller}.{scatteritem}.annotated.bcf",
@@ -25,11 +25,11 @@ rule annotate_candidate_variants:
2525
rule annotate_variants:
2626
input:
2727
calls="results/calls/{group}.{calling_type}.{scatteritem}.bcf",
28-
cache="resources/vep/cache",
29-
plugins="resources/vep/plugins",
28+
cache=access.random("resources/vep/cache"),
29+
plugins=access.random("resources/vep/plugins"),
3030
revel=lambda wc: get_plugin_aux("REVEL"),
3131
revel_tbi=lambda wc: get_plugin_aux("REVEL", True),
32-
fasta=genome,
32+
fasta=access.random(genome),
3333
fai=genome_fai,
3434
output:
3535
calls="results/calls/{group}.{calling_type}.{scatteritem}.annotated.bcf",

workflow/rules/calling.smk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ rule varlociraptor_preprocess:
4444
input:
4545
ref=genome,
4646
ref_idx=genome_fai,
47-
candidates=get_candidate_calls,
47+
candidates=access.multi(get_candidate_calls),
4848
bam="results/recal/{sample}.bam",
4949
bai="results/recal/{sample}.bai",
5050
alignment_props=get_alignment_props,

workflow/rules/candidate_calling.smk

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
rule freebayes:
22
input:
3-
ref=genome,
3+
ref=access.random(genome),
44
ref_idx=genome_fai,
55
regions="results/regions/{group}.expanded_regions.filtered.bed",
66
# you can have a list of samples here
7-
alns=lambda w: get_group_bams(w),
7+
alns=access.random(lambda w: get_group_bams(w)),
88
idxs=lambda w: get_group_bams(w, bai=True),
99
output:
1010
"results/candidate-calls/{group}.freebayes.bcf",
@@ -25,9 +25,9 @@ rule freebayes:
2525

2626
rule delly:
2727
input:
28-
ref=genome,
28+
ref=access.random(genome),
2929
ref_idx=genome_fai,
30-
alns=lambda w: get_group_bams(w),
30+
alns=access.random(lambda w: get_group_bams(w)),
3131
index=lambda w: get_group_bams(w, bai=True),
3232
exclude=get_delly_excluded_regions(),
3333
output:

workflow/rules/common.smk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1479,7 +1479,7 @@ def get_primer_extra(wc, input):
14791479
min_primer_len = get_shortest_primer_length(input.reads)
14801480
# Check if shortest primer is below default values
14811481
if min_primer_len < 32:
1482-
extra += f" -T {min_primer_len - 2}"
1482+
extra += f" -T {min_primer_len-2}"
14831483
if min_primer_len < 19:
14841484
extra += f" -k {min_primer_len}"
14851485
return extra

workflow/rules/fusion_calling.smk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ rule annotate_exons:
6262
"""
6363

6464

65-
# Use script provide by arriba once new version is released
65+
# Use script provided by arriba once new version is released
6666
rule convert_fusions:
6767
input:
6868
fasta=rules.get_genome.output,

workflow/rules/maf.smk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ rule group_vcf_to_maf:
3333
dpath="maf/primary_alias", within=config, default="tumor"
3434
),
3535
vcf_control_alias_option=(
36-
f'--vcf-normal-id {lookup(dpath = "maf/control_alias", within = config , default = "")}'
36+
f'--vcf-normal-id {lookup(dpath= "maf/control_alias", within= config, default= "")}'
3737
if lookup(dpath="maf/control_alias", within=config, default=False)
3838
else ""
3939
),
4040
normal_id=lambda wc: (
41-
f'--normal-id {wc.group}_{lookup(dpath = "maf/control_alias", within = config , default = "")}'
41+
f'--normal-id {wc.group}_{lookup(dpath= "maf/control_alias", within= config, default= "")}'
4242
if lookup(dpath="maf/control_alias", within=config, default=False)
4343
else ""
4444
),

workflow/rules/mapping.smk

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
rule map_reads_bwa:
22
input:
33
reads=get_map_reads_input,
4-
idx=rules.bwa_index.output,
4+
idx=access.random(rules.bwa_index.output),
55
output:
66
temp("results/mapped/bwa/{sample}.bam"),
77
log:
@@ -53,10 +53,10 @@ rule create_reference_paths:
5353
rule map_reads_vg:
5454
input:
5555
reads=get_map_reads_input,
56-
graph=f"{pangenome_prefix}.gbz",
57-
kmers="results/kmers/{sample}.kff",
58-
hapl=f"{pangenome_prefix}.hapl",
59-
paths="resources/reference_paths.txt",
56+
graph=access.random(f"{pangenome_prefix}.gbz"),
57+
kmers=access.random("results/kmers/{sample}.kff"),
58+
hapl=access.random(f"{pangenome_prefix}.hapl"),
59+
paths=access.random("resources/reference_paths.txt"),
6060
output:
6161
bam=temp("results/mapped/vg/{sample}.preprocessed.bam"),
6262
indexes=temp(
@@ -229,7 +229,7 @@ rule calc_consensus_reads:
229229
rule map_consensus_reads:
230230
input:
231231
reads=get_processed_consensus_input,
232-
idx=rules.bwa_index.output,
232+
idx=access.random(rules.bwa_index.output),
233233
output:
234234
temp("results/consensus/{sample}.consensus.{read_type}.mapped.bam"),
235235
params:

workflow/rules/primers.smk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ rule trim_primers:
4747
rule map_primers:
4848
input:
4949
reads=lambda wc: get_panel_primer_input(wc.panel),
50-
idx=rules.bwa_index.output,
50+
idx=access.random(rules.bwa_index.output),
5151
output:
5252
"results/primers/{panel}_primers.bam",
5353
log:

0 commit comments

Comments
 (0)