Skip to content

Commit

Permalink
Refactor pileup_norm.smk to use input.chromsizes and params.tile_size…
Browse files Browse the repository at this point in the history
… in tile_regions rule
  • Loading branch information
alsmith151 committed Apr 21, 2024
1 parent 2fa2a30 commit 62b4af1
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions seqnado/workflow/rules/pileup_norm.smk
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,14 @@ rule tile_regions:
import pyranges as pr

chromsizes = (
pd.read_csv(chromsizes, sep="\t", header=None).set_index(0)[1].to_dict()
pd.read_csv(input.chromsizes, sep="\t", header=None).set_index(0)[1].to_dict()
)
genome_tiled = pr.gf.tile_genome(chromsizes, tile_size=tile_size)
genome_tiled = pr.gf.tile_genome(chromsizes, tile_size=params.tile_size)
genome_tiled = genome_tiled.df.assign(
feature="tile", gene_id=lambda df: df.index.astype(str)
).pipe(pr.PyRanges)
genome_tiled.to_gtf(output.genome_tiled)


rule count_bam:
input:
bam=expand("seqnado_output/aligned/{sample}.bam", sample=DESIGN.sample_names),
Expand Down Expand Up @@ -116,6 +115,8 @@ rule calculate_scaling_factors:
metadata="seqnado_output/counts/{group}_metadata.tsv",
output:
scaling_factors="seqnado_output/resources/{group}_scaling_factors.tsv",
container:
"library://asmith151/seqnado/seqnado_report:latest"
script:
"../scripts/calculate_scaling_factors.R"

Expand All @@ -126,8 +127,14 @@ rule calculate_scaling_factors_spikein:
metadata="seqnado_output/design.csv",
output:
size_factors="seqnado_output/resources/all_normalisation_factors.json"
container:
"library://asmith151/seqnado/seqnado_report:latest"
params:
spikein_genes=["AmpR_seq", "Cas9_5p_seq", "Cas9_3p_seq"],
log:
"seqnado_output/logs/normalisation_factors.log"
script:
"../scripts/calculate_spikein_norm_factors.r"
"../scripts/calculate_spikein_norm_factors_rna.R"



Expand Down

0 comments on commit 62b4af1

Please sign in to comment.