Skip to content

Commit 09888b7

Browse files
committed
Merge remote-tracking branch 'origin' into gbanco4-manntype-ags
2 parents 0366215 + ecad87b commit 09888b7

36 files changed

Lines changed: 858 additions & 35 deletions

annotate_bcr/1.0/annotate_glycosylation.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,11 @@ def number_with_imgt(aa_seq):
9595
Align aa_seq to IG/TCR germline HMMs with ANARCI using the IMGT scheme.
9696
Returns [(pos_tuple, aa), ...] with gap positions removed, or None on failure.
9797
"""
98-
results, _, _ = anarci([("seq", aa_seq)], scheme="imgt", output=False)
98+
try:
99+
results, _, _ = anarci([("seq", aa_seq)], scheme="imgt", output=False)
100+
except Exception as exc:
101+
print(f"WARNING: ANARCI failed for sequence (len={len(aa_seq)}): {exc}", file=sys.stderr)
102+
return None
99103
if results[0] is None:
100104
return None
101105
return [(pos, aa) for pos, aa in results[0][0][0] if aa != "-"]
@@ -143,7 +147,10 @@ def _make_lookup_fn(seq_lookup):
143147
if len(lengths) == 1:
144148
trunc = next(iter(lengths))
145149
def _lookup(seq_id, _d=seq_lookup, _t=trunc):
146-
return _d.get(seq_id) or _d.get(seq_id[:_t])
150+
hit = _d.get(seq_id)
151+
if hit is None and len(seq_id) > _t:
152+
hit = _d.get(seq_id[:_t])
153+
return hit
147154
return _lookup
148155
return seq_lookup.get
149156

annotate_bcr/1.0/merge_annotation_tsv.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,15 +202,35 @@ def main():
202202
)
203203
all_annot_cols = [c for c in reader.fieldnames if c != args.annot_key]
204204
for row in reader:
205-
annot[key_fn(row[args.annot_key])] = {c: row[c] for c in all_annot_cols}
205+
k = key_fn(row[args.annot_key])
206+
if k in annot:
207+
print(
208+
f"WARNING: duplicate key '{k}' in {args.annotation}; later entry overwrites earlier.",
209+
file=sys.stderr,
210+
)
211+
annot[k] = {c: row[c] for c in all_annot_cols}
206212

207213
with open(args.base) as fh_in, open(args.output, "w", newline="") as fh_out:
208214
reader = csv.DictReader(fh_in, delimiter="\t")
209215

216+
if args.base_key not in reader.fieldnames:
217+
sys.exit(
218+
f"ERROR: --base_key '{args.base_key}' not found in {args.base}.\n"
219+
f" Available columns: {', '.join(reader.fieldnames)}\n"
220+
f" Check options.base_id_column in your module config."
221+
)
222+
210223
# Only add annotation columns not already present in the base, preventing
211224
# duplicate column names (e.g. 'sequence' exists in both igseqr source_tsv
212225
# and AIRR output).
213226
base_col_set = set(reader.fieldnames)
227+
dropped_cols = [c for c in all_annot_cols if c in base_col_set]
228+
if dropped_cols:
229+
print(
230+
f"WARNING: annotation column(s) already present in base and will be skipped: "
231+
f"{', '.join(dropped_cols)}",
232+
file=sys.stderr,
233+
)
214234
annot_cols = [c for c in all_annot_cols if c not in base_col_set]
215235

216236
raw_header = list(reader.fieldnames) + annot_cols

cnaqc/1.0/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ RUN mamba install --yes --name base \
4242
openssl \
4343
libxml2 \
4444
libgit2 \
45+
jq \
4546
&& rm -rf /opt/conda/pkgs/*
4647

4748
RUN R --vanilla -q -e 'remotes::install_github("caravagnalab/CNAqc", lib="/opt/conda/lib/R/library", dependencies = TRUE, upgrade = "never")'

cnv2igv/1.4/tests/input/DLBCL10538T_dnacopy.seg

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,9 @@ DLBCL10538T 21 44813890 46664442 367 -0.0761210585165859 2
8585
DLBCL10538T 22 12620785 17549552 124 -0.0761210585165859 2
8686
DLBCL10538T 22 17550296 17740257 38 -0.653178651685393 0
8787
DLBCL10538T 22 17743861 50780765 4700 -0.121855730441879 2
88+
DLBCL10538T 23 12620785 17549552 124 -0.0761210585165859 2
89+
DLBCL10538T 23 17550296 17740257 38 -0.653178651685393 0
90+
DLBCL10538T 23 17743861 50780765 4700 -0.121855730441879 2
91+
DLBCL10538T 24 12620785 17549552 124 -0.0761210585165859 2
92+
DLBCL10538T 24 17550296 17740257 38 -0.653178651685393 0
93+
DLBCL10538T 24 17743861 50780765 4700 -0.121855730441879 2

cnv2igv/1.5/cnv2igv.py

Lines changed: 41 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,32 @@ def __init__(self, stream, sample, mode, loh_type, logr_type):
8282
super().__init__(stream, sample, mode, loh_type, logr_type)
8383

8484
def is_header(self, line):
85-
toks = line.rstrip('\n').split('\t')
86-
# expect header like: ID chromosome start end ...
87-
return len(toks) > 1 and (toks[0].lower() in ('id', 'sample')
88-
or toks[1].lower().startswith('chrom'))
85+
# expect header: ID chrom loc.start loc.end num.mark seg.mean C
86+
line_sample = line.split('\t', 1)[0]
87+
if line_sample.startswith('"'):
88+
line_sample = line_sample[1:]
89+
if line_sample.endswith('"'):
90+
line_sample = line_sample[0:-1]
91+
if line_sample == "ID":
92+
return True
93+
else:
94+
return False
8995

9096
def parse_segment(self, line, logr_type, mode):
9197
t = line.rstrip('\n').split('\t')
9298
line_sample, chrm, start, end = t[0:4]
99+
100+
# PureCN enumerates chroms - change them back to X and Y
101+
chrm = str(chrm)
102+
if chrm == "chr23":
103+
chrm = "chrX"
104+
elif chrm == "23":
105+
chrm = "X"
106+
elif chrm == "chr24":
107+
chrm = "chrY"
108+
elif chrm == "24":
109+
chrm = "Y"
110+
93111
cn = t[6]
94112
logr = self.calculate_logratio(cn) if logr_type == "corrected" else t[5]
95113
sample_id = self.resolve_sample(line_sample)
@@ -99,8 +117,14 @@ class CNVKitParser(Parser):
99117
def __init__(self, stream, sample, mode, loh_type, logr_type):
100118
super().__init__(stream, sample, mode, loh_type, logr_type)
101119

120+
# Expected columns can change based on whether allele-specific
121+
# copy numbers could be inferred from the VCF
122+
# if yes:
123+
# chromosome start end gene log2 baf cn cn1 cn2 depth probes weight
124+
# if no:
125+
# chromosome start end gene log2 cn depth probes weight
126+
102127
def is_header(self, line):
103-
# expect header like: chromosome, start, end, gene, log2, baf, cn, ...
104128
chrm = line.split('\t', 1)[0]
105129
if chrm.startswith('"'):
106130
chrm = chrm[1:]
@@ -118,11 +142,18 @@ def parse_segment(self, line, logr_type, mode):
118142
chrm = chrm[1:]
119143
if chrm.endswith('"'):
120144
chrm = chrm[0:-1]
121-
cn = _line[6]
122-
cn1 = None if _line[7] == '' else _line[7]
123-
cn2 = None if _line[8] == '' else _line[8]
124-
loh_flag = self.get_loh_flag(cn, cn1, cn2)
125-
logr = self.calculate_logratio(cn) if logr_type == "corrected" else _line[4]
145+
if len(_line) == 12:
146+
cn = _line[6]
147+
cn1 = None if _line[7] == '' else _line[7]
148+
cn2 = None if _line[8] == '' else _line[8]
149+
loh_flag = self.get_loh_flag(cn, cn1, cn2)
150+
logr = self.calculate_logratio(cn) if logr_type == "corrected" else _line[4]
151+
else:
152+
cn = _line[5]
153+
cn1 = None
154+
cn2 = None
155+
loh_flag = self.get_loh_flag(cn, cn1, cn2)
156+
logr = self.calculate_logratio(cn) if logr_type == "corrected" else _line[4]
126157
return(Segment(chrm, start, end, cn, logr, self.sample, mode, loh_flag))
127158

128159
def get_loh_flag(self, cn, cn1, cn2):

cnv2igv/1.5/tests/output/DLBCL10538T_dnacopy.preserved.seg

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,9 @@ DLBCL10538T 21 44813890 46664442 purecn NA 2 -0.0761210585165859
8585
DLBCL10538T 22 12620785 17549552 purecn NA 2 -0.0761210585165859
8686
DLBCL10538T 22 17550296 17740257 purecn NA 0 -0.653178651685393
8787
DLBCL10538T 22 17743861 50780765 purecn NA 2 -0.121855730441879
88+
DLBCL10538T X 12620785 17549552 purecn NA 2 -0.0761210585165859
89+
DLBCL10538T X 17550296 17740257 purecn NA 0 -0.653178651685393
90+
DLBCL10538T X 17743861 50780765 purecn NA 2 -0.121855730441879
91+
DLBCL10538T Y 12620785 17549552 purecn NA 2 -0.0761210585165859
92+
DLBCL10538T Y 17550296 17740257 purecn NA 0 -0.653178651685393
93+
DLBCL10538T Y 17743861 50780765 purecn NA 2 -0.121855730441879

cnv2igv/1.5/tests/output/DLBCL10538T_dnacopy.seg

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,9 @@ DLBCL10538T 21 44813890 46664442 purecn NA 2 0.0
8585
DLBCL10538T 22 12620785 17549552 purecn NA 2 0.0
8686
DLBCL10538T 22 17550296 17740257 purecn NA 0 -10
8787
DLBCL10538T 22 17743861 50780765 purecn NA 2 0.0
88+
DLBCL10538T X 12620785 17549552 purecn NA 2 0.0
89+
DLBCL10538T X 17550296 17740257 purecn NA 0 -10
90+
DLBCL10538T X 17743861 50780765 purecn NA 2 0.0
91+
DLBCL10538T Y 12620785 17549552 purecn NA 2 0.0
92+
DLBCL10538T Y 17550296 17740257 purecn NA 0 -10
93+
DLBCL10538T Y 17743861 50780765 purecn NA 2 0.0

drivemutr/1.0/Dockerfile

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
FROM mambaorg/micromamba:2.8.1
2+
3+
LABEL org.opencontainers.image.source="https://github.com/LCR-BCCRC/lcr-scripts"
4+
5+
ENV LC_ALL=C.UTF-8
6+
ENV LANG=C.UTF-8
7+
8+
RUN micromamba install --yes --name base \
9+
--channel conda-forge \
10+
--channel bioconda \
11+
--strict-channel-priority \
12+
r-base=4.4 \
13+
r-tidyverse \
14+
r-broom \
15+
r-ggbeeswarm \
16+
r-iml \
17+
r-pre \
18+
r-remotes \
19+
r-rlang \
20+
r-biocmanager \
21+
r-devtools \
22+
r-dt \
23+
bioconductor-variantannotation \
24+
bioconductor-motifstack \
25+
bioconductor-gviz \
26+
bioconductor-biocparallel=1.40.0 \
27+
bioconductor-biostrings=2.74.0 \
28+
bioconductor-bsgenome.hsapiens.ucsc.hg19=1.4.3 \
29+
bioconductor-genomicranges \
30+
bioconductor-iranges \
31+
bioconductor-motifdb \
32+
bioconductor-rtracklayer \
33+
git \
34+
jq \
35+
make \
36+
c-compiler \
37+
cxx-compiler \
38+
fortran-compiler \
39+
pkg-config \
40+
&& micromamba clean --all --yes
41+
42+
RUN micromamba run --name base R --vanilla -q -e 'devtools::install_github( \
43+
"Simon-Coetzee/motifBreakR", \
44+
dependencies = NA, \
45+
upgrade = "never" \
46+
)'
47+
48+
RUN micromamba run --name base R --vanilla -q -e 'options(timeout = 3600); devtools::install_github( \
49+
"morinlab/GAMBLR.data", \
50+
dependencies = FALSE, \
51+
upgrade = "never" \
52+
)'
53+
54+
CMD ["/bin/bash"]

drivemutr/1.0/run_tests.sh

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/usr/bin/env bash
2+
# Smoke tests for the DriveMuTR container.
3+
# Verifies that all required tools and R packages are present and loadable.
4+
# Usage: ./run_tests.sh
5+
6+
PASS=true
7+
8+
check() {
9+
local desc="$1"
10+
local cmd="$2"
11+
local output
12+
output=$(eval "$cmd" 2>&1)
13+
if [ $? -eq 0 ]; then
14+
echo "PASS: $desc"
15+
else
16+
echo "FAIL: $desc"
17+
echo "$output" | sed 's/^/ /'
18+
PASS=false
19+
fi
20+
}
21+
22+
check "Rscript is available" "command -v Rscript"
23+
check "R package dplyr loads" "Rscript --vanilla -e 'library(dplyr)'"
24+
check "R package tidyr loads" "Rscript --vanilla -e 'library(tidyr)'"
25+
check "R package tibble loads" "Rscript --vanilla -e 'library(tibble)'"
26+
check "R package purrr loads" "Rscript --vanilla -e 'library(purrr)'"
27+
check "R package readr loads" "Rscript --vanilla -e 'library(readr)'"
28+
check "R package stringr loads" "Rscript --vanilla -e 'library(stringr)'"
29+
check "R package ggplot2 loads" "Rscript --vanilla -e 'library(ggplot2)'"
30+
check "R package rlang loads" "Rscript --vanilla -e 'library(rlang)'"
31+
check "R package broom loads" "Rscript --vanilla -e 'library(broom)'"
32+
check "R package ggbeeswarm loads" "Rscript --vanilla -e 'library(ggbeeswarm)'"
33+
check "R package iml loads" "Rscript --vanilla -e 'library(iml)'"
34+
check "R package pre loads" "Rscript --vanilla -e 'library(pre)'"
35+
check "R package BiocParallel loads" "Rscript --vanilla -e 'library(BiocParallel)'"
36+
check "R package Biostrings loads" "Rscript --vanilla -e 'library(Biostrings)'"
37+
check "R package GenomicRanges loads" "Rscript --vanilla -e 'library(GenomicRanges)'"
38+
check "R package IRanges loads" "Rscript --vanilla -e 'library(IRanges)'"
39+
check "R package rtracklayer loads" "Rscript --vanilla -e 'library(rtracklayer)'"
40+
check "R package MotifDb loads" "Rscript --vanilla -e 'library(MotifDb)'"
41+
check "R package motifbreakR loads" "Rscript --vanilla -e 'library(motifbreakR)'"
42+
check "R package BSgenome.Hsapiens.UCSC.hg19 loads" "Rscript --vanilla -e 'library(BSgenome.Hsapiens.UCSC.hg19)'"
43+
check "R package GAMBLR.data loads" "Rscript --vanilla -e 'library(GAMBLR.data)'"
44+
45+
$PASS

igseqr/1.0.1/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ RUN mamba create --yes --name env \
1010
"samtools=1.16.1" \
1111
"trinity=2.13.2" \
1212
"git" \
13+
"jq" \
1314
&& mamba clean --all --yes \
1415
&& /opt/conda/envs/env/bin/git clone --branch v1.0.1 --depth 1 \
1516
https://github.com/ForconiLab/IgSeqR.git /tmp/IgSeqR \

0 commit comments

Comments
 (0)