Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
johanneskoester committed May 21, 2021
1 parent 686fc05 commit ab054da
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 60 deletions.
41 changes: 0 additions & 41 deletions .tests/config/config.yaml

This file was deleted.

1 change: 1 addition & 0 deletions .tests/config/config.yaml
47 changes: 47 additions & 0 deletions config/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
reference:
species: homo_sapiens
build: GRCh38
# ensembl release
release: 100

samples:
rna:
# either specify sra: <accession>, or fq1: <path> and fq2: <path>
sra: SRR8758323
# denote read geometry as expected by salmon alevin
geometry:
reads: "2[1-end]"
barcodes: "1[1-16]"
umis: "1[17-26]"
adt:
# either specify sra: <accession>, or fq1: <path> and fq2: <path>
sra: SRR8758325
# denote read geometry as expected by salmon alevin
geometry:
reads: "2[1-15]"
barcodes: "1[1-16]"
umis: "1[17-26]"
hto:
# either specify sra: <accession>, or fq1: <path> and fq2: <path>
sra: SRR8758327
# denote read geometry as expected by salmon alevin
geometry:
reads: "2[1-15]"
barcodes: "1[1-16]"
umis: "1[17-26]"

antibodies:
adt-seqs: data/adt.tsv
hto-seqs: data/hto.tsv

thresholds:
# After the first execution of the workflow,
# determine an upper bound for HTO counts to consider
# by looking at results/plots/hto-counts.pdf,
# see https://combine-lab.github.io/alevin-fry-tutorials/2021/af-feature-bc.
max-hto-count: null
# After the second execution of the workflow,
# determine an upper bound for ADT counts to consider
# by looking at results/plots/adt-counts.pdf,
# see https://combine-lab.github.io/alevin-fry-tutorials/2021/af-feature-bc.
max-adt-count: null
2 changes: 2 additions & 0 deletions workflow/Snakefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
configfile: "config/config.yaml"

include: "rules/common.smk"
include: "rules/utils.smk"
include: "rules/ref.smk"
Expand Down
4 changes: 2 additions & 2 deletions workflow/rules/analysis.smk
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ rule seurat:
hto="results/alevin-fry/quant/hto",
geneid2name="resources/reference/geneid2name.tsv",
output:
"results/seurat/{sample}.all.rds",
"results/seurat/all.rds",
log:
"logs/seurat/{sample}.log",
"logs/seurat.log",
conda:
"../envs/seurat.yaml"
script:
Expand Down
14 changes: 6 additions & 8 deletions workflow/rules/common.smk
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,19 @@ def get_reference(wildcards):

def get_reads(wildcards):
sample = config["samples"][wildcards.sample]
print(sample)
if "fq1" in sample and "fq2" in sample:
return {"fq1": sample["fq1"], "fq2": sample["fq2"]}
else:
accession = sample["sra"]
return {
"fq1": f"resources/sra/{sample[sra]}_1.fastq",
"fq2": f"resources/sra/{sample[sra]}_2.fastq",
"fq1": f"resources/sra/{accession}_1.fastq",
"fq2": f"resources/sra/{accession}_2.fastq",
}


def get_salmon_index(wildcards):
return f"resources/salmon-index/{get_unit_type(wildcards)}"


def get_unit_type(wildcards):
return get_unit(wildcards)["type"]
def get_sample(wildcards):
return config["samples"][wildcards.sample]


def get_targets():
Expand Down
12 changes: 6 additions & 6 deletions workflow/rules/read_mapping.smk
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ rule salmon_index:
output:
directory("resources/salmon-index/{sample}"),
log:
"logs/salmon-index/{ref}.log",
"logs/salmon-index/{sample}.log",
threads: 2
params:
extra="--features -k7",
Expand All @@ -15,20 +15,20 @@ rule salmon_index:
rule salmon_alevin:
input:
unpack(get_reads),
index=get_salmon_index,
index="resources/salmon-index/{sample}",
output:
directory("results/salmon-alevin/{sample}"),
params:
unit=get_unit,
sample=get_sample,
log:
"logs/salmon-alevin/{sample}-{type}.log",
"logs/salmon-alevin/{sample}.log",
conda:
"../envs/salmon.yaml"
shell:
"salmon alevin "
"-l ISR -i {input.index} -1 {input.fq1} -2 {input.fq2} "
"--read-geometry {params.unit[read_geometry]} --bc-geometry {params.unit[barcode_geometry]} "
"--umi-geometry {params.unit[umi_geometry]} -o {output} --sketch -p 16 "
"--read-geometry {params.sample[geometry][reads]} --bc-geometry {params.sample[geometry][barcodes]} "
"--umi-geometry {params.sample[geometry][umis]} -o {output} --sketch -p 16 "
"2> {log}"


Expand Down
6 changes: 3 additions & 3 deletions workflow/rules/ref.smk
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ rule spoof_t2g:
input:
get_reference,
output:
"resources/reference/{type}/t2g.tsv",
"resources/reference/{sample}/t2g.tsv",
log:
"logs/spoof-t2g/{type}.log",
"logs/spoof-t2g/{sample}.log",
wildcard_constraints:
type="adt|hto",
sample="adt|hto",
conda:
"../envs/unix.yaml"
shell:
Expand Down

0 comments on commit ab054da

Please sign in to comment.