Skip to content
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
7 changes: 6 additions & 1 deletion nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,12 @@ params {
imgt_lookup = "${projectDir}/assets/airr/imgt_adaptive_lookup.tsv"

// Sample + compare parameters
workflow_level = "sample,compare"
run_sample = true
run_compare = true
run_patient = false
run_convert = false

workflow_level = null
project_name = "tcrtoolkit_"+ new Date().format("yyyy-MM-dd_HH-mm-ss")

// Notebooks parameters
Expand Down
14 changes: 9 additions & 5 deletions notebooks/template_overlap.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -704,17 +704,21 @@ import pandas as pd

# Prepare stats table
stats_df = detailed_comparisons_table.copy()
stats_df['p_value'] = pd.to_numeric(stats_df['p_value'], errors='coerce')
stats_df['fold_change'] = pd.to_numeric(stats_df['fold_change'], errors='coerce')
if 'p_value' in stats_df.columns:
stats_df['p_value'] = pd.to_numeric(stats_df['p_value'], errors='coerce')
if 'fold_change' in stats_df.columns:
stats_df['fold_change'] = pd.to_numeric(stats_df['fold_change'], errors='coerce')

# Helper function to get Top 15 Unique CDR3s per patient & origin
def get_top_ids(df, direction):
id_map = {}

# Safely group by subject and origin if it exists
group_cols = [subject_col, 'origin'] if 'origin' in df.columns else [subject_col]

for name, group in df.groupby(group_cols):
group_cols = set([subject_col, 'origin']).intersection(df.columns)
if len(group_cols) == 0:
raise ValueError("No valid grouping columns in the df. Available columns: " + ", ".join(df.columns))

for name, group in df.groupby(list(group_cols)):
# name is either a tuple (subject, origin) or just subject
if direction == 'up':
subset = group[group['fold_change'] > 1]
Expand Down
288 changes: 166 additions & 122 deletions subworkflows/local/bulktcr_analysis.nf

Large diffs are not rendered by default.

Loading
Loading