Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
330 commits
Select commit Hold shift + click to select a range
a943b06
Enabling user to select motif lenght for class I
prmunday Nov 27, 2024
fad4b31
Pepscanner fix : replace quotes if present in column names
prmunday Dec 2, 2024
30121bd
Pepscaner : Sort proteins by peptide count
prmunday Dec 2, 2024
92ad7ad
Update species name
prmunday Jan 16, 2025
e41d812
Update h2 allele names
prmunday Jan 23, 2025
ba85620
py script to fix depenencies issue
prmunday Jan 23, 2025
efcc873
Initial docker file setup
prmunday Jan 23, 2025
35d7573
clean up
prmunday Jan 23, 2025
0567410
Merge branch 'develop' of https://github.com/prmunday/Immunolyser int…
prmunday Jan 23, 2025
ccf8b99
main gibbs setting update
prmunday Jan 29, 2025
ba443f5
gibbs bug fix and reverse last change
prmunday Jan 29, 2025
685c59e
bug fix
prmunday Jan 29, 2025
7ea4ef2
gubbs update
prmunday Jan 29, 2025
f0f028a
updated gibss running when ran individually
prmunday Jan 29, 2025
4661642
bug fix from last commit
prmunday Jan 29, 2025
3f7ee6d
gibbs py reverse
prmunday Feb 4, 2025
29ba2f7
dynamic set CELERY_BROKER_URL based on env
prmunday Jan 24, 2025
d6287b6
docker git repo update : temp
prmunday Jan 24, 2025
47952d2
Initial set up to run celery in docker
prmunday Jan 24, 2025
8562377
docker mount fix
prmunday Jan 24, 2025
4b146d9
adding python 2 in repo
prmunday Jan 25, 2025
759825b
remove python2 and type might not be copmatible
prmunday Jan 25, 2025
f9d2bb6
seq2logo gs fix
prmunday Jan 25, 2025
c8e0c65
updated docker file to load data files into host folder
prmunday Jan 29, 2025
817201c
updated gibbs cluster script to use project root to determine seq2log…
prmunday Jan 31, 2025
75c6f89
added logging in utils method
prmunday Jan 31, 2025
fbbf5b1
pass logger in utls method
prmunday Jan 31, 2025
4a30297
util method update
prmunday Jan 31, 2025
1325249
testing docker file update
prmunday Jan 31, 2025
3f6fed1
added option to check no prefix is created
prmunday Feb 2, 2025
d3509b4
reverse last change
prmunday Feb 2, 2025
aea3a02
pushing latest yml file
prmunday Feb 2, 2025
3a597c6
uodate docker file to install binder tools
prmunday Feb 3, 2025
f8beea4
man command for netmhcpab
prmunday Feb 3, 2025
6866601
use full path for the predictors
prmunday Feb 4, 2025
75f5705
path updates to use full path
prmunday Feb 4, 2025
47629e9
docker file fixes to run binders
prmunday Feb 4, 2025
2e3b194
netmhcpan path update
prmunday Feb 4, 2025
7e9cfd1
mkdir tmp for netmhc pan
prmunday Feb 4, 2025
ff4d8b4
docker file update
prmunday Feb 4, 2025
8404865
Input file exmaple update
prmunday Feb 9, 2025
d222c8c
Use presentation_percentile for MHCflurry
prmunday Feb 12, 2025
e9e3d87
Update celery status from Pending to Progressing
prmunday Feb 12, 2025
6edaf2d
update Progressing to Processing
prmunday Feb 12, 2025
5f27164
update gibbs class 1 and 2 args.. feed all mers for gibbs
prmunday Feb 20, 2025
c57d64e
remove function to generate gibbs cluster by click
prmunday Feb 20, 2025
488c4e8
Report text updated based on updated gibbs updated logic.
prmunday Feb 25, 2025
91bafee
Creation of folders to store majority voted binders
prmunday Feb 25, 2025
4b3b1a3
Revert seqlgog message about input peptides
prmunday Feb 27, 2025
ad76a57
Run Seq2Logo conditionally
prmunday Feb 27, 2025
35d5852
Conditionally running Seq2logo
prmunday Feb 27, 2025
0a34086
Analytics text update
prmunday Feb 27, 2025
95068dd
Hide Seq2Logo for class2 if no alleles are selected
prmunday Feb 27, 2025
75633d0
method not ready
prmunday Feb 28, 2025
9fe3137
bug fix for Gibbs motif length
prmunday Feb 28, 2025
f695abe
gibbs fix for docker
prmunday Feb 28, 2025
73a21b9
Clearn pepscnaner input files based on Accession column
prmunday Mar 1, 2025
eb95fb8
Functionality to majority voted binder as csv files
prmunday Mar 2, 2025
42c29f6
Generation of majority voted binder
prmunday Mar 2, 2025
93dc71d
Merge branch 'upgrade/download-majority-voted-binders' into develop
prmunday Mar 2, 2025
e128a06
Bug fix
prmunday Mar 2, 2025
d78bbfe
Bug fix
prmunday Mar 2, 2025
70e5ce4
Run HLA-clust
prmunday Mar 5, 2025
cb37377
Show HLA clust resutls in front end
prmunday Mar 5, 2025
d233767
Update hla-clust
prmunday Mar 6, 2025
b2e91c8
Upated code to run hla clust
prmunday Mar 12, 2025
8c3d9bf
Gibbs update to cluster 1-6
prmunday Mar 13, 2025
e797db2
Fix to run HLAClust
prmunday Mar 13, 2025
cd5bcb0
Update Dockerfile
prmunday Mar 19, 2025
81e42c9
run MHC tp without n_clusters arg
prmunday Apr 4, 2025
30122fa
description of MHC-TP
prmunday Apr 4, 2025
452c1ca
Update gibbs output with MHC-TP output
prmunday Apr 21, 2025
85796f6
Integrate MHC-TP results into GibbCluster results
prmunday Apr 24, 2025
013216f
temporary progress to remote
prmunday Apr 28, 2025
54cae88
Run protpetigram from the form submission, pending UI
prmunday Apr 30, 2025
70950f4
updated demo page for pepscanner
prmunday Apr 30, 2025
77e6ec3
pepscanner update pending bug of accession selectioin
prmunday Apr 30, 2025
aea14e9
Final integration ProtPeptigram
prmunday May 2, 2025
f82ae05
added protpeptigram in pip list
prmunday May 2, 2025
ef0e72b
Run protpeptigram one by one
prmunday May 2, 2025
f999c23
pepsacnner metadata table css adjust
prmunday May 3, 2025
5796a0d
Option to export data used to generate graphs
prmunday May 3, 2025
351592f
rearrange pepscanner
prmunday May 13, 2025
319ce83
pepsanner update
prmunday May 15, 2025
e008046
added email functionality
prmunday May 18, 2025
f58829f
updated text
prmunday May 26, 2025
51f870b
UI update
prmunday May 27, 2025
0cd3715
initialiser page ui update
prmunday May 28, 2025
a9cf42b
add job resitry
prmunday Jun 2, 2025
b77427b
Ability to download peptides from overlap
prmunday Jun 5, 2025
2580f09
update text ui
prmunday Jun 5, 2025
ef62591
Create README.md
prmunday Jun 8, 2025
e9abf4a
test readme update
prmunday Jun 8, 2025
bb96d19
generate gibbs update. test on remote server
prmunday Jun 12, 2025
35ca763
slick css update
prmunday Jun 12, 2025
54f583d
fix xhr of setupPeptideOverlapUpsetPlot
prmunday Jun 12, 2025
18592ee
bug fix js
prmunday Jun 12, 2025
c4cb0c7
bug fix js
prmunday Jun 12, 2025
cd82261
remote debuggin
prmunday Jun 12, 2025
f833c6d
remote debug js
prmunday Jun 12, 2025
4db13c6
remote debug js
prmunday Jun 12, 2025
ecbb04d
remote js debug
prmunday Jun 12, 2025
5097810
slcik update
prmunday Jun 12, 2025
4fb70fb
slcick upadte
prmunday Jun 12, 2025
adac42f
test slcik
prmunday Jun 12, 2025
464a5d3
Binding motif click on upset
prmunday Jun 15, 2025
7d1d2ab
UI update
prmunday Jun 19, 2025
2008a98
UI update. feedback from Natham
prmunday Jun 24, 2025
347f350
ui update
prmunday Jun 24, 2025
8c90ed1
ability to download seq2logo input peptides
prmunday Jun 25, 2025
bb0f8c0
seq2logo peptide download fix and completed
prmunday Jun 26, 2025
bdb34c7
enabling core download method for giibs
prmunday Jun 26, 2025
7b87836
Protpeptigram update
prmunday Jun 26, 2025
c46ce1e
protpeptigram fix
prmunday Jun 26, 2025
4beb947
MHC-TP ui update
prmunday Jul 1, 2025
03ec8cd
ui fix
prmunday Jul 1, 2025
8beb7c9
ui fix
prmunday Jul 1, 2025
4850fee
ui fix
prmunday Jul 1, 2025
bc80f5e
ui
prmunday Jul 1, 2025
4060218
revert gibb scroll bar ui update
prmunday Jul 2, 2025
470d3d5
pepscanner fix
prmunday Jul 8, 2025
c37a6c8
fix pepscanner image
prmunday Jul 10, 2025
af4342e
Update README.md
prmunday Jul 11, 2025
c9ac734
add traceback to hadnle no peptides after contan clean opetation
prmunday Jul 16, 2025
d1b52d2
fix exception handling
prmunday Jul 16, 2025
406dc55
hiding help page until updated
prmunday Jul 30, 2025
b2ac25f
Overlap plot selection option
prmunday Aug 21, 2025
608822e
update text
prmunday Aug 21, 2025
445b300
binding prediction adjust and issue fix
prmunday Aug 25, 2025
5ddb583
remove extra space
prmunday Aug 25, 2025
0a77a6e
Option to search a smaller database for mhc-tp
prmunday Sep 9, 2025
07cc37b
have all peptide in binding results
prmunday Sep 16, 2025
188a475
hla arg fix for mhc-tp
prmunday Sep 16, 2025
e71d4c4
update utils to run mhc-tp and update top 40 allele file per hla type
prmunday Sep 18, 2025
517d2e5
update to config netmhcpan 4.2
prmunday Sep 18, 2025
2cef177
updates for netmhcpan integration
prmunday Sep 20, 2025
eb70afd
change
prmunday Sep 20, 2025
21ed339
initaliser page udpates
prmunday Sep 21, 2025
3739e0f
added logs
prmunday Sep 21, 2025
f683388
pepscanner message update
prmunday Sep 21, 2025
f1281b5
tyring out upset update for violin plot
prmunday Sep 21, 2025
037ee4c
violine plot wokring
prmunday Sep 22, 2025
6e823b7
identation
prmunday Sep 22, 2025
4594e8c
single sample name post fix
prmunday Sep 23, 2025
e9b510b
finalise violin plot
prmunday Sep 23, 2025
df3f325
ignore local setup files
prmunday Sep 24, 2025
4cf7255
sample validation message update
prmunday Sep 24, 2025
4394140
download core as text
prmunday Sep 25, 2025
903cc7f
MHC-TP description update
prmunday Sep 25, 2025
cdf4770
update majorityvoting
prmunday Sep 25, 2025
6b24893
overlap upset fixed
prmunday Sep 25, 2025
b016c2e
ignote test ipynb
prmunday Sep 25, 2025
b214f96
lower mhc-tp threshhold
prmunday Sep 25, 2025
a797bd5
lower mhc-tp threshold
prmunday Sep 25, 2025
a234d31
Updated majority voted downloadable files
prmunday Sep 26, 2025
afeee82
majority voting html update
prmunday Sep 26, 2025
ca3bebd
majority voted output file update
prmunday Sep 26, 2025
dc9f09b
updates tools for docker purpose
prmunday Sep 28, 2025
cda65a9
try mhc-tp
prmunday Sep 28, 2025
7f5a4d3
docker update
prmunday Sep 28, 2025
4693995
MHC-TP dir name update
prmunday Sep 28, 2025
fd60f21
reverse mhc-tp name
prmunday Sep 28, 2025
1094280
undo error bars
prmunday Sep 29, 2025
d84eb4c
seq2logo div available always
prmunday Sep 29, 2025
b7c83c4
control file fix
prmunday Sep 29, 2025
f45ec8d
add logs in save binding info method and enabled mixmhc2pred for savi…
prmunday Sep 30, 2025
baa837d
netmhc2pan prediction fix
prmunday Sep 30, 2025
a5fc985
seq2logo fix for class 2
prmunday Sep 30, 2025
3d8c36e
label gibbs result with mhc-tp conditionally
prmunday Sep 30, 2025
a980614
fix mixmhc2pred tool specific names
prmunday Sep 30, 2025
2791580
update base page
prmunday Oct 1, 2025
76799ec
analytics page update
prmunday Oct 1, 2025
48703e7
not show overlap upset for class 2
prmunday Oct 1, 2025
82d04eb
use cors to generate upset plot for binder netmhc2pan
prmunday Oct 2, 2025
1aa258f
ability to name the job
prmunday Oct 2, 2025
56d8177
send back email with job name in it
prmunday Oct 2, 2025
2cd4ec6
bug
prmunday Oct 2, 2025
5f226b7
update pepscanner text
prmunday Oct 4, 2025
409fd0b
add border to analytics section
prmunday Oct 4, 2025
8ab352b
updated text alignment
prmunday Oct 4, 2025
9bb30ee
url update
prmunday Oct 5, 2025
bbdcd0e
addition of banner
prmunday Oct 6, 2025
11f0093
identation fix
prmunday Oct 6, 2025
80a52d5
banner update
prmunday Oct 6, 2025
2767a92
banner update
prmunday Oct 7, 2025
ea35212
Stop tracking static/images symlink
prmunday Oct 7, 2025
1905618
manuscript accepted
prmunday Oct 8, 2025
12d7e67
index page update
prmunday Oct 8, 2025
bd16152
text update
prmunday Oct 8, 2025
96375e8
typo fix
prmunday Oct 10, 2025
5789999
update pepscanner
prmunday Oct 12, 2025
65b8040
walkthruogh video
prmunday Oct 14, 2025
ae7d72a
geo ip addtion
prmunday Oct 22, 2025
634a17b
privacy note added
prmunday Oct 22, 2025
6f2aa4b
add ref for netmhc2pan 4.3
prmunday Oct 22, 2025
8f78419
privacy staement update
prmunday Oct 22, 2025
486fd14
add doi link
prmunday Oct 24, 2025
49b7e49
flag to notify invalid amino acids
prmunday Oct 29, 2025
32e3300
dcoker local version fix
prmunday Nov 4, 2025
2fb4992
entrypoint update
prmunday Nov 4, 2025
dc61d5f
move sqlite file outside proj dir
prmunday Nov 5, 2025
f1f92e7
error bar fix
prmunday Nov 11, 2025
b461475
update docker file
prmunday Nov 25, 2025
f6100c0
isntall sqlite3
prmunday Nov 25, 2025
b36fad2
docker setup update
prmunday Nov 25, 2025
7d3c7a5
mhc-tp name temp fix
prmunday Nov 25, 2025
4987082
Fix open redirect + input validation across Flask routes
prmunday Dec 8, 2025
0f17d40
hide banner
prmunday Feb 3, 2026
2d12375
heatmap fix
prmunday Apr 9, 2026
6333287
Fix job queue jams and duplicate email notifications
prmunday May 2, 2026
20233bb
Update Dockerfile: fix COPY paths and bump tool versions
prmunday May 2, 2026
4455491
Add versioning, release notes banner, and What's New section
prmunday May 2, 2026
435f842
Improve email notifications and update site logo
prmunday May 2, 2026
5cc72aa
Fix path traversal in /api/generateGibbs endpoint
prmunday May 2, 2026
b57d77a
Hide Generic Analysis tab unless viewing a job; fix /analytics redirect
prmunday May 2, 2026
3df09ae
Visual & UX overhaul: sticky header, ToC sidebar, Slick fix, form polish
prmunday May 3, 2026
9efb7a3
Fix post-audit UI bugs: logo, banner close, ToC scroll, carousel capt…
prmunday May 3, 2026
cedcf10
Fix ToC sticky, Gibbs bar chart width, banner close button
prmunday May 3, 2026
fa7a961
Security hardening: fix path traversal, debug mode, secret key, headers
prmunday May 13, 2026
a010758
Migrate email from Gmail SMTP to Monash SMTP relay, remove EMAIL_APP_…
prmunday May 14, 2026
64336ae
Switch Flask dev server to gunicorn for production
prmunday May 14, 2026
8d39def
Add 30-day data retention with expiry warnings
prmunday May 14, 2026
f1d30bb
Add offline HTML report export (/export/<taskId>)
prmunday May 14, 2026
1c6d807
Fix Celery beat_schedule config key to use old-style CELERYBEAT_SCHEDULE
prmunday May 14, 2026
2041fc5
Add systemd service files and fix Celery beat_schedule config key
prmunday May 14, 2026
30fcffb
Make email result URLs configurable via BASE_URL env var
prmunday May 14, 2026
29d48e0
Move download buttons to ToC sidebar; fix Plotly.plot in export
prmunday May 14, 2026
5c59ce5
Bundle Plotly, UpSetJS, Bootstrap into export for true offline support
prmunday May 14, 2026
0d8ad97
Keep download buttons at bottom of ToC sidebar with consistent indent…
prmunday May 14, 2026
ae7f7b2
Fix netMHCpan/netMHCIIpan output parsing for 4.2c format: skiprows=2 …
prmunday May 14, 2026
bc44d21
Update binding table: NetMHCpan column Rank -> EL_rank, add note abou…
prmunday May 14, 2026
5c76a22
Fix gibbscluster-2.0f output: handle PID subdirectory and .png extension
prmunday May 15, 2026
5c3a87c
Fix gibbscluster-2.0f PID subdir paths in template and utils
prmunday May 15, 2026
b1b03c1
Create output directories before MixMHCpred, MixMHC2pred, MHCflurry c…
prmunday May 15, 2026
4307184
Log MixMHCpred errors: switch from call() to subprocess.run with capt…
prmunday May 15, 2026
0f7a536
Fix MixMHCpred python3 resolution: prepend lenv/bin to PATH in subpro…
prmunday May 15, 2026
00e3b4a
Fix Gibbs image paths in export.html: use full static-relative path
prmunday May 15, 2026
9060821
Embed binder CSVs as data URIs in offline export
prmunday May 15, 2026
c53a789
Fix binders UpSet key mismatch and embed all Gibbs cluster counts in …
prmunday May 15, 2026
fbe87cf
Fix majority voted UpSet missing and violin persistence in export
prmunday May 15, 2026
8d2b1af
Fix majority voted empty UpSet and violin no-data in export
prmunday May 15, 2026
c41c8f5
Upgrade Flask 1.1.2 to 3.0.3 and remove dead dependencies
prmunday May 17, 2026
8da634f
Fix majority voted UpSet empty and violin no-data in offline export
prmunday May 17, 2026
e33746b
Fix clust-search input path to use GibbsCluster numbered subdirectory
prmunday May 18, 2026
31549d9
Add v2.2.0 release notes: server rebuild, offline report, data retention
prmunday May 18, 2026
088ab04
Update release notes: replace coming soon with MHC-TP Class II in pro…
prmunday May 18, 2026
8a3f36d
Skip non-directory entries when iterating task folder in generateBind…
prmunday May 19, 2026
5f8d155
Skip non-directory entries when iterating task folder — fixes crash w…
prmunday May 19, 2026
21586b3
prod deployment file
prmunday May 19, 2026
4de3a2f
Merge security/hardening into main
prmunday May 19, 2026
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
Binary file modified .DS_Store
Binary file not shown.
26 changes: 26 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copy this file to .env and fill in the values before running the server.
# Never commit .env to git.

# Generate with: python -c "import secrets; print(secrets.token_hex(32))"
SECRET_KEY=

# Path to the data volume (job files and SQLite DB)
IMMUNOLYSER_DATA=/pvol

# Set to 'true' if running inside Docker, 'false' on bare server
IS_DOCKER=false

# Set to 'true' only for local development — NEVER in production
DEBUG=False

# Sender address for job notification emails (uses Monash SMTP relay, no password needed)
EMAIL_ADDRESS=noreply@immunolyser.erc.monash.edu

# Public base URL of the server (used in email links)
BASE_URL=https://immunolyser.erc.monash.edu

# UUID of the demo job shown on the homepage
DEMO_TASK_ID=

# Days before job files are deleted from the server (default: 30)
DATA_RETENTION_DAYS=30
11 changes: 9 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
app/tools
app/static/images/*
app/static/images
.env
app/__pycache__/*
__pycache__/
immunolyser-data/*
lenv/*
lenv/*
.vscode/launch.json
test.py
data_files/*
data_files_2/*
tools/*
test.ipynb
173 changes: 173 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
FROM python:3.12-slim

# Set the working directory in the container
WORKDIR /app

# Install build tools, R, tcsh, and other required dependencies
RUN apt-get update && apt-get install -y \
bash \
git \
tar \
build-essential \
wget \
libssl-dev \
libbz2-dev \
libreadline-dev \
libsqlite3-dev \
zlib1g-dev \
sqlite3 \
r-base \
man-db \
ncompress \
tcsh \
&& \
wget https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs926/ghostscript-9.26.tar.gz && \
tar -xzf ghostscript-9.26.tar.gz && \
cd ghostscript-9.26 && \
./configure && make && make install && \
pip3 install --no-cache-dir gdown && \
apt-get clean && rm -rf /var/lib/apt/lists/*

# Clone the repository and checkout the develop branch in one go
RUN git clone --branch develop --single-branch https://github.com/prmunday/Immunolyser /app/Immunolyser

# Change to the repository directory
WORKDIR /app/Immunolyser

# Copy the seq2logo tar.gz file from the local tools folder to the container
COPY app/tools/seq2logo-2.1.all.tar.gz /app/Immunolyser/app/tools/

# Create a tools directory and extract the tar.gz file there
RUN mkdir -p /app/Immunolyser/app/tools && \
tar -xzf /app/Immunolyser/app/tools/seq2logo-2.1.all.tar.gz -C /app/Immunolyser/app/tools && \
rm /app/Immunolyser/app/tools/seq2logo-2.1.all.tar.gz

# Copy the gibbscluster tar.gz file to the container
COPY app/tools/gibbscluster-2.0f.Linux.tar.gz /app/Immunolyser/app/tools/

# Extract gibbscluster tar.gz
RUN mkdir -p /app/Immunolyser/app/tools && \
tar -xvf /app/Immunolyser/app/tools/gibbscluster-2.0f.Linux.tar.gz -C /app/Immunolyser/app/tools && \
rm /app/Immunolyser/app/tools/gibbscluster-2.0f.Linux.tar.gz

# Update GIBBS path in the gibbscluster file
RUN sed -i 's|setenv\s*GIBBS .*|setenv GIBBS /app/Immunolyser/app/tools/gibbscluster-2.0|' /app/Immunolyser/app/tools/gibbscluster-2.0/gibbscluster

# Comment out the line containing '$resdir .= "/$prefix";' in GibbsCluster-2.0e_SA.pl; command update for seq2logo and gibbs
RUN sed -i \
-e 's|^\(\s*\$resdir .= "/\$prefix";\)|# \1 # Comment or remove this line|' \
-e 's|^\(my \$barplot = "\$resdir/images/\$prefix.gibbs.KLDvsCluster.barplot.png";\)|my \$barplot = "\$resdir/images/gibbsKLDvsCluster.barplot.JPG";|' \
-e '530s@.*@$cmd .= "$seq2logo -f $corefile -o $logofile -I 2 --format [JPEG] -b $wlc -C 2 -S 2 -t $title \&>/dev/null; ";@' \
/app/Immunolyser/app/tools/gibbscluster-2.0/GibbsCluster-2.0e_SA.pl

# Copy the netMHCpan tar.gz file to the container
COPY app/tools/netMHCpan-4.2c.Linux.tar.gz /app/Immunolyser/app/tools/

# Uncompress and untar the netMHCpan package
RUN mkdir -p /app/Immunolyser/app/tools && \
cat /app/Immunolyser/app/tools/netMHCpan-4.2c.Linux.tar.gz | gunzip | tar xvf - -C /app/Immunolyser/app/tools && \
rm /app/Immunolyser/app/tools/netMHCpan-4.2c.Linux.tar.gz && \
mkdir -p /app/Immunolyser/app/tools/netMHCpan-4.2/tmp

# Copy the netMHCIIpan tar.gz file to the container
COPY app/tools/netMHCIIpan-4.3j.Linux.tar.gz /app/Immunolyser/app/tools/

# Uncompress and untar the netMHCIIpan package
RUN mkdir -p /app/Immunolyser/app/tools && \
tar -xvf /app/Immunolyser/app/tools/netMHCIIpan-4.3j.Linux.tar.gz -C /app/Immunolyser/app/tools && \
rm /app/Immunolyser/app/tools/netMHCIIpan-4.3j.Linux.tar.gz && \
man -d /app/Immunolyser/app/tools/netMHCIIpan-4.3/netMHCIIpan.1 | compress > /app/Immunolyser/app/tools/netMHCIIpan-4.3/netMHCIIpan.Z

# Update netMHCIIpan configuration to use the correct NMHOME path
RUN sed -i 's|setenv\s*NMHOME\s*/tools/src/netMHCIIpan-4.3|setenv NMHOME ${PWD}/app/tools/netMHCIIpan-4.3|' \
/app/Immunolyser/app/tools/netMHCIIpan-4.3/netMHCIIpan

# Update netMHCpan configuration to use the correct NMHOME and TMPDIR paths
RUN sed -i \
-e 's|setenv\s*NMHOME\s*/tools/src/netMHCpan-4.2|setenv NMHOME ${PWD}/app/tools/netMHCpan-4.2|' \
-e 's|setenv\s*TMPDIR\s*/tmp|setenv TMPDIR $NMHOME/tmp|' \
/app/Immunolyser/app/tools/netMHCpan-4.2/netMHCpan

# Clone MixMHCpred repository
RUN git clone https://github.com/GfellerLab/MixMHCpred.git /app/Immunolyser/app/tools/MixMHCpred && \
chmod +x /app/Immunolyser/app/tools/MixMHCpred/MixMHCpred

RUN wget https://github.com/GfellerLab/MixMHC2pred/releases/download/v2.0.2.2/MixMHC2pred-2.0.zip -P /app/Immunolyser/app/tools && \
unzip -o /app/Immunolyser/app/tools/MixMHC2pred-2.0.zip -d /app/Immunolyser/app/tools/MixMHC2pred-2.0 && \
rm /app/Immunolyser/app/tools/MixMHC2pred-2.0.zip

# Download Alleles_list_Mouse.txt and put it in PWMdef directory
RUN wget http://ec2-18-188-210-66.us-east-2.compute.amazonaws.com:4000/data/Alleles_lists/Alleles_list_Mouse.txt -P /app/Immunolyser/app/tools/MixMHC2pred-2.0/PWMdef

# Clone MHC-TP and switch to netmhcpan-data-update-2025 branch
RUN git clone https://github.com/PurcellLab/MHC-TP.git /app/Immunolyser/app/tools/HLA-PepClust && \
cd /app/Immunolyser/app/tools/HLA-PepClust && \
git fetch origin netmhcpan-data-update-2025 && \
git checkout netmhcpan-data-update-2025

# Set up Python 3.11 virtual environment and install the package
RUN cd /app/Immunolyser/app/tools/HLA-PepClust && \
python3 -m venv hlapepclust-env && \
/bin/bash -c "source hlapepclust-env/bin/activate && pip install -e . && deactivate"

# Download the large ref_data zip file and unzip it
RUN mkdir -p /app/Immunolyser/app/tools/HLA-PepClust/data/ref_data && \
cd /app/Immunolyser/app/tools/HLA-PepClust/data/ref_data && \
python3 -m gdown 'https://drive.google.com/uc?id=1iAAvir1woMOnURkP46zr_ETqpW2oUgGD' && \
unzip Gibbs_motifs_human.zip && \
rm Gibbs_motifs_human.zip

# Install mhcflurry
RUN pip install mhcflurry

# Fetch mhcflurry downloads
RUN mhcflurry-downloads fetch

# Create a virtual environment for Python 3
RUN python3 -m venv lenv

# Install dependencies for Python 2 and Python 3
RUN /bin/bash -c "source lenv/bin/activate && \
pip install -r requirements_python2.txt && \
pip install -r requirements_python3.txt"

# Install Celery, sqlacheny
RUN /bin/bash -c "pip install celery"
RUN /bin/bash -c "pip install SQLAlchemy==2.0.31"

# Run the hotfix script
RUN /bin/bash -c "python hotfix_package_files.py"

# Download and extract Python 2.7.18
RUN wget https://www.python.org/ftp/python/2.7.18/Python-2.7.18.tgz && \
tar xvf Python-2.7.18.tgz

# Build and install Python 2.7.18
WORKDIR /app/Immunolyser/Python-2.7.18
RUN ./configure && \
make && \
make install

# Install pip for Python 2.7
RUN wget https://bootstrap.pypa.io/pip/2.7/get-pip.py && \
python2 get-pip.py

# Install numpy for Python 2.7
RUN python2 -m pip install numpy

# Change to the repository directory
WORKDIR /app/Immunolyser

# Expose Flask and Celery ports
EXPOSE 5000
EXPOSE 5555

# Set a default environment variable for IMMUNOLYSER_DATA
ENV IMMUNOLYSER_DATA=/data

# Copy entrypoint script
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

# Set the entrypoint script
ENTRYPOINT ["/entrypoint.sh"]
168 changes: 168 additions & 0 deletions PROD_DEPLOYMENT.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
#!/bin/bash
# Immunolyser Production Deployment — security/hardening branch
# Run this on the new prod VM after:
# 1. New 200GB volume created + attached at /dev/vdb
# 2. Ubuntu 22.04 LTS fresh install
# 3. SSH key configured

set -e

echo "=== Step 1: System Dependencies ==="
sudo apt update && sudo apt install -y \
python3-pip python3-venv redis-server \
build-essential wget git sqlite3 \
r-base tcsh ncompress unzip perl \
python2 fonts-urw-base35 gsfonts

# Python2 pip + deps
python2 -m ensurepip
python2 -m pip install numpy matplotlib

echo "=== Step 2: Clone Repo ==="
sudo mkdir -p /var/www/Immunolyser
sudo chown ubuntu:ubuntu /var/www/Immunolyser
git clone -b security/hardening https://github.com/PurcellLab/Immunolyser.git /var/www/Immunolyser

echo "=== Step 3: Install Bioinformatics Tools ==="
cd /var/www/Immunolyser/app/tools

# seq2logo + gibbscluster
tar -xzf seq2logo-2.1.all.tar.gz
tar -xzf gibbscluster-2.0f.Linux.tar.gz

# netMHCpan-4.2 (you must have downloaded this from DTU)
tar -xzf netMHCpan-4.2c.Linux.tar.gz
mkdir -p netMHCpan-4.2/tmp
chmod +x netMHCpan-4.2/netMHCpan
# EDIT: replace setenv NMHOME paths in netMHCpan script:
sed -i 's|setenv NMHOME.*|setenv NMHOME /var/www/Immunolyser/app/tools/netMHCpan-4.2|g' netMHCpan-4.2/netMHCpan

# netMHCIIpan-4.3 (you must have downloaded this from DTU)
tar -xzf netMHCIIpan-4.3j.Linux.tar.gz
mkdir -p netMHCIIpan-4.3/tmp
chmod +x netMHCIIpan-4.3/netMHCIIpan
sed -i 's|setenv NMHOME.*|setenv NMHOME /var/www/Immunolyser/app/tools/netMHCIIpan-4.3|g' netMHCIIpan-4.3/netMHCIIpan

# MixMHCpred
wget https://github.com/GfellerLab/MixMHCpred/archive/refs/tags/v3.0.tar.gz -O MixMHCpred.tar.gz
tar -xzf MixMHCpred.tar.gz
mv MixMHCpred-3.0 MixMHCpred
chmod +x MixMHCpred/MixMHCpred

# MixMHC2pred
wget https://github.com/GfellerLab/MixMHC2pred/archive/refs/tags/v2.0.2.2.tar.gz -O MixMHC2pred.tar.gz
tar -xzf MixMHC2pred.tar.gz
mv MixMHC2pred-2.0.2.2 MixMHC2pred-2.0
chmod +x MixMHC2pred-2.0/MixMHC2pred_unix

# Ghostscript 9.53.3 (not 9.55.0 — font bug)
wget https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs9533/ghostscript-9.53.3-linux-x86_64.tgz
tar -xzf ghostscript-9.53.3-linux-x86_64.tgz
chmod +x ghostscript-9.53.3-linux-x86_64/gs-9533-linux-x86_64
# Point seq2logo to it:
sed -i "s|gsPath='gs'|gsPath='/var/www/Immunolyser/app/tools/ghostscript-9.53.3-linux-x86_64/gs-9533-linux-x86_64'|" \
/var/www/Immunolyser/app/tools/seq2logo-2.1/Seq2Logo.py

# HLA-PepClust (MUST clone as HLA-PepClust — hardcoded in code)
git clone https://github.com/PurcellLab/MHC-TP.git HLA-PepClust
cd HLA-PepClust
git fetch origin netmhcpan-data-update-2025
git checkout netmhcpan-data-update-2025
# Fix scipy version pin bug
sed -i 's/scipy==1.16.1/scipy>=1.13/' setup.py
# Create venv + install
python3 -m venv hlapepclust-env
source hlapepclust-env/bin/activate
pip install -e .
deactivate
# Download ref_data
python3 -m pip install gdown
mkdir -p data/ref_data
cd data/ref_data
python3 -m gdown 'https://drive.google.com/uc?id=1iAAvir1woMOnURkP46zr_ETqpW2oUgGD'
unzip Gibbs_motifs_human.zip
rm Gibbs_motifs_human.zip

echo "=== Step 4: Python Virtualenv + Dependencies ==="
cd /var/www/Immunolyser
python3 -m venv lenv
source lenv/bin/activate
pip install -r requirements_python3.txt
pip install mhcflurry
mhcflurry-downloads fetch # ~2GB, takes 10-15 min

echo "=== Step 5: Mount Data Volume ==="
sudo mkdir -p /pvol
sudo mount /dev/vdb /pvol
sudo chown ubuntu:ubuntu /pvol
# Add to fstab for persistence:
echo "/dev/vdb /pvol ext4 defaults,nofail 0 2" | sudo tee -a /etc/fstab

echo "=== Step 6: Create Symlink for Job Output ==="
ln -s /pvol /var/www/Immunolyser/app/static/images

echo "=== Step 7: Environment File ==="
cd /var/www/Immunolyser
cp .env.example .env
# EDIT .env with your values:
# SECRET_KEY=$(python3 -c "import secrets; print(secrets.token_hex(32))")
# IMMUNOLYSER_DATA=/pvol
# IS_DOCKER=false
# DEBUG=False
# EMAIL_ADDRESS=noreply@immunolyser.erc.monash.edu
# BASE_URL=https://immunolyser.erc.monash.edu
# DEMO_TASK_ID=<uuid from demo job, or leave empty>
# DATA_RETENTION_DAYS=30

echo "!!! PAUSE: Edit .env manually with SECRET_KEY and other values !!!"
nano .env

echo "=== Step 8: Initialize Database ==="
source lenv/bin/activate
python3 -c "from app.job_registry import init_job_registry; from app.email_registry import init_email_registry; init_job_registry(); init_email_registry(); print('DB initialised')"
deactivate

echo "=== Step 9: Systemd Services ==="

# Flask app service
sudo tee /etc/systemd/system/immunolyser.service > /dev/null <<EOF
[Unit]
Description=Immunolyser Flask App
After=network.target redis.service

[Service]
User=ubuntu
WorkingDirectory=/var/www/Immunolyser
EnvironmentFile=/var/www/Immunolyser/.env
ExecStart=/var/www/Immunolyser/lenv/bin/gunicorn --workers 2 --bind 0.0.0.0:5000 --timeout 120 firstdemo:app
Restart=always

[Install]
WantedBy=multi-user.target
EOF

# Celery worker service
sudo tee /etc/systemd/system/immunolyser-celery.service > /dev/null <<EOF
[Unit]
Description=Immunolyser Celery Worker
After=network.target redis.service

[Service]
User=ubuntu
WorkingDirectory=/var/www/Immunolyser
EnvironmentFile=/var/www/Immunolyser/.env
ExecStart=/var/www/Immunolyser/lenv/bin/celery -A app.celery worker --loglevel=info --concurrency=1
Restart=always

[Install]
WantedBy=multi-user.target
EOF

sudo systemctl daemon-reload
sudo systemctl enable immunolyser immunolyser-celery
sudo systemctl start immunolyser immunolyser-celery

echo "=== Deployment Complete ==="
echo "Flask app: http://<prod-ip>:5000"
echo "Check status: sudo systemctl status immunolyser immunolyser-celery"
echo "Logs: sudo journalctl -u immunolyser -f"
Loading