liulab-dfci / TRUST4

TCR and BCR assembly from RNA-seq data
MIT License
272 stars 47 forks source link

error running TRUST4 (failed: 11 at /usr/local/bin/run-trust4 line 49) #178

Closed HugoMananet closed 1 year ago

HugoMananet commented 1 year ago

Hi,

I get an error using TRUST4 v1.0.8 (i tried compiling from https://github.com/liulab-dfci/TRUST4/archive/refs/tags/v1.0.8.tar.gz and using the command from the README :git clone https://github.com/liulab-dfci/TRUST4.git). I also get it when i compile TRUST4 directly on the HPC environment that i'm working on.

I was also already using TRUST v1.0.2 compiled in a singularity container which is fully functionnal.

I have received new data containing UMIs so i wanted to update my container to the v1.0.8 since this version can work with UMI-based TCR-seq/BCR-seq data.

At first i tried copying the recipe from the v1.0.2 container that i have, updating only the version of TRUST4. I should had that when i run the trust command without any parameters, the help is displayed without any warnings or errors.

When i run the command on my data :


singularity run --cleanenv -B /directory/of/my/data/to/be/analyzed /work/shared/ptbc/tools/trust/v1.0.8/trust_v1.0.8.sif \
    -t 4 \
    -f /opt/TRUST4/hg19_bcrtcr.fa \
    --ref /opt/TRUST4/human_IMGT+C.fa \
    -u /directory/of/my/data/to/be/analyzed/sample_1/sample_1_R2_trimmed_after_cutpaired_end.fastq.gz \
    --barcode /directory/of/my/data/to/be/analyzed/sample_1/sample_1_umi.fastq.gz \
    --barcode-level molecule \
    -o /directory/of/my/data/to/be/analyzed/sample_1/sample_1/trust_results/sample_1

I still get this error at the launch of the command when using https://github.com/liulab-dfci/TRUST4/archive/refs/tags/v1.0.8.tar.gz :

# [Wed Jan 18 16:50:29 2023] TRUST4 begins.
# [Wed Jan 18 16:50:29 2023] SYSTEM CALL: /opt/TRUST4-1.0.8/fastq-extractor -t 4 -f /opt/TRUST4-1.0.8/hg19_bcrtcr.fa -o /work/shared/ptbc/Routine/RNAseq/projets/trust_tmb_tcr/A14-118-2/trust_results/A14-118-2_toassemble  -u /work/shared/ptbc/Routine/RNAseq/projets/trust_tmb_tcr/A14-118-2/A14-118-2_R2_trimmed_after_cutpaired_end.fastq --barcode /work/shared/ptbc/Routine/RNAseq/projets/trust_tmb_tcr/A14-118-2/A14-118-2_R1_trimmed_26pb.fastq
# [Wed Jan 18 16:50:29 2023] Start to extract candidate reads from read files.
# system /opt/TRUST4-1.0.8/fastq-extractor -t 4 -f /opt/TRUST4-1.0.8/hg19_bcrtcr.fa -o /work/shared/ptbc/Routine/RNAseq/projets/trust_tmb_tcr/A14-118-2/trust_results/A14-118-2_toassemble  -u /work/shared/ptbc/Routine/RNAseq/projets/trust_tmb_tcr/A14-118-2/A14-118-2_R2_trimmed_after_cutpaired_end.fastq --barcode /work/shared/ptbc/Routine/RNAseq/projets/trust_tmb_tcr/A14-118-2/A14-118-2_R1_trimmed_26pb.fastq failed: 11 at /usr/local/bin/run-trust4 line 49.

and this error when using git clone https://github.com/liulab-dfci/TRUST4.git :

# [Thu Jan 19 09:39:12 2023] TRUST4 begins.
# [Thu Jan 19 09:39:12 2023] SYSTEM CALL: /opt/TRUST4/fastq-extractor -t 4 -f /opt/TRUST4/hg19_bcrtcr.fa -o /work/shared/ptbc/Routine/RNAseq/projets/trust_tmb_tcr/A14-118-2/trust_results/A14-118-2_toassemble  -u /work/shared/ptbc/Routine/RNAseq/projets/trust_tmb_tcr/A14-118-2/A14-118-2_R2_trimmed_after_cutpaired_end.fastq
# [Thu Jan 19 09:39:12 2023] Start to extract candidate reads from read files.
# system /opt/TRUST4/fastq-extractor -t 4 -f /opt/TRUST4/hg19_bcrtcr.fa -o /work/shared/ptbc/Routine/RNAseq/projets/trust_tmb_tcr/A14-118-2/trust_results/A14-118-2_toassemble  -u /work/shared/ptbc/Routine/RNAseq/projets/trust_tmb_tcr/A14-118-2/A14-118-2_R2_trimmed_after_cutpaired_end.fastq failed: 11 at /usr/local/bin/run-trust4 line 51.

I tried going back to the Dockerfile example for the version 1.0.2 and tried the command with this container (with version 18.04, 20.04, 22.04 of ubuntu and centos7 which was the os used for the singularity image of v1.0.2):

#!/bin/bash

Bootstrap: docker

From: ubuntu:18.04

%labels

        MAINTAINER Hugo Mananet

%post

        mkdir /soft
        mkdir /work
        mkdir /user1
        mkdir /user2
        mkdir /tmp3

        ln -fs /usr/share/zoneinfo/Europe/Paris /etc/localtime
        DEBIAN_FRONTEND=noninteractive

        apt-get update -y && apt-get upgrade -y && \
        apt-get install -y build-essential \
                software-properties-common \
                make \
                wget \
                gcc \
                g++ \
                autoconf \
                automake \
                perl \
                bzip2 \
                zlibc \
                libcurl4-gnutls-dev \
                liblzma-dev \
                libbz2-dev \
                libssl-dev \
                libncurses5 \
                libncurses5-dev \
                libncursesw5 \
                libncursesw5-dev \
                zlib1g-dev \
                gzip \
                locales \
                git-all

 echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen && \
        locale-gen en_US.UTF-8 && \
        /usr/sbin/update-locale LANG=en_US.UTF-8

        cd /opt
        # wget https://github.com/liulab-dfci/TRUST4/archive/refs/tags/v1.0.8.tar.gz
        # tar -xvf v1.0.8.tar.gz
        git clone https://github.com/liulab-dfci/TRUST4.git
        cd TRUST4
        make
        ln -s /opt/TRUST4/run-trust4 /usr/local/bin/
        ln -s /opt/TRUST4/samtools-0.1.19/samtools /usr/local/bin/
        ln -s /opt/TRUST4/samtools-0.1.19/bcftools/bcftools /usr/local/bin/

%runscript

        exec run-trust4 "$@"

And I still have the same error. To be noted that i have already analyzed this data (from the deduped bams converted to fastq) with the TRUST4 v1.0.2 container.

I really don't know where i went wrong on this. Could you help me please ? Thanks in advance, Hugo

mourisl commented 1 year ago

Could you please compile and run TRUST4 without the container? TRUST4 has little dependency, so it should be easy to compile on your system. This is to understand whether the issue is from the container part or the TRUST4 part.

And can your new docker/singularity image work on the TRUST4 example file?

Thank you.

HugoMananet commented 1 year ago

Hi again,

Thanks for your fast response,

By retesting with TRUST4, compiled from https://github.com/liulab-dfci/TRUST4/archive/refs/tags/v1.0.8.tar.gz without the container, i get the error :

[Tue Jan 24 11:52:56 2023] TRUST4 begins.
[Tue Jan 24 11:52:56 2023] SYSTEM CALL: /opt/TRUST4/fastq-extractor -t 4 -f /opt/TRUST4/hg19_bcrtcr.fa -o /work/shared/ptbc/Routine/RNAseq/projets/trust_tmb_tcr/A14-118-2/trust_results/A14-118-2_toassemble  --barcodeStart 0 --barcodeEnd 26 -u /work/shared/ptbc/Routine/RNAseq/projets/trust_tmb_tcr/A14-118-2/A14-118-2_R2_trimmed_after_cutpaired_end.fastq --barcode /work/shared/ptbc/Routine/RNAseq/projets/trust_tmb_tcr/A14-118-2/A14-118-2_R1_trimmed_26pb.fastq
[Tue Jan 24 11:52:56 2023] Start to extract candidate reads from read files.
Read file and barcode file have different number of reads.
system /opt/TRUST4/fastq-extractor -t 4 -f /opt/TRUST4/hg19_bcrtcr.fa -o /work/shared/ptbc/Routine/RNAseq/projets/trust_tmb_tcr/A14-118-2/trust_results/A14-118-2_toassemble  --barcodeStart 0 --barcodeEnd 26 -u /work/shared/ptbc/Routine/RNAseq/projets/trust_tmb_tcr/A14-118-2/A14-118-2_R2_trimmed_after_cutpaired_end.fastq --barcode /work/shared/ptbc/Routine/RNAseq/projets/trust_tmb_tcr/A14-118-2/A14-118-2_R1_trimmed_26pb.fastq failed: 256 at /usr/local/bin/run-trust4 line 51.

So it was the difference in read number (which i thought were equal) between the R1 UMI fastq file and the R2 file containing the reads that produced this error.

It seems that the Read file and barcode file have different number of reads. error doesn't show with the development version (the one that i had in the container).

When i run TRUST4 with the correction (with or without the container), i get results...

singularity run --cleanenv -B /work/shared/ptbc /work/shared/ptbc/tools/trust/v1.0.8/trust_v1.0.8_from_scratch.sif \
    -t 4 \
    -f /opt/TRUST4/hg19_bcrtcr.fa \
    --ref /opt/TRUST4/human_IMGT+C.fa \
    --barcodeLevel molecule \
    --barcodeRange 0 26 + \ # the length of my UMI reads in R1 file
    -u /directory/of/my/data/to/be/analyzed/sample_1/sample_1_R2_trimmed_after_cutpaired_end.fastq.gz \# the file containing my data
    --barcode /directory/of/my/data/to/be/analyzed/sample_1/sample_1_R1_trimmed_26pb_after_cutpaired_end.fastq.gz \# the file containing the UMIs only
    --od /directory/of/my/data/to/be/analyzed/sample_1/trust_results \
    -o sample_1

Thanks for your help and your time. Hugo

mourisl commented 1 year ago

Is your barcode length 26bp? You may need to change the --barcodeRange argument to "0 25 +" because the argument is 0-indexed inclusive range. Though I don't think it will cause any issue in your setting, but to be safe, it would be better to match the range. If the sequence in the barcode file contains only barcode, you can use --barcodeRange 0 -1 + .

Just want to make sure, TRUST4 works on this sample after fixing the barcode number issue? Thank you.

HugoMananet commented 1 year ago

Yes, my barcode is 26bp in length, and my barcode file contains only barcode.

I tested the command

singularity run --cleanenv -B /work/shared/ptbc /work/shared/ptbc/tools/trust/v1.0.8/trust_v1.0.8_from_scratch.sif \
    -t 4 \
    -f /opt/TRUST4/hg19_bcrtcr.fa \
    --ref /opt/TRUST4/human_IMGT+C.fa \
    --barcodeLevel molecule \
    --barcodeRange 0 25 + \
    -u /directory/of/my/data/to/be/analyzed/sample_1/sample_1_R2_trimmed_after_cutpaired_end.fastq.gz \
    --barcode /directory/of/my/data/to/be/analyzed/sample_1/sample_1_R1_trimmed_26pb_after_cutpaired_end.fastq.gz \
    --od /directory/of/my/data/to/be/analyzed/sample_1/trust_results \
    -o sample_1

and

singularity run --cleanenv -B /work/shared/ptbc /work/shared/ptbc/tools/trust/v1.0.8/trust_v1.0.8_from_scratch.sif \
    -t 4 \
    -f /opt/TRUST4/hg19_bcrtcr.fa \
    --ref /opt/TRUST4/human_IMGT+C.fa \
    --barcodeLevel molecule \
    --barcodeRange 0 -1 + \
    -u /directory/of/my/data/to/be/analyzed/sample_1/sample_1_R2_trimmed_after_cutpaired_end.fastq.gz \
    --barcode /directory/of/my/data/to/be/analyzed/sample_1/sample_1_R1_trimmed_26pb_after_cutpaired_end.fastq.gz \
    --od /directory/of/my/data/to/be/analyzed/sample_1/trust_results \
    -o sample_1

The output is identical between both commands and works on this sample (and at least another one).

Thanks again for your help, Hugo