From 17b10a110a9ffe56b03e8ada4df992a4de9162e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pontus=20H=C3=B6jer?= Date: Wed, 7 Jun 2023 17:28:46 +0200 Subject: [PATCH] test calling DELs --- tests/data/make_testdata.sh | 8 ++++++++ tests/test_run.py | 19 +++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/tests/data/make_testdata.sh b/tests/data/make_testdata.sh index 3f2c708..71acc6e 100644 --- a/tests/data/make_testdata.sh +++ b/tests/data/make_testdata.sh @@ -25,3 +25,11 @@ bam="https://s3-us-west-2.amazonaws.com/10x.files/samples/genome/HCC1954T_WGS_21 region="chr21:18,709,465-18,956,782" samtools view "${bam}" "${region}" -o HCC1954T_10xGenomics_chr21_INV.bam samtools index HCC1954T_10xGenomics_chr21_INV.bam + +# DELETION ON CHROMOSOME 1 (NA24385) +# GRCh38: chr1 115686862 115690219 +# source: CMRG benchmark, https://ftp-trace.ncbi.nlm.nih.gov/giab/ftp/release/AshkenazimTrio/HG002_NA24385_son/CMRG_v1.00/GRCh38/StructuralVariant/ +bam="https://ftp-trace.ncbi.nlm.nih.gov/giab/ftp/data/AshkenazimTrio/analysis/10XGenomics_ChromiumGenome_LongRanger2.2_Supernova2.0.1_04122018/GRCh38/NA24385.GRCh38.phased_possorted_bam.bam" +region="chr1:115,620,601-115,756,835" +samtools view "${bam}" "${region}" -o NA24385_10xGenomics_chr1_DEL.bam +samtools index NA24385_10xGenomics_chr1_DEL.bam diff --git a/tests/test_run.py b/tests/test_run.py index 7da02c9..edd3a95 100644 --- a/tests/test_run.py +++ b/tests/test_run.py @@ -10,6 +10,7 @@ BAM_INV = Path("tests/data/HCC1954T_10xGenomics_chr21_INV.bam").absolute() CANDIDATES_INV = Path("tests/data/HCC1954T_10xGenomics_chr21_INV.candidates.bedpe").absolute() CANDIDATES_REV_INV = Path("tests/data/HCC1954T_10xGenomics_chr21_INV.candidates_reversed.bedpe").absolute() +BAM_DEL = Path("tests/data/NA24385_10xGenomics_chr1_DEL.bam").absolute() BAM_TRA = Path("tests/data/HCC1954T_10xGenomics_chr_12_20_TRA.bam").absolute() @@ -176,6 +177,24 @@ def test_consistent(tmp_path): same_pairwise_elements(line, new_line) +def test_call_deletion(tmp_path): + config_file = io.StringIO(f"bam_file={BAM_DEL}\noutdir={tmp_path}\nDEBUG=True\n") + configs = Configs.from_file(config_file) + + exitcode = run(configs) + assert exitcode == 0 + output = tmp_path / "NAIBR_SVs.bedpe" + with open(output) as bedpe_reader: + nas = list(iter_novel_adjacencies(bedpe_reader)) + assert len(nas) > 0 + nas_pass = [na for na in nas if na.pass_threshold] + assert len(nas_pass) == 1 + assert nas_pass[0].orient == "+-" + assert nas_pass[0].chrm1 == nas_pass[0].chrm2 == "chr1" + assert abs(nas_pass[0].break1 - 115686862) < 500 + assert abs(nas_pass[0].break2 - 115690219) < 500 + + def test_call_interchromosomal(tmp_path): config_file = io.StringIO(f"bam_file={BAM_TRA}\noutdir={tmp_path}\nDEBUG=True\n") configs = Configs.from_file(config_file)