Skip to content

Commit 5209f7f

Browse files
Merge pull request KarchinLab#3 from break-through-cancer/main
Fix Gliph2 implementation
2 parents 4a755e3 + 5e8ed69 commit 5209f7f

21 files changed

+408
-125
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Trigger Central Workflow on Issue Creation
2+
3+
on:
4+
issues:
5+
types: [opened]
6+
7+
jobs:
8+
dispatch:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Send Repository Dispatch
12+
env:
13+
GH_PAT: ${{ secrets.ADD_ISSUE_TO_PROJECT }}
14+
run: |
15+
curl -X POST -H "Authorization: Bearer $GH_PAT" \
16+
-H "Accept: application/vnd.github.everest-preview+json" \
17+
-d '{"event_type": "issue_opened", "client_payload": {"repository": "'${{ github.repository }}'", "issue_node_id": "'${{ github.event.issue.node_id }}'"}}' \
18+
https://api.github.com/repos/break-through-cancer/btc-dev-repo/dispatches

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ scripts/*
2121
notebooks/*
2222
!notebooks/sample_stats_template.qmd
2323
!notebooks/compare_stats_template.qmd
24+
!notebooks/gliph2_report_template.qmd
2425

2526
## Bash
2627
tmp

Dockerfile

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,37 @@
1-
FROM condaforge/miniforge3:23.3.1-1
1+
FROM condaforge/miniforge3:24.9.2-0
22

3-
# copy the environment file into /tmp
3+
# Copy the environment file into /tmp
44
COPY env.yml /tmp/env.yml
5+
# ENV DEBIAN_FRONTEND=noninteractive
56

6-
# update the mamba base environment with required packages
7+
# Update the mamba base environment with required packages
78
WORKDIR /tmp
89
RUN mamba env update -n base --file env.yml
910

10-
# install curl
11+
# Install system dependencies
1112
RUN apt-get update \
1213
&& apt-get install -y curl \
1314
&& apt-get clean \
1415
&& rm -rf /var/lib/apt/lists/*
1516

16-
# install GLIPH2
17-
RUN mkdir -p /opt/gliph2 \
18-
&& curl http://50.255.35.37:8080/downloads/irtools.centos -o /opt/gliph2/irtools \
19-
&& chmod +x /opt/gliph2/irtools
20-
21-
# install quarto
22-
RUN mkdir -p /opt/quarto/1.3.433 \
17+
# Install quarto
18+
RUN mkdir -p /opt/quarto/1.6.40 \
2319
&& curl -o quarto.tar.gz -L \
24-
"https://github.com/quarto-dev/quarto-cli/releases/download/v1.3.433/quarto-1.3.433-linux-amd64.tar.gz" \
20+
"https://github.com/quarto-dev/quarto-cli/releases/download/v1.6.40/quarto-1.6.40-linux-amd64.tar.gz" \
2521
&& tar -zxvf quarto.tar.gz \
26-
-C "/opt/quarto/1.3.433" \
22+
-C "/opt/quarto/1.6.40" \
2723
--strip-components=1 \
2824
&& rm quarto.tar.gz
2925

30-
# install R
31-
RUN mamba install -y r-base=4.1.0 \
26+
# Install R
27+
RUN mamba install -y r-base=4.4.2 \
3228
&& mamba clean -afy
3329

34-
# add quarto to the path
35-
ENV PATH="/opt/quarto/1.3.433/bin:${PATH}"
30+
RUN conda install r-igraph
31+
32+
# Install R packages, including igraph binary
33+
RUN Rscript -e "install.packages('remotes', repos='https://cran.r-project.org')" \
34+
&& Rscript -e "remotes::install_github('HetzDra/turboGliph')"
35+
36+
# Add quarto to the PATH
37+
ENV PATH="/opt/quarto/1.6.40/bin:${PATH}"

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
Thanks for checking out `TCRtoolkit-Bulk`, the platform for bulk T Cell Repertoire analysis! `TCRtoolkit-Bulk` is wrapped in NextFlow, written in python, and uses Docker to manage dependencies.
66

7+
![image info](assets/diagram.svg)
8+
79
We currently support bulk TCRseq data from Adaptive Biotechnologies.
810

911
## Requirements

assets/diagram.drawio

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
<mxfile host="65bd71144e">
2+
<diagram id="0YTWiKm3_E9Xy-bVv1lz" name="Page-1">
3+
<mxGraphModel dx="278" dy="181" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0">
4+
<root>
5+
<mxCell id="0"/>
6+
<mxCell id="1" parent="0"/>
7+
<mxCell id="5" value="" style="edgeStyle=none;html=1;" edge="1" parent="1" source="2" target="4">
8+
<mxGeometry relative="1" as="geometry"/>
9+
</mxCell>
10+
<mxCell id="2" value="Samplesheet" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="1">
11+
<mxGeometry x="280" y="70" width="120" height="60" as="geometry"/>
12+
</mxCell>
13+
<mxCell id="29" value="" style="edgeStyle=none;html=1;entryX=0.75;entryY=0;entryDx=0;entryDy=0;exitX=0.25;exitY=1;exitDx=0;exitDy=0;" edge="1" parent="1" source="4" target="7">
14+
<mxGeometry relative="1" as="geometry">
15+
<mxPoint x="150" y="170" as="sourcePoint"/>
16+
<Array as="points">
17+
<mxPoint x="310" y="270"/>
18+
</Array>
19+
</mxGeometry>
20+
</mxCell>
21+
<mxCell id="4" value="Input Check" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="1">
22+
<mxGeometry x="280" y="180" width="120" height="60" as="geometry"/>
23+
</mxCell>
24+
<mxCell id="33" value="" style="edgeStyle=none;html=1;" edge="1" parent="1" source="7" target="32">
25+
<mxGeometry relative="1" as="geometry"/>
26+
</mxCell>
27+
<mxCell id="7" value="Calc Sample" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="1">
28+
<mxGeometry x="130" y="320" width="120" height="60" as="geometry"/>
29+
</mxCell>
30+
<mxCell id="24" value="" style="edgeStyle=none;html=1;" edge="1" parent="1" source="10" target="20">
31+
<mxGeometry relative="1" as="geometry"/>
32+
</mxCell>
33+
<mxCell id="10" value="&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent;&quot;&gt;Calc Compare&lt;/span&gt;&lt;/div&gt;" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="1">
34+
<mxGeometry x="393" y="322" width="120" height="60" as="geometry"/>
35+
</mxCell>
36+
<mxCell id="13" value="Cluster&lt;div&gt;(turbogliph)&lt;/div&gt;" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="1">
37+
<mxGeometry x="592" y="321" width="120" height="60" as="geometry"/>
38+
</mxCell>
39+
<mxCell id="16" value="&lt;div style=&quot;color: rgb(59, 59, 59); background-color: rgb(255, 255, 255); font-family: Menlo, Monaco, &amp;quot;Courier New&amp;quot;, monospace; line-height: 18px; white-space: pre;&quot;&gt;&lt;span style=&quot;color: rgb(163, 21, 21);&quot;&gt;&lt;font style=&quot;font-size: 9px;&quot;&gt;compare_stats.html&lt;/font&gt;&lt;/span&gt;&lt;/div&gt;" style="shape=note;whiteSpace=wrap;html=1;backgroundOutline=1;darkOpacity=0.05;size=8;" vertex="1" parent="1">
40+
<mxGeometry x="321" y="453" width="30" height="35" as="geometry"/>
41+
</mxCell>
42+
<mxCell id="18" value="&lt;div style=&quot;color: rgb(59, 59, 59); background-color: rgb(255, 255, 255); font-family: Menlo, Monaco, &amp;quot;Courier New&amp;quot;, monospace; line-height: 18px; white-space: pre;&quot;&gt;&lt;span style=&quot;color: rgb(163, 21, 21);&quot;&gt;&lt;font style=&quot;font-size: 9px;&quot;&gt;sample_stats.html&lt;/font&gt;&lt;/span&gt;&lt;/div&gt;" style="shape=note;whiteSpace=wrap;html=1;backgroundOutline=1;darkOpacity=0.05;size=8;" vertex="1" parent="1">
43+
<mxGeometry x="68" y="453" width="30" height="35" as="geometry"/>
44+
</mxCell>
45+
<mxCell id="20" value="&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent;&quot;&gt;Plot Compare&lt;/span&gt;&lt;/div&gt;" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="1">
46+
<mxGeometry x="393" y="432.5" width="120" height="60" as="geometry"/>
47+
</mxCell>
48+
<mxCell id="21" value="&lt;div style=&quot;color: rgb(59, 59, 59); background-color: rgb(255, 255, 255); font-family: Menlo, Monaco, &amp;quot;Courier New&amp;quot;, monospace; line-height: 18px; white-space: pre;&quot;&gt;&lt;span style=&quot;color: rgb(163, 21, 21);&quot;&gt;&lt;font style=&quot;font-size: 9px;&quot;&gt;jaccard_mat.csv&lt;/font&gt;&lt;/span&gt;&lt;/div&gt;" style="shape=note;whiteSpace=wrap;html=1;backgroundOutline=1;darkOpacity=0.05;size=8;" vertex="1" parent="1">
49+
<mxGeometry x="321" y="309" width="30" height="35" as="geometry"/>
50+
</mxCell>
51+
<mxCell id="22" value="&lt;div style=&quot;color: rgb(59, 59, 59); background-color: rgb(255, 255, 255); font-family: Menlo, Monaco, &amp;quot;Courier New&amp;quot;, monospace; line-height: 18px; white-space: pre;&quot;&gt;&lt;span style=&quot;color: rgb(163, 21, 21);&quot;&gt;&lt;font style=&quot;font-size: 9px;&quot;&gt;sorensen_mat.csv&lt;/font&gt;&lt;/span&gt;&lt;/div&gt;" style="shape=note;whiteSpace=wrap;html=1;backgroundOutline=1;darkOpacity=0.05;size=8;" vertex="1" parent="1">
52+
<mxGeometry x="321" y="344" width="30" height="35" as="geometry"/>
53+
</mxCell>
54+
<mxCell id="23" value="&lt;div style=&quot;color: rgb(59, 59, 59); background-color: rgb(255, 255, 255); font-family: Menlo, Monaco, &amp;quot;Courier New&amp;quot;, monospace; line-height: 18px; white-space: pre;&quot;&gt;&lt;span style=&quot;color: rgb(163, 21, 21);&quot;&gt;&lt;font style=&quot;font-size: 9px;&quot;&gt;morisita_mat.csv&lt;/font&gt;&lt;/span&gt;&lt;/div&gt;" style="shape=note;whiteSpace=wrap;html=1;backgroundOutline=1;darkOpacity=0.05;size=8;" vertex="1" parent="1">
55+
<mxGeometry x="321" y="379" width="30" height="35" as="geometry"/>
56+
</mxCell>
57+
<mxCell id="26" value="&lt;div style=&quot;color: rgb(59, 59, 59); background-color: rgb(255, 255, 255); font-family: Menlo, Monaco, &amp;quot;Courier New&amp;quot;, monospace; line-height: 18px; white-space: pre;&quot;&gt;&lt;span style=&quot;color: rgb(163, 21, 21);&quot;&gt;&lt;font style=&quot;font-size: 9px;&quot;&gt;*.csv&lt;/font&gt;&lt;/span&gt;&lt;/div&gt;" style="shape=note;whiteSpace=wrap;html=1;backgroundOutline=1;darkOpacity=0.05;size=8;" vertex="1" parent="1">
58+
<mxGeometry x="551" y="337.5" width="30" height="35" as="geometry"/>
59+
</mxCell>
60+
<mxCell id="30" value="" style="edgeStyle=none;html=1;entryX=0.25;entryY=0;entryDx=0;entryDy=0;exitX=0.5;exitY=1;exitDx=0;exitDy=0;" edge="1" parent="1" source="4" target="10">
61+
<mxGeometry relative="1" as="geometry">
62+
<mxPoint x="425" y="200" as="sourcePoint"/>
63+
<mxPoint x="345" y="265" as="targetPoint"/>
64+
<Array as="points">
65+
<mxPoint x="340" y="280"/>
66+
</Array>
67+
</mxGeometry>
68+
</mxCell>
69+
<mxCell id="31" value="" style="edgeStyle=none;html=1;exitX=0.75;exitY=1;exitDx=0;exitDy=0;entryX=0;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="4" target="13">
70+
<mxGeometry relative="1" as="geometry">
71+
<mxPoint x="350" y="250" as="sourcePoint"/>
72+
<mxPoint x="590" y="300" as="targetPoint"/>
73+
<Array as="points">
74+
<mxPoint x="370" y="280"/>
75+
</Array>
76+
</mxGeometry>
77+
</mxCell>
78+
<mxCell id="32" value="Plot Sample" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="1">
79+
<mxGeometry x="130" y="432.5" width="120" height="60" as="geometry"/>
80+
</mxCell>
81+
<mxCell id="35" value="&lt;div style=&quot;color: rgb(59, 59, 59); background-color: rgb(255, 255, 255); font-family: Menlo, Monaco, &amp;quot;Courier New&amp;quot;, monospace; line-height: 18px; white-space: pre;&quot;&gt;&lt;span style=&quot;color: rgb(163, 21, 21);&quot;&gt;&lt;font style=&quot;font-size: 9px;&quot;&gt;sample_stats.csv&lt;/font&gt;&lt;/span&gt;&lt;/div&gt;" style="shape=note;whiteSpace=wrap;html=1;backgroundOutline=1;darkOpacity=0.05;size=8;" vertex="1" parent="1">
82+
<mxGeometry x="68" y="325.5" width="30" height="35" as="geometry"/>
83+
</mxCell>
84+
<mxCell id="36" value="&lt;div style=&quot;color: rgb(59, 59, 59); background-color: rgb(255, 255, 255); font-family: Menlo, Monaco, &amp;quot;Courier New&amp;quot;, monospace; line-height: 18px; white-space: pre;&quot;&gt;&lt;span style=&quot;color: rgb(163, 21, 21);&quot;&gt;&lt;font style=&quot;font-size: 9px;&quot;&gt;[V,D,J]_family.csv&lt;/font&gt;&lt;/span&gt;&lt;/div&gt;" style="shape=note;whiteSpace=wrap;html=1;backgroundOutline=1;darkOpacity=0.05;size=8;" vertex="1" parent="1">
85+
<mxGeometry x="69" y="353.5" width="30" height="35" as="geometry"/>
86+
</mxCell>
87+
</root>
88+
</mxGraphModel>
89+
</diagram>
90+
</mxfile>

assets/diagram.svg

Lines changed: 1 addition & 0 deletions
Loading

bin/prep_gliph2_tcr.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,13 @@
5353
df = df.rename(columns={'aminoAcid': 'CDR3b',
5454
'vGeneName': 'TRBV',
5555
'jGeneName': 'TRBJ',
56-
'count (templates/reads)': 'count'})
56+
# 'HLA_column_name': 'HLA', if hla_file input exists, incorporate it here
57+
'subject:condition': 'patient',
58+
'count (templates/reads)': 'counts'})
5759

5860
# Filter out rows of the df with missing CDR3b values
5961
df = df[df['CDR3b'].notna()]
6062

6163
# Write df to csv with the name ${project_name}_tcr.txt
62-
df.to_csv(args.project_name + "_tcr.txt", sep="\t", index=False, header=False)
64+
df.to_csv(args.project_name + "_tcr.txt", sep="\t", index=False, header=True)
6365

conf/base.config

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
/*
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
btc/spatial Nextflow base config file
4+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5+
A 'blank slate' config file, appropriate for general use on most high performance
6+
compute environments. Assumes that all software is installed and available on
7+
the PATH. Runs in `local` mode - all jobs will be run on the logged in environment.
8+
----------------------------------------------------------------------------------------
9+
*/
10+
11+
process {
12+
13+
// TODO nf-core: Check the defaults for all processes
14+
cpus = { check_max( 1 * task.attempt, 'cpus' ) }
15+
memory = { check_max( 4.GB * task.attempt, 'memory' ) }
16+
time = { check_max( 4.h * task.attempt, 'time' ) }
17+
18+
errorStrategy = { task.exitStatus in ((130..145) + 104) ? 'retry' : 'finish' }
19+
maxRetries = 3
20+
maxErrors = '-1'
21+
22+
// Process-specific resource requirements
23+
// NOTE - Please try and re-use the labels below as much as possible.
24+
// These labels are used and recognised by default in DSL2 files hosted on nf-core/modules.
25+
// If possible, it would be nice to keep the same label naming convention when
26+
// adding in your local modules too.
27+
// TODO nf-core: Customise requirements for specific processes.
28+
// See https://www.nextflow.io/docs/latest/config.html#config-process-selectors
29+
withLabel:process_single {
30+
cpus = { check_max( 1 , 'cpus' ) }
31+
memory = { check_max( 2.GB * task.attempt, 'memory' ) }
32+
time = { check_max( 4.h * task.attempt, 'time' ) }
33+
}
34+
withLabel:process_low {
35+
cpus = { check_max( 2 * task.attempt, 'cpus' ) }
36+
memory = { check_max( 12.GB * task.attempt, 'memory' ) }
37+
time = { check_max( 4.h * task.attempt, 'time' ) }
38+
}
39+
withLabel:process_medium {
40+
cpus = { check_max( 16 * task.attempt, 'cpus' ) }
41+
memory = { check_max( 16.GB * task.attempt, 'memory' ) }
42+
time = { check_max( 8.h * task.attempt, 'time' ) }
43+
}
44+
withLabel:process_high {
45+
cpus = { check_max( 12 * task.attempt, 'cpus' ) }
46+
memory = { check_max( 72.GB * task.attempt, 'memory' ) }
47+
time = { check_max( 16.h * task.attempt, 'time' ) }
48+
}
49+
withLabel:process_long {
50+
time = { check_max( 20.h * task.attempt, 'time' ) }
51+
}
52+
withLabel:process_high_memory {
53+
memory = { check_max( 200.GB * task.attempt, 'memory' ) }
54+
}
55+
withLabel:error_ignore {
56+
errorStrategy = 'ignore'
57+
}
58+
withLabel:error_retry {
59+
errorStrategy = 'retry'
60+
maxRetries = 2
61+
}
62+
63+
}

conf/modules.config

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
Config file for defining DSL2 per module options and publishing paths
4+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5+
Available keys to override module options:
6+
ext.args = Additional arguments appended to command in module.
7+
ext.args2 = Second set of arguments appended to command in module (multi-tool modules).
8+
ext.args3 = Third set of arguments appended to command in module (multi-tool modules).
9+
ext.prefix = File name prefix for output files.
10+
----------------------------------------------------------------------------------------
11+
*/
12+
13+
process {
14+
15+
publishDir = [
16+
path: { "${params.output}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" },
17+
mode: params.publish_dir_mode,
18+
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
19+
]
20+
21+
}

env.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,15 @@ dependencies:
88
- scipy=1.11.3
99
- seaborn=0.13.0
1010
- dash=2.14.1
11+
- matplotlib=3.8.1
1112
- pip=23.2.1
13+
- jupyterlab=4.0.8
14+
- notebook=7.0.6
15+
- fsspec=2024.3.1
16+
- s3fs=2024.3.1
1217
- pip:
1318
- csvkit==1.3.0
14-
- jupyter
15-
- jupyterlab==4.0.8
16-
- notebook==7.0.6
17-
- matplotlib==3.8.1
1819
- papermill==2.4.0
1920
- plotly==5.18.0
2021
- abydos==0.5.0
2122
- fastcluster==1.2.6
22-
- fsspec==2024.3.1
23-
- s3fs==2024.3.1

modules/local/calc_compare.nf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ process CALC_COMPARE {
44

55
// beforeScript 'export DOCKER_OPTS="-v $${params.data_dir}:$${params.data_dir}"'
66

7-
container "karchinlab/bulktcr:1.0"
7+
container "ghcr.io/break-through-cancer/bulktcr:latest"
88

99
publishDir "${params.output}/compare_output/", mode: "copy", overwrite: "true"
1010

modules/local/calc_sample.nf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ process CALC_SAMPLE {
22
tag "${sample_meta[0]}"
33
label 'process_single'
44

5-
container "karchinlab/bulktcr:1.0"
5+
container "ghcr.io/break-through-cancer/bulktcr:latest"
66

7-
publishDir "${params.output}/sample_output/", mode: "copy", overwrite: "true"
7+
// publishDir "${params.output}/sample_output/", mode: "copy", overwrite: "true"
88

99
input:
1010
tuple val(sample_meta), path(count_table)

modules/local/gliph2.nf

Lines changed: 0 additions & 61 deletions
This file was deleted.

0 commit comments

Comments
 (0)