Skip to content

Commit

Permalink
add rx to chip as an option
Browse files Browse the repository at this point in the history
  • Loading branch information
CChahrour committed Jan 4, 2024
1 parent 67f01ec commit 7413bf1
Show file tree
Hide file tree
Showing 10 changed files with 50 additions and 276 deletions.
4 changes: 2 additions & 2 deletions seqnado/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


@click.command(context_settings=dict(ignore_unknown_options=True))
@click.argument("method", type=click.Choice(["atac", "chip", "rna", "snp", "chip-rx"]))
@click.argument("method", type=click.Choice(["atac", "chip", "rna", "snp"]))
@click.argument("cookiecutter_options", nargs=-1, type=click.UNPROCESSED)
def cli_config(method, cookiecutter_options, help=False):
"""
Expand Down Expand Up @@ -55,7 +55,7 @@ def cli_design(method, files, output="design.csv"):
@click.command(context_settings=dict(ignore_unknown_options=True))
@click.argument(
"method",
type=click.Choice(["atac", "chip", "rna", "snp", "chip-rx", "consensus-peaks"]),
type=click.Choice(["atac", "chip", "rna", "snp", "consensus-peaks"]),
)
@click.option("--version", help="Print version and exit", is_flag=True)
@click.option("-c", "--cores", default=1, help="Number of cores to use", required=True)
Expand Down
28 changes: 12 additions & 16 deletions seqnado/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,8 @@ def get_control_file(wc, design, assay, filetype):


def define_output_files(
assay: Literal["ChIP", "ATAC", "RNA", "SNP", "ChIP-rx"],
assay: Literal["ChIP", "ATAC", "RNA", "SNP"],
chip_spikein_normalisation: bool = False,
sample_names: list = None,
pileup_method: list = None,
peak_calling_method: list = None,
Expand Down Expand Up @@ -300,6 +301,15 @@ def define_output_files(
analysis_output.append(hub_file)

if assay in ["ChIP", "ATAC"]:
if chip_spikein_normalisation:
if assay == "ChIP":
assay_output.extend(
[
"seqnado_output/normalisation_factors.tsv",
"seqnado_output/qc/full_fastqscreen_report.html",
]
)

if make_bigwigs and pileup_method:
assay_output.extend(
expand(
Expand Down Expand Up @@ -335,21 +345,7 @@ def define_output_files(
method=pileup_method,
)
)
elif assay == "ChIP-rx":
assay_output.extend(
[
"seqnado_output/qc/full_fastqscreen_report.html",
*expand(
"seqnado_output/qc/fastq_screen/{sample}_{read}_screen.html",
sample=sample_names,
read=["1", "2"],
),
*expand(
"seqnado_output/aligned/spikein/{sample}_stats.tsv",
sample=sample_names,
),
]
)


elif assay == "RNA":
if make_bigwigs and pileup_method:
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@
"chromosome_sizes": "/ceph/project/milne_group/shared/seqnado_reference/hg38/UCSC/sequence/hg38.chrom.sizes",
"indicies": "/ceph/project/milne_group/shared/seqnado_reference/hg38/UCSC/bt2_index/hg38",
"gtf": "/ceph/project/milne_group/shared/seqnado_reference/hg38/UCSC/genes/hg38.ncbiRefSeq.gtf",
"chip_spikein_normalisation": [
"yes",
"no"
],
"reference_genome": "hg38",
"spikein_genome": "dm6",
"fastq_screen_config": "/ceph/project/milne_group/shared/seqnado_reference/fastqscreen_reference/fastq_screen.conf",
"read_type": [
"paired",
"single"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ genome:

design: "design.csv"

spikein:
chip_spikein_normalisation: "{{cookiecutter.chip_spikein_normalisation}}"
reference_genome: "{{cookiecutter.reference_genome}}"
spikein_genome: "{{cookiecutter.spikein_genome}}"
fastq_screen_config: "{{cookiecutter.fastq_screen_config}}"

read_type: "{{cookiecutter.read_type}}"
split_fastq: "{{cookiecutter.split_fastq}}"
split_fastq_parts: "{{cookiecutter.split_fastq_parts}}"
Expand Down
20 changes: 17 additions & 3 deletions seqnado/workflow/rules/chip_refnorm.smk
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ rule fastq_screen:
fq_screen_txt="seqnado_output/qc/fastq_screen/{sample}_{read}_screen.txt",
params:
outdir="seqnado_output/qc/fastq_screen",
conf=config["genome"]["fastq_screen_config"],
conf=config["spikein"]["fastq_screen_config"],
tmpdir="seqnado_output/qc/fastqc_raw/{sample}_{read}",
basename=lambda wc, output: utils.get_fq_filestem(wc, samples=FASTQ_SAMPLES),
threads: config["bowtie2"]["threads"]
Expand Down Expand Up @@ -49,6 +49,8 @@ use rule align_paired as align_paired_spikein with:
fq2="seqnado_output/trimmed/{sample}_2.fastq.gz",
output:
bam=temp("seqnado_output/aligned/spikein/raw/{sample}.bam"),
params:
options="--no-mixed --no-discordant",
log:
"seqnado_output/logs/aligned_spikein/{sample}.log"

Expand Down Expand Up @@ -100,8 +102,8 @@ rule split_bam:
exo_bam=temp("seqnado_output/aligned/spikein/{sample}_exo.bam"),
stats="seqnado_output/aligned/spikein/{sample}_stats.tsv",
params:
genome_prefix=config["genome"]["sample_genome"],
exo_prefix=config["genome"]["exo_genome"],
genome_prefix=config["spikein"]["reference_genome"],
exo_prefix=config["spikein"]["spikein_genome"],
prefix="seqnado_output/aligned/spikein/{sample}",
map_qual=30,
log:"seqnado_output/logs/split_bam/{sample}.log"
Expand All @@ -120,3 +122,15 @@ rule move_ref_bam:
shell:"""
mv {input.bam} {output.bam}
"""

rule calculate_normalisation_factors:
input:
expand(rules.split_bam.output.stats, sample=SAMPLE_NAMES),
output:
normalisation_table = "seqnado_output/normalisation_factors.tsv",
normalisation_factors = "seqnado_output/normalisation_factors.json",
scale_factors="seqnado_output/scaling_factors.json",
log:
"seqnado_output/logs/normalisation_factors.log"
script:
"../scripts/calculate_spikein_norm_orlando.py"
Loading

0 comments on commit 7413bf1

Please sign in to comment.