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

Move activity to input #249

Merged
merged 2 commits into from
Feb 22, 2025
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
5 changes: 3 additions & 2 deletions workflow/rules/neighborhoods.smk
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
rule create_neighborhoods:
input:
candidateRegions = os.path.join(RESULTS_DIR, "{biosample}", "Peaks", "macs2_peaks.narrowPeak.sorted.candidateRegions.bed"),
chrom_sizes_bed = os.path.join(RESULTS_DIR, "tmp", os.path.basename(config['ref']['chrom_sizes']) + '.bed')
chrom_sizes_bed = os.path.join(RESULTS_DIR, "tmp", os.path.basename(config['ref']['chrom_sizes']) + '.bed'),
activity_files = get_activity_files
params:
DHS = lambda wildcards: BIOSAMPLES_CONFIG.loc[wildcards.biosample, "DHS"] or '',
ATAC = lambda wildcards: BIOSAMPLES_CONFIG.loc[wildcards.biosample, "ATAC"] or '',
Expand Down Expand Up @@ -41,4 +42,4 @@ rule create_neighborhoods:
--ubiquitously_expressed_genes {params.ubiquitous_genes} \
--H3K27ac {params.H3K27ac} \
{params.qnorm}
"""
"""
8 changes: 8 additions & 0 deletions workflow/rules/utils.smk
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,14 @@ def get_accessibility_files(wildcards):
files = BIOSAMPLES_CONFIG.loc[wildcards.biosample, "DHS"] or BIOSAMPLES_CONFIG.loc[wildcards.biosample, "ATAC"]
return files.split(",")

def get_activity_files(wildcards):
# for neighborhoods step, to trigger download of necessary inputs
files = get_accessibility_files(wildcards)
k27ac_value = BIOSAMPLES_CONFIG.loc[wildcards.biosample, "H3K27ac"]
if k27ac_value:
k27ac_files = k27ac_value.split(",")
files = files + k27ac_files
return files

def _validate_accessibility_feature(row: pd.Series):
if row["DHS"] and row["ATAC"]:
Expand Down