Skip to content
Open
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
24 changes: 24 additions & 0 deletions .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Build HLA-LA Docker image

on:
workflow_dispatch:
inputs:
image-tag:
description: "Docker image tag, If omitted will use github short sha"
required: false
type: string

permissions:
id-token: write # Required for assuming an AWS role
contents: read # Required for actions/checkout

jobs:
build:
uses: Ultimagen/ugbio-utils/.github/workflows/docker-build-push.yml@main
secrets: inherit
with:
git-repo: ${{ github.repository }}
git-ref: ${{ github.ref_name }}
docker-image: hla_la
docker-tag: ${{ inputs.image-tag }}
base-branch: ug-master
19 changes: 19 additions & 0 deletions .github/workflows/trivy-scan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Trivy scan
on:
push:
branches:
- ug-master
pull_request:
jobs:
trivy-scan-fs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: aquasecurity/trivy-action@0.32.0
with:
scan-type: 'fs'
scan-ref: './'
format: 'table'
exit-code: '1'
severity: 'CRITICAL,HIGH'
89 changes: 89 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# work from latest LTS ubuntu release
FROM ubuntu:22.04

# set the environment variables
ENV hla_la_version=1.0.4 \
samtools_version=1.21 \
bwa_version=0.7.19 \
picard_version=2.25.7 \
bamtools_version=2.5.2

# install required system packages
RUN apt-get update -y && apt-get install --no-install-recommends -y \
build-essential \
curl \
unzip \
zlib1g-dev \
libncurses5-dev \
libncursesw5-dev \
libnss-sss \
libbz2-dev \
liblzma-dev \
vim \
less \
libcurl4-openssl-dev \
wget \
libz-dev \
openjdk-11-jre \
libboost-all-dev \
cmake \
libjsoncpp-dev \
&& apt-get clean && rm -rf /var/lib/apt/lists/*

# install samtools
WORKDIR /usr/local/bin
RUN wget https://github.com/samtools/samtools/releases/download/${samtools_version}/samtools-${samtools_version}.tar.bz2 \
&& tar -xjf samtools-${samtools_version}.tar.bz2 \
&& cd samtools-${samtools_version} \
&& ./configure \
&& make \
&& make install

# install picard
RUN mkdir -p /usr/local/bin/picard && \
wget -O /usr/local/bin/picard/picard.jar https://github.com/broadinstitute/picard/releases/download/${picard_version}/picard.jar && \
chmod 0644 /usr/local/bin/picard/picard.jar && \
echo '#!/bin/bash\nexec java -jar /usr/local/bin/picard/picard.jar "$@"' > /usr/local/bin/run-picard && \
chmod +x /usr/local/bin/run-picard

# install bwa
RUN curl -SL https://github.com/lh3/bwa/archive/v${bwa_version}.zip -o v${bwa_version}.zip \
&& unzip v${bwa_version}.zip \
&& cd bwa-${bwa_version} \
&& make \
&& ln -s /usr/local/bin/bwa-${bwa_version}/bwa /usr/local/bin/bwa

# install bamtools
RUN wget https://github.com/pezmaster31/bamtools/archive/v${bamtools_version}.zip \
&& unzip v${bamtools_version}.zip \
&& mkdir -p bamtools-${bamtools_version}/build \
&& cd bamtools-${bamtools_version}/build \
&& cmake -DCMAKE_INSTALL_PREFIX=/usr/local/bin/bamtools-${bamtools_version} .. \
&& make \
&& make install


RUN mkdir -p /usr/local/bin/HLA-LA/bin \
/usr/local/bin/HLA-LA/src \
/usr/local/bin/HLA-LA/obj \
/usr/local/bin/HLA-LA/temp \
/usr/local/bin/HLA-LA/working \
/usr/local/bin/HLA-LA/graphs
COPY . /usr/local/bin/HLA-LA/src/
RUN sed -i 's@\$(BAMTOOLS_PATH)/lib64@\$(BAMTOOLS_PATH)/lib@' /usr/local/bin/HLA-LA/src/makefile \
&& make -C /usr/local/bin/HLA-LA/src all BOOST_PATH=/usr/include/boost BAMTOOLS_PATH=/usr/local/bin/bamtools-${bamtools_version}

# modify paths.ini for hla-la
RUN sed -i 's@samtools_bin=@samtools_bin=/usr/local/bin/samtools@' /usr/local/bin/HLA-LA/src/paths.ini \
&& sed -i 's@bwa_bin=@bwa_bin=/usr/local/bin/bwa@' /usr/local/bin/HLA-LA/src/paths.ini \
&& sed -i 's@picard_sam2fastq_bin=.*@picard_sam2fastq_bin=/usr/local/bin/picard/picard.jar@' /usr/local/bin/HLA-LA/src/paths.ini

# set PATH
ENV PATH="/usr/local/bin/HLA-LA/bin:/usr/local/bin/HLA-LA/src:$PATH"

RUN groupadd app && useradd -m app -g app
RUN chown -R app:app /opt /usr/local/bin

USER app

WORKDIR /home/app
2 changes: 1 addition & 1 deletion HLA-LA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,7 @@ int main(int argc, char *argv[]) {
assert(arguments.count("longReads"));

longReads = arguments.at("longReads");
assert((longReads == "0") || (longReads == "ont2d") || (longReads == "pacbio"));
assert((longReads == "0") || (longReads == "ont2d") || (longReads == "pacbio") || (longReads == "ultimagen"));
if(longReads == "0")
{
longReads = "";
Expand Down
4 changes: 2 additions & 2 deletions HLA-LA.pl
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@
die unless(-e '../exonkMerExtraction/exonCoordinates_manual.txt.forExtraction');
}

unless((not $longReads) or ($longReads eq 'ont2d') or ($longReads eq 'pacbio'))
unless((not $longReads) or ($longReads eq 'ont2d') or ($longReads eq 'pacbio') or ($longReads eq 'ultimagen'))
{
die "Please specify --longReads ont2d or --longReads pacbio";
die "Please specify --longReads ont2d or --longReads pacbio or --longReads ultimagen";
}

my %paths_ini;
Expand Down
6 changes: 5 additions & 1 deletion HLAtypeinference_validation.pl
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,11 @@
if($reference_lookup_ID =~ /_Nanopore/i)
{
$reference_lookup_ID =~ s/_Nanopore//i;
}
}
if($reference_lookup_ID =~ /_Ultimagen/i)
{
$reference_lookup_ID =~ s/_Ultimagen//i;
}
unless(exists $reference_data{$reference_lookup_ID})
{
$missing_reference_data{$reference_lookup_ID}{$locus}++;
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ f you work with CRAM files and receive error messages like `Unable to fetch refe

### Long reads

If you want to carry out genotyping from a long-reads BAM, please specify the parameter `--longReads ont2d` (for Oxford Nanopore reads) or `--longReads pacbio` (for PacBio reads). Of note, typing will still be carried out at G group resolution. This feature is experimental; accuracy may not match short-read-based typing.
If you want to carry out genotyping from a long-reads BAM, please specify the parameter `--longReads ont2d` (for Oxford Nanopore reads) or `--longReads pacbio` (for PacBio reads) or `--longReads ultimagen` (for Ultima Genomics reads which are not long reads, but unpaired reads). Of note, typing will still be carried out at G group resolution. This feature is experimental; accuracy may not match short-read-based typing.

### Assembly typing

Expand Down
2 changes: 1 addition & 1 deletion hla/HLATyper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1029,7 +1029,7 @@ void HLATyper::HLATypeInference(const std::vector<mapper::reads::oneReadPair>& r

// read alignment statistics

int minAlignmentLength_unpaired = 1000;
int minAlignmentLength_unpaired = (longReadsMode == "ultimagen") ? 50 : 1000;
int alignmentStats_strandsValid = 0;
int alignments_paired_perfect = 0;
int alignments_paired_oneReadPerfect = 0;
Expand Down
4 changes: 2 additions & 2 deletions mapper/bwa/BWAmapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ void BWAmapper::mapUnpaired(std::string indexedReferenceGenome, std::string FAST

void BWAmapper::mapLong(std::string indexedReferenceGenome, std::string FASTQ, std::string outputBAM, bool withA, std::string longMode)
{
assert((longMode == "pacbio") || (longMode == "ont2d"));
assert((longMode == "pacbio") || (longMode == "ont2d") || (longMode == "ultimagen"));

assert(Utilities::fileExists(bwa_bin));
assert(Utilities::fileExists(samtools_bin));
Expand All @@ -150,7 +150,7 @@ void BWAmapper::mapLong(std::string indexedReferenceGenome, std::string FASTQ, s
assert(threads_minus_1 >= 0);

//std::string bwa_mapping_cmd = bwa_bin + " mem " + indexedReferenceGenome + " " + FASTQ1 + " " + FASTQ2 + " > " + outputSAM;
std::string bwa_mapping_cmd = bwa_bin + " mem -t" + Utilities::ItoStr(threads) + " -x " + longMode + " -M " + with_a + indexedReferenceGenome + " " + FASTQ + " | " + samtools_bin + " view -@ " + Utilities::ItoStr(threads_minus_1) + " -Sb - > " + outputUnsorted;
std::string bwa_mapping_cmd = bwa_bin + " mem -t" + Utilities::ItoStr(threads) + " -x " + ((longMode =="ultimagen")? "ont2d" : longMode)+ " -M " + with_a + indexedReferenceGenome + " " + FASTQ + " | " + samtools_bin + " view -@ " + Utilities::ItoStr(threads_minus_1) + " -Sb - > " + outputUnsorted;
std::cerr << bwa_mapping_cmd << "\n" << std::flush;
int retCode = std::system(bwa_mapping_cmd.c_str());
if(retCode != 0)
Expand Down