Skip to content

Commit

Permalink
test calling DELs
Browse files Browse the repository at this point in the history
  • Loading branch information
pontushojer committed Jun 7, 2023
1 parent 0618409 commit 17b10a1
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/data/make_testdata.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
19 changes: 19 additions & 0 deletions tests/test_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()


Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 17b10a1

Please sign in to comment.