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

chore: fix actions versions #9

Merged
merged 11 commits into from
Aug 23, 2023
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
2 changes: 1 addition & 1 deletion .github/workflows/conventional-prs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
title-format:
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v3.4.0
- uses: amannn/action-semantic-pull-request@v5.2.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
Expand Down
18 changes: 8 additions & 10 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
name: Tests

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

Expand All @@ -11,9 +9,9 @@ jobs:
Formatting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Formatting
uses: github/super-linter@v4
uses: super-linter/super-linter@v5
env:
VALIDATE_ALL_CODEBASE: false
DEFAULT_BRANCH: main
Expand All @@ -23,9 +21,9 @@ jobs:
Linting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Lint workflow
uses: snakemake/snakemake-github-action@v1.24.0
uses: snakemake/snakemake-github-action@v1.25.1
with:
directory: .
snakefile: workflow/Snakefile
Expand All @@ -37,17 +35,17 @@ jobs:
- Linting
- Formatting
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Test workflow
uses: snakemake/snakemake-github-action@v1.24.0
uses: snakemake/snakemake-github-action@v1.25.1
with:
directory: .test
snakefile: workflow/Snakefile
args: "--use-conda --show-failed-logs --cores 3 --conda-cleanup-pkgs cache --all-temp"
args: "--use-conda --show-failed-logs --cores 3 --conda-cleanup-pkgs cache --all-temp --configfile .test/config.yaml"

- name: Test report
uses: snakemake/snakemake-github-action@v1.24.0
uses: snakemake/snakemake-github-action@v1.25.1
with:
directory: .test
snakefile: workflow/Snakefile
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
steps:

- uses: GoogleCloudPlatform/release-please-action@v2
- uses: GoogleCloudPlatform/release-please-action@v3
id: release
with:
release-type: go # just keep a changelog, no version anywhere outside of git tags
Expand Down
33 changes: 33 additions & 0 deletions .test/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
###############################################################################
############### GENERAL PARAMETERS ###############
###############################################################################

OUTPUT: results/
METADATA: data/metadata.txt

###############################################################################
############### RAW DATA ###############
###############################################################################

# Path to folder containing gzipped raw fastq data
RAW_DATA: data

###############################################################################
############### CONDITIONAL RULES ###############
###############################################################################

RUN_FASTQC: True
RUN_STAR: True


###############################################################################
############### ALIGNMENT ###############
###############################################################################

# Paths to the folder of the parental genome assemblies

GENOME_DIR_1: data/genome1/
GENOME_DIR_2: data/genome2/

GENOME_PARENT_1: g1.fa
GENOME_PARENT_2: g2.fa
2 changes: 2 additions & 0 deletions .test/data/genome1/g1.fa

Large diffs are not rendered by default.

1,641 changes: 1,641 additions & 0 deletions .test/data/genome2/g2.fa

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions .test/data/metadata.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
name
test_pe
Binary file added .test/data/test_pe_R1.fastq.gz
Binary file not shown.
Binary file added .test/data/test_pe_R2.fastq.gz
Binary file not shown.
14 changes: 7 additions & 7 deletions config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
############### GENERAL PARAMETERS ###############
###############################################################################

OUTPUT: output/
METADATA: test/metadata.txt
OUTPUT: results/
METADATA: .test/data/metadata.txt

###############################################################################
############### RAW DATA ###############
###############################################################################

# Path to folder containing gzipped raw fastq data
RAW_DATA: test
RAW_DATA: .test/data

###############################################################################
############### CONDITIONAL RULES ###############
Expand All @@ -26,8 +26,8 @@ RUN_STAR: True

# Paths to the folder of the parental genome assemblies

GENOME_DIR_1: test/genome1/
GENOME_DIR_2: test/genome2/
GENOME_DIR_1: .test/data/genome1/
GENOME_DIR_2: .test/data/genome2/

GENOME_PARENT_1: Ahal_ref.fa
GENOME_PARENT_2: Alyr_ref.fa
GENOME_PARENT_1: g1.fa
GENOME_PARENT_2: g2.fa
8 changes: 5 additions & 3 deletions workflow/Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ if len(config) == 0:

configfile: "config/config.yaml"


else:
sys.exit(
f"Make sure there is a config.yaml file in {os.getcwd()} or specify one with the --configfile commandline parameter."
Expand All @@ -28,20 +27,23 @@ samples = pd.read_csv(config["METADATA"], sep="\t")

## Parse config file

RAW_DATA_DIR = os.path.normpath(config["RAW_DATA"])
RAW_DATA_DIR = os.path.normpath(config["RAW_DATA"])
OUTPUT_DIR = os.path.normpath(config["OUTPUT"])
GENOME_DIR_1 = os.path.normpath(config["GENOME_DIR_1"])
GENOME_DIR_2 = os.path.normpath(config["GENOME_DIR_2"])
GENOME_PARENT_1 = os.path.splitext(config["GENOME_PARENT_1"])[0]
GENOME_PARENT_2 = os.path.splitext(config["GENOME_PARENT_2"])[0]


## Run all analyses
rule all:
input:
f"{OUTPUT_DIR}/MultiQC/multiqc_report.html"
f"{OUTPUT_DIR}/MultiQC/multiqc_report.html",


######################### Main rules of REAP #############################


include: "rules/input_functions.smk"
include: "rules/quality_check.smk"
include: "rules/alignment.smk"
16 changes: 9 additions & 7 deletions workflow/rules/alignment.smk
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#### Indexing reference rule ####

# Index genome 1

# Index genome 1
rule star_index_genome_1:
input:
fasta=f"{GENOME_DIR_1}/{GENOME_PARENT_1}.fa",
Expand All @@ -16,7 +17,8 @@ rule star_index_genome_1:
wrapper:
"v2.3.0/bio/star/index"

# Index genome 2

# Index genome 2
rule star_index_genome_2:
input:
fasta=f"{GENOME_DIR_2}/{GENOME_PARENT_2}.fa",
Expand All @@ -33,14 +35,14 @@ rule star_index_genome_2:
"v2.3.0/bio/star/index"



#### Alignment rule ####


rule star_pe_multi_1:
input:
fq1=f"test/{{sample}}_R1.fastq.gz",
fq1=f"{RAW_DATA_DIR}/{{sample}}_R1.fastq.gz",
# paired end reads needs to be ordered so each item in the two lists match
fq2=f"test/{{sample}}_R2.fastq.gz", #optional
fq2=f"{RAW_DATA_DIR}/{{sample}}_R2.fastq.gz", #optional
# path to STAR reference genome index
idx=f"{GENOME_DIR_1}",
output:
Expand All @@ -61,9 +63,9 @@ rule star_pe_multi_1:

rule star_pe_multi_2:
input:
fq1=f"test/{{sample}}_R1.fastq.gz",
fq1=f"{RAW_DATA_DIR}/{{sample}}_R1.fastq.gz",
# paired end reads needs to be ordered so each item in the two lists match
fq2=f"test/{{sample}}_R2.fastq.gz", #optional
fq2=f"{RAW_DATA_DIR}/{{sample}}_R2.fastq.gz", #optional
# path to STAR reference genome index
idx=f"{GENOME_DIR_2}",
output:
Expand Down
29 changes: 13 additions & 16 deletions workflow/rules/input_functions.smk
Original file line number Diff line number Diff line change
@@ -1,32 +1,29 @@
# This file includes all functions to define inputs to other rules


def multiqc_input(wildcards):

input = []

if config["RUN_FASTQC"]:
input.extend(
expand(
f"{OUTPUT_DIR}/fastqc/{{sample}}_{{extension}}_fastqc.zip",
sample=samples.name.values.tolist(),extension=['R1','R2'],
sample=samples.name.values.tolist(),
extension=["R1", "R2"],
)
)
if config["RUN_STAR"]:
input.extend(
expand(
f"{OUTPUT_DIR}/qualimap/{{sample}}/aligned_1",
sample=samples.name.values.tolist(),
)
)
expand(
f"{OUTPUT_DIR}/qualimap/{{sample}}/aligned_1",
sample=samples.name.values.tolist(),
)
)

input.extend(
expand(
f"{OUTPUT_DIR}/qualimap/{{sample}}/aligned_2",
sample=samples.name.values.tolist(),
)
)
expand(
f"{OUTPUT_DIR}/qualimap/{{sample}}/aligned_2",
sample=samples.name.values.tolist(),
)
)

return input



20 changes: 11 additions & 9 deletions workflow/rules/quality_check.smk
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,20 @@

# Quality check for the raw data


rule fastqc:
input:
fastq=f"{RAW_DATA_DIR}/{{sample}}_{{extension}}.fastq.gz",
output:
html=f"{OUTPUT_DIR}/fastqc/{{sample}}_{{extension}}.html",
zip=f"{OUTPUT_DIR}/fastqc/{{sample}}_{{extension}}_fastqc.zip" # the suffix _fastqc.zip is necessary for multiqc to find the file. If not using multiqc, you are free to choose an arbitrary filename
zip=f"{OUTPUT_DIR}/fastqc/{{sample}}_{{extension}}_fastqc.zip", # the suffix _fastqc.zip is necessary for multiqc to find the file. If not using multiqc, you are free to choose an arbitrary filename
params:
extra = "--quiet"
extra="--quiet",
log:
f"logs/fastqc/{{sample}}_{{extension}}.log"
f"logs/fastqc/{{sample}}_{{extension}}.log",
threads: 1
resources:
mem_mb = 1024
mem_mb=1024,
wrapper:
"v2.3.0/bio/fastqc"

Expand All @@ -27,6 +28,7 @@ rule fastqc:

# Quality check for the alignment with STAR


rule qualimap_1:
input:
# BAM aligned, splicing-aware, to reference genome
Expand Down Expand Up @@ -63,21 +65,21 @@ rule qualimap_2:
"v2.3.0/bio/qualimap/bamqc"



###################
#### Multi QC #####
###################

# Multi QC report


rule multiqc_dir:
input:
multiqc_input,
output:
out=f"{OUTPUT_DIR}/MultiQC/multiqc_report.html"
out=f"{OUTPUT_DIR}/MultiQC/multiqc_report.html",
params:
extra="" # Optional: extra parameters for multiqc.
extra="", # Optional: extra parameters for multiqc.
log:
"logs/multiqc.log"
"logs/multiqc.log",
wrapper:
"v2.3.0/bio/multiqc"
"v2.3.0/bio/multiqc"
Loading