Skip to content

Commit

Permalink
fix: Fixing workflow for single-end sequencing (#70)
Browse files Browse the repository at this point in the history
* Correcting path for `cutadapt_se` and params for cutadapt wrapper.

* fix formatting

* better error message in gene2symbol.R

* apply dirty fix in biomart.yaml

the same fix as applied here:
snakemake-workflows/rna-seq-kallisto-sleuth@5bf0c52

original solution can be found here:
https://stackoverflow.com/a/77370920

---------

Co-authored-by: David Laehnemann <[email protected]>
  • Loading branch information
Wolfffff and dlaehnemann authored Nov 21, 2023
1 parent 846693f commit 3380a05
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
4 changes: 4 additions & 0 deletions workflow/envs/biomart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@ channels:
dependencies:
- bioconductor-biomart =2.56
- r-tidyverse =2.0
# remove once we can update to bioconductor-biomart of the 3.18 release, which will
# include this proper fix for the underlying compatibility issue:
# https://github.com/Bioconductor/BiocFileCache/pull/50
- r-dbplyr=2.3.4
4 changes: 3 additions & 1 deletion workflow/rules/common.smk
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ def get_fq(wildcards):
)
)
# single end sample
return {"fq1": "trimmed/{sample}_{unit}_single.fastq.gz".format(**wildcards)}
return {
"fq1": "results/trimmed/{sample}_{unit}_single.fastq.gz".format(**wildcards)
}
else:
# no trimming, use raw reads
u = units.loc[(wildcards.sample, wildcards.unit)]
Expand Down
2 changes: 1 addition & 1 deletion workflow/rules/trim.smk
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ rule cutadapt_se:
"logs/cutadapt/{sample}_{unit}.log",
params:
extra=config["params"]["cutadapt-se"],
adapters_r1=lambda w: str(units.loc[w.sample].loc[w.unit, "adapters"]),
adapters=lambda w: str(units.loc[w.sample].loc[w.unit, "adapters"]),
threads: 8
wrapper:
"v1.21.4/bio/cutadapt/se"
11 changes: 10 additions & 1 deletion workflow/scripts/gene2symbol.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
library(biomaRt)
library(tidyverse)
# useful error messages upon aborting
library("cli")

# this variable holds a mirror name until
# useEnsembl succeeds ("www" is last, because
Expand All @@ -24,7 +26,14 @@ while ( class(mart)[[1]] != "Mart" ) {
# change or make configurable if you want more or
# less rounds of tries of all the mirrors
if (rounds >= 3) {
stop(
cli_abort(
str_c(
"Have tried all 4 available Ensembl biomaRt mirrors ",
rounds,
" times. You might have a connection problem, or no mirror is responsive.\n",
"The last error message was:\n",
message(e)
)
)
}
# hop to next mirror
Expand Down

0 comments on commit 3380a05

Please sign in to comment.