Skip to content

Commit

Permalink
test for edge edit
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric Kofman committed Nov 20, 2024
1 parent fd23c3f commit 06c26e6
Show file tree
Hide file tree
Showing 6 changed files with 99 additions and 11 deletions.
46 changes: 37 additions & 9 deletions tests/integration_tests.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2889,14 +2889,25 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 4,
"id": "f5c3ed3e-13dd-4399-924e-3d1ac17ce387",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n",
"Checking results for edge_case_test\n",
"\tExpecting: {'contig': '10', 'barcode': 'AAACGAATCATTCATC-1', 'position': 132330481, 'num_rows': 1, 'count': 1, 'coverage': 1, 'conversion': 'T>G', 'strand_conversion': 'A>C', 'strand': '-', 'feature_name': 'STK32C', 'feature_strand': '-'}\n",
"\n",
"\t >>> edge_case_test passed! <<<\n",
"\n",
"\tExpecting: {'contig': '10', 'barcode': 'AAACGAATCATTCATC-1', 'position': 132330438, 'num_rows': 1, 'count': 1, 'coverage': 1, 'conversion': 'T>C', 'strand_conversion': 'A>G', 'strand': '-', 'feature_name': 'STK32C', 'feature_strand': '-'}\n",
"\n",
"\t >>> edge_case_test passed! <<<\n",
"\n",
"\n",
"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n",
"Checking results for unstranded_pair_test\n",
Expand Down Expand Up @@ -2992,21 +3003,38 @@
}
],
"source": [
"import pandas as pd\n",
"\n",
"test_name_to_expectations = {\n",
" \"edge_case_test\": {\n",
" \"folder\": \"singlecell_tests\",\n",
" \"annotated\": False,\n",
" \"expectations\": [{\n",
" \"contig\": \"10\",\n",
" \"barcode\": \t\"GGGACCTTCGAGCCAC-1\",\n",
" \"position\": 3000524,\n",
" \"barcode\": \t\"AAACGAATCATTCATC-1\",\n",
" \"position\": 132330481,\n",
" \"num_rows\": 1,\n",
" \"count\": 1,\n",
" \"coverage\": 12,\n",
" \"conversion\": \"C>A\",\n",
" \"strand_conversion\": \"G>T\",\n",
" \"strand\": \"-\"\n",
" }]\n",
" \"coverage\": 1,\n",
" \"conversion\": \"T>G\",\n",
" \"strand_conversion\": \"A>C\",\n",
" \"strand\": \"-\",\n",
" \"feature_name\": \"STK32C\",\n",
" \"feature_strand\": \"-\"\n",
" },\n",
" {\n",
" \"contig\": \"10\",\n",
" \"barcode\": \t\"AAACGAATCATTCATC-1\",\n",
" \"position\": 132330438,\n",
" \"num_rows\": 1,\n",
" \"count\": 1,\n",
" \"coverage\": 1,\n",
" \"conversion\": \"T>C\",\n",
" \"strand_conversion\": \"A>G\",\n",
" \"strand\": \"-\",\n",
" \"feature_name\": \"STK32C\",\n",
" \"feature_strand\": \"-\"\n",
" }\n",
" ]\n",
" },\n",
" \"unstranded_pair_test\": {\n",
" \"folder\": \"strandedness_tests\",\n",
Expand Down
32 changes: 31 additions & 1 deletion tests/integration_tests_auto_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,36 @@
import sys

test_name_to_expectations = {
"edge_case_test": {
"folder": "singlecell_tests",
"expectations": [{
"contig": "10",
"barcode": "AAACGAATCATTCATC-1",
"position": 132330481,
"num_rows": 1,
"count": 1,
"coverage": 1,
"conversion": "T>G",
"strand_conversion": "A>C",
"strand": "-",
"feature_name": "STK32C",
"feature_strand": "-"
},
{
"contig": "10",
"barcode": "AAACGAATCATTCATC-1",
"position": 132330438,
"num_rows": 1,
"count": 1,
"coverage": 1,
"conversion": "T>C",
"strand_conversion": "A>G",
"strand": "-",
"feature_name": "STK32C",
"feature_strand": "-"
}
]
},
"unstranded_pair_test": {
"folder": "strandedness_tests",
"expectations": [{
Expand Down Expand Up @@ -132,7 +162,7 @@
}]
},

"only_5_cells_test": {
"only_5_cells_test": {
"folder": "singlecell_tests",
"expectations": [{
"contig": "9",
Expand Down
2 changes: 1 addition & 1 deletion tests/integration_tests_run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ echo "SC tests scripts"
ls -lh $MARINE/tests/$tests_folder/scripts/


for t in "only_5_cells_test" "long_read_sc_test"
for t in "only_5_cells_test" "long_read_sc_test" "edge_case_test"

do
echo $t
Expand Down
Binary file added tests/singlecell_tests/bams/10_C-1_orig.bam
Binary file not shown.
Binary file added tests/singlecell_tests/bams/10_C-1_orig.bam.bai
Binary file not shown.
30 changes: 30 additions & 0 deletions tests/singlecell_tests/scripts/edge_case_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# This sample has an edit at the very end of the read. It's a good test to ensure that we don't have off by one errors
# in computing the coverage. It was aligned to the craig venter genome, so the reference is slightly difference from
# hg38 -- if aligning with hg38, this read doesn't have mutations at these positions.

# Expected edit
# AAACGAATCATTCATC-1 10_AAACGAATCATTCATC-1 10_AAACGAATCATTCATC-1:132330481 132330481 T G A00621:106:HLFHGDSXX:3:1152:16830:27352 -

# Expected combined.bed file
# 10_AAACGAATCATTCATC-1 132330438 132330439
# 10_AAACGAATCATTCATC-1 132330481 132330482

# Read
# A00621:106:HLFHGDSXX:3:1152:16830:27352 16 10_AAACGAATCATTCATC-1 132330391 255 91M * 0 0 GCAACACCCATGTCACTCCTCATTCTCTCCTTGCTCTGCCCGGGTGGCTGGCCTCCCCACGCTCCTGAGAAGGTACTGGTTGTGCTTTCAG FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF NH:i:1 HI:i:1 AS:i:89 nM:i:0 TX:Z:ENST00000456004,+406,91M GX:Z:ENSG00000165752 GN:Z:STK32C fx:Z:ENSG00000165752 RE:A:E li:i:0 BC:Z:TTTCCACT QT:Z:FFFFF:FF CR:Z:AAACGAATCATTCATC CY:Z:FFFFFFFFFFFFFFFF CB:Z:AAACGAATCATTCATC-1 UR:Z:CGCTTAAAACCT UY:Z:FFFFFFFFFFFF UB:Z:CGCTTAAAACCT xf:i:25 RG:Z:10X214_1_AB_1:0:1:HLFHGDSXX:3 NM:i:2 MD:Z:47T42T0

mypython=$1

$mypython $MARINE/marine.py \
--bam_filepath \
$MARINE/tests/singlecell_tests/bams/10_C-1_orig.bam \
--annotation_bedfile_path \
$MARINE/annotations/cellranger-GRCh38-3.0.0.annotation.genes.bed \
--output_folder \
$MARINE/tests/singlecell_tests/edge_case_test \
--min_base_quality \
15 \
--cores \
4 \
--barcode_tag "CB" \
--strandedness 2 --num_per_sublist 1 --verbose \
--contigs 10 --interval_length 40000000 --keep_intermediate_files

0 comments on commit 06c26e6

Please sign in to comment.