From 1943db8e2c9fc19142574f52cb4a71d7a86112cc Mon Sep 17 00:00:00 2001 From: Andreas Wilm Date: Tue, 22 Feb 2022 21:49:37 +0800 Subject: [PATCH 1/5] Convert to BAM directly while sorting --- scripts/extract.py | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/scripts/extract.py b/scripts/extract.py index 7a996a1..e108c3d 100644 --- a/scripts/extract.py +++ b/scripts/extract.py @@ -115,21 +115,13 @@ def extract_reads(bam, outdir, paired, unmapped, alts, temp, threads): command.extend([bam, alt+':', '>>', hla_filtered]) run_command(command) - - # Convert SAM to BAM - message = '[extract] Converting SAM to BAM: ' - command = ['samtools', 'view', '-Sb', '-@'+threads, - hla_filtered, '>', hla_filtered_bam] - run_command(command, message) - - - # Sort BAM + # Sort and convert to BAM hla_sorted = ''.join([temp, sample, '.hla.sorted.bam']) file_list.append(hla_sorted) file_list.append(hla_sorted + '.bai') message = '[extract] Sorting bam: ' command = ['samtools', 'sort', '-n', '-@'+threads, - hla_filtered_bam, '-o', hla_sorted] + hla_filtered, '-o', hla_sorted] run_command(command, message) # Convert BAM to FASTQ and compress From 59d72d23a5ec7977f6975934d66e0721959efc5e Mon Sep 17 00:00:00 2001 From: Andreas Wilm Date: Tue, 22 Feb 2022 22:07:14 +0800 Subject: [PATCH 2/5] Removed now unnecessary hla_filtered_bam definition --- scripts/extract.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/scripts/extract.py b/scripts/extract.py index e108c3d..1db7592 100644 --- a/scripts/extract.py +++ b/scripts/extract.py @@ -67,8 +67,6 @@ def extract_reads(bam, outdir, paired, unmapped, alts, temp, threads): hla_filtered = ''.join([temp, sample, '.hla.sam']) file_list.append(hla_filtered) - hla_filtered_bam = ''.join([temp, sample, '.hla.bam']) - file_list.append(hla_filtered_bam) # Get bam header to check for chromosome nomenclature output = run_command(['samtools', 'view', '-@'+threads, '-H', bam]) From 9745a82059c127740e58d880c6b300429bc6c6e6 Mon Sep 17 00:00:00 2001 From: alienzj Date: Wed, 5 Oct 2022 09:23:59 +0800 Subject: [PATCH 3/5] fix key error --- scripts/convert.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/scripts/convert.py b/scripts/convert.py index a322d18..9c4ef14 100644 --- a/scripts/convert.py +++ b/scripts/convert.py @@ -78,25 +78,25 @@ def convert_allele(allele, resolution): # Output: P-group allele elif resolution == 'p-group': - if allele[:-1] in p_group[i]: - allele = p_group[i][allele[:-1]] + if allele[:-1] in p_group[str(i)]: + allele = p_group[str(i)][allele[:-1]] - elif process_allele(allele[:-1], i - 1) in p_group[i]: - allele = p_group[i][process_allele(allele[:-1], i -1)] + elif process_allele(allele[:-1], i - 1) in p_group[str(i)]: + allele = p_group[str(i)][process_allele(allele[:-1], i -1)] # Input: ungrouped allele # Output: G-group allele elif resolution == 'g-group': - if allele in g_group[i]: - allele = g_group[i][allele] + if allele in g_group[str(i)]: + allele = g_group[str(i)][allele] elif allele[-1] != 'N': allele = process_allele(allele,3) # Input: ungrouped allele # Output: P-group allele elif resolution == 'p-group': - if allele in p_group[i]: - allele = p_group[i][allele] + if allele in p_group[str(i)]: + allele = p_group[str(i)][allele] # Input: ungrouped allele # Output: reduced resolution, ungrouped allele From 0782bf79463e0dd169139254d0fe5d2f78191d61 Mon Sep 17 00:00:00 2001 From: Alejandro Buendia Date: Fri, 2 Feb 2024 23:29:15 +0000 Subject: [PATCH 4/5] Update Dockerfile --- Docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Docker/Dockerfile b/Docker/Dockerfile index 53a950b..f769417 100644 --- a/Docker/Dockerfile +++ b/Docker/Dockerfile @@ -8,7 +8,7 @@ RUN apt-get update && \ RUN curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash RUN apt-get install -y git-lfs -RUN git clone -b buendia/ref_patch https://github.com/RabadanLab/arcasHLA.git +RUN git clone https://github.com/RabadanLab/arcasHLA.git RUN conda env create -f /app/arcasHLA/environment.yml RUN echo "source activate arcas-hla" > ~/.bashrc ENV PATH /opt/conda/envs/arcas-hla/bin:$PATH From 0574ea57e150ce73bee8516a850649a3d335eabd Mon Sep 17 00:00:00 2001 From: Alejandro Buendia Date: Thu, 8 Feb 2024 12:15:59 -0500 Subject: [PATCH 5/5] Update deps for bioconda integration --- environment.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/environment.yml b/environment.yml index b296912..d06ba0c 100644 --- a/environment.yml +++ b/environment.yml @@ -1,16 +1,16 @@ name: arcas-hla channels: - bioconda +- conda-forge dependencies: -- bedtools==2.26.0 +- bedtools==2.31.1 +- biopython==1.83 - kallisto==0.44.0 -- pip==23.3.1 +- numpy==1.26.4 +- pandas==2.2.0 +- pip==24.0 +- pyarrow==15.0.0 +- pytest==8.0.0 - python==3.10.0 -- samtools==1.11 -- pip: - - biopython==1.83 - - numpy==1.26.3 - - pandas==2.2.0 - - pyarrow==15.0.0 - - pytest==8.0.0 - - scipy==1.12.0 +- samtools==1.19.2 +- scipy==1.12.0