Skip to content

Commit

Permalink
Added unit and integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
patricksorn committed Feb 7, 2024
1 parent 78ab069 commit bb7a9b4
Show file tree
Hide file tree
Showing 17 changed files with 184 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ trace.txt*
report.html*
test/output
conda_env
__pycache__/
8 changes: 0 additions & 8 deletions environments/easyfuse_src.yml

This file was deleted.

18 changes: 18 additions & 0 deletions test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: test_env
channels:
- bioconda
- conda-forge
- anaconda
dependencies:
- python>=3.8
- bioconda::gffutils=0.12
- bioconda::pysam=0.22.0
- conda-forge::pytest=8.0.0
- conda-forge::pytest-workflow=2.0.1
- conda-forge::logzero=1.7.0
- conda-forge::biopython=1.83
- conda-forge::python-xxhash=3.4.1
- conda-forge::r-base
- conda-forge::r-optparse
- conda-forge::r-tidyverse
- conda-forge::r-randomForest
Empty file added tests/__init__.py
Empty file.
Empty file added tests/annotation/__init__.py
Empty file.
4 changes: 4 additions & 0 deletions tests/annotation/test_fusionannotation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from bin.fusionannotation import FusionAnnotation

def test_breakpoints_to_dict():
pass
Empty file added tests/filtering/__init__.py
Empty file.
4 changes: 4 additions & 0 deletions tests/filtering/test_fusionreadfilter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from bin.fusionreadfilter import FusionReadFilter

def test_fusionreadfilter():
pass
Empty file added tests/merging/__init__.py
Empty file.
4 changes: 4 additions & 0 deletions tests/merging/test_merge_data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#from bin.merge_data import FusionSummary

def test_normalize_counts_cpm():
pass
Empty file added tests/parsing/__init__.py
Empty file.
10 changes: 10 additions & 0 deletions tests/parsing/arriba.tsv

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions tests/parsing/fusioncatcher_1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Very short summary of found candidate somatic fusion genes
======================================================= ====

Found 8 somatic fusion gene(s), which are as follows:
* TMPRSS2--ETV1 (already known fusion)
* EWSR1--ATF1 (already known fusion; exon-exon fusion junction)
* AKAP9--BRAF (already known fusion; exon-exon fusion junction)
* ETV6--NTRK3 (already known fusion; exon-exon fusion junction)
* HOOK3--RET (already known fusion; exon-exon fusion junction)
* EWSR1--FLI1 (already known fusion; exon-exon fusion junction)
* BRD4--NUTM1 (already known fusion; exon-exon fusion junction)
* CD74--ROS1 (already known fusion; exon-exon fusion junction)

Found 8 somatic fusion transcript(s).

For more detailed information regarding these candidate fusions, see text file 'final-list_candidate-fusion-genes.txt'.
9 changes: 9 additions & 0 deletions tests/parsing/fusioncatcher_2.tsv
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Gene_1_symbol(5end_fusion_partner) Gene_2_symbol(3end_fusion_partner) Fusion_description Counts_of_common_mapping_reads Spanning_pairs Spanning_unique_reads Longest_anchor_found Fusion_finding_method Fusion_point_for_gene_1(5end_fusion_partner) Fusion_point_for_gene_2(3end_fusion_partner) Gene_1_id(5end_fusion_partner) Gene_2_id(3end_fusion_partner) Exon_1_id(5end_fusion_partner) Exon_2_id(3end_fusion_partner) Fusion_sequence Predicted_effect
TMPRSS2 ETV1 known,oncogene,cosmic,chimer2,cgp,ticdb,chimer4kb,chimer4pub,chimer4seq,cancer,tumor,tcga-cancer,oncokb,mitelman,t43 0 367 16 25 BOWTIE+BLAT 21:41494380:- 7:13935843:- ENSG00000184012 ENSG00000006468 GGTCCTGACGCAGGCTTCCAACCCCGTCGTCTGCACGCAGCCCAAATCCC*CATCCAGCACGCCAGTGTCCCCACTGCATCATGCATCTCCAAACTCAACT in-frame
EWSR1 ATF1 known,oncogene,cosmic,cgp,ticdb,chimer4kb,chimer4pub,chimer4seq,cancer,tumor,m114,oncokb,mitelman,t24,exon-exon 0 363 23 25 BOWTIE 22:29287134:+ 12:50814280:+ ENSG00000182944 ENSG00000123268 ENSE00003570564 ENSE00003675908 CAATATAGCCAACAGAGCAGCAGCTACGGGCAGCAGA*CTGCATCAGGAGATATGCAAACATATCAGATCCGAAC in-frame
AKAP9 BRAF known,oncogene,cosmic,chimer2,cgp,ticdb,chimer4kb,chimer4pub,chimer4seq,cancer,tumor,oncokb,mitelman,t34,exon-exon 0 340 21 25 BOWTIE 7:92003235:+ 7:140787584:- ENSG00000127914 ENSG00000157764 ENSE00003484877 ENSE00003680515 ACTTCAGAAAGAACTCAATGTACTTAAATCAGAACAG*GACTTGATTAGAGACCAAGGATTTCGTGGTGATGGAG in-frame
ETV6 NTRK3 known,oncogene,cosmic,chimer2,cgp,ticdb,tcga,ccle2,18cancers,chimer4kb,chimer4pub,chimer4seq,cancer,tumor,tcga-cancer,tcga2,oncokb,mitelman,pcawg,tcga3,t32,exon-exon 0 299 23 25 BOWTIE 12:11869969:+ 15:87940753:- ENSG00000139083 ENSG00000140538 ENSE00001788162 ENSE00001134154 CCTGAAGAGCACGCCATGCCCATTGGGAGAATAGCAG*ATGTGCAGCACATTAAGAGGAGAGACATCGTGCTGAA in-frame
HOOK3 RET known,oncogene,cosmic,cgp,ticdb,chimer4kb,chimer4pub,chimer4seq,cancer,tumor,mitelman,t43,exon-exon 0 298 20 25 BOWTIE 8:42968214:+ 10:43116584:+ ENSG00000168172 ENSG00000165731 ENSE00003485179 ENSE00001095944 CGCAGCGCGAAGTCAACTTGAAACCTACAAGAGACAG*GAGGATCCAAAGTGGGAATTCCCTCGGAAGAACTTGG in-frame
EWSR1 FLI1 known,oncogene,cosmic,cgp,ticdb,ccle2,chimer4kb,chimer4pub,chimer4seq,cancer,tumor,m85,oncokb,mitelman,ccle,t16,exon-exon 0 282 22 25 BOWTIE 22:29287134:+ 11:128807180:+ ENSG00000182944 ENSG00000151702 ENSE00003570564 ENSE00003702967 CAATATAGCCAACAGAGCAGCAGCTACGGGCAGCAGA*GTCCTCCCCTTGGAGGGGCACAAACGATCAGTAAGAA in-frame
BRD4 NUTM1 known,oncogene,cosmic,chimer2,cgp,ticdb,ccle2,chimer4kb,chimer4pub,chimer4seq,cancer,oncokb,mitelman,ccle,t32,exon-exon 0 244 20 24 BOWTIE 19:15254152:- 15:34347969:+ ENSG00000141867 ENSG00000184507 ENSE00001187704 ENSE00001367212 GAGTCCAGCTCCTCTGACAGCGAAGACTCCGAAACAG*CATCTGCATTGCCGGGACCGGATATGAGCATGAAACC in-frame
CD74 ROS1 known,oncogene,cosmic,chimer2,cgp,ticdb,tcga,ccle2,18cancers,chimer4kb,chimer4pub,chimer4seq,cancer,tumor,tcga-cancer,tcga2,oncokb,mitelman,pcawg,t29,exon-exon 0 152 22 25 BOWTIE 5:150404680:- 6:117324415:- ENSG00000019582 ENSG00000047936 ENSE00000841201 ENSE00000762702 TCCTTGGAGCAAAAGCCCACTGACGCTCCACCGAAAG*ATGATTTTTGGATACCAGAAACAAGTTTCATACTTAC in-frame
10 changes: 10 additions & 0 deletions tests/parsing/starfusion.tsv

Large diffs are not rendered by default.

97 changes: 97 additions & 0 deletions tests/parsing/test_fusiontoolparser.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
from bin.fusiontoolparser_helper import parse_fusioncatcher_results
from bin.fusiontoolparser_helper import parse_starfusion_results
from bin.fusiontoolparser_helper import parse_arriba_results

def test_parse_fusioncatcher_results():
infile = "tests/parsing/fusioncatcher_1.txt"
infile2 = "tests/parsing/fusioncatcher_2.tsv"
assert parse_fusioncatcher_results(infile, infile2) == {
'21:41494380:-_7:13935843:-': [
'TMPRSS2_ETV1', '21:41494380:-', '7:13935843:-', '16', '367'
],
'22:29287134:+_12:50814280:+': [
'EWSR1_ATF1', '22:29287134:+', '12:50814280:+', '23', '363'
],
'7:92003235:+_7:140787584:-': [
'AKAP9_BRAF', '7:92003235:+', '7:140787584:-', '21', '340'
],
'12:11869969:+_15:87940753:-': [
'ETV6_NTRK3', '12:11869969:+', '15:87940753:-', '23', '299'
],
'8:42968214:+_10:43116584:+': [
'HOOK3_RET', '8:42968214:+', '10:43116584:+', '20', '298'
],
'22:29287134:+_11:128807180:+': [
'EWSR1_FLI1', '22:29287134:+', '11:128807180:+', '22', '282'
],
'19:15254152:-_15:34347969:+': [
'BRD4_NUTM1', '19:15254152:-', '15:34347969:+', '20', '244'
],
'5:150404680:-_6:117324415:-': [
'CD74_ROS1', '5:150404680:-', '6:117324415:-', '22', '152'
]
}

def test_parse_starfusion_results():
infile = "tests/parsing/starfusion.tsv"
assert parse_starfusion_results(infile) == {
'12:11869969:+_15:87940753:-': [
'ETV6_NTRK3', '12:11869969:+', '15:87940753:-', '160', '390'
],
'22:29287134:+_11:128807180:+': [
'EWSR1_FLI1', '22:29287134:+', '11:128807180:+', '140', '333'
],
'19:15254152:-_15:34347969:+': [
'BRD4_NUTM1', '19:15254152:-', '15:34347969:+', '132', '260'
],
'22:29287134:+_12:50814280:+': [
'EWSR1_ATF1', '22:29287134:+', '12:50814280:+', '129', '367'
],
'5:150404680:-_6:117324415:-': [
'CD74_ROS1', '5:150404680:-', '6:117324415:-', '125', '140'
],
'7:92003235:+_7:140787584:-': [
'AKAP9_BRAF', '7:92003235:+', '7:140787584:-', '120', '348'
],
'8:42968214:+_10:43116584:+': [
'HOOK3_RET', '8:42968214:+', '10:43116584:+', '94', '276'
],
'21:41494375:-_7:13935838:-': [
'TMPRSS2_ETV1', '21:41494375:-', '7:13935838:-', '76', '321'
],
'2:42301394:+_2:29223584:-': [
'EML4_ALK', '2:42301394:+', '2:29223584:-', '61', '256'
]
}

def test_parse_arriba_results():
infile = "tests/parsing/arriba.tsv"
assert parse_arriba_results(infile) == {
'12:11869969:+_15:87940753:-': [
'ETV6_NTRK3', '12:11869969:+', '15:87940753:-', '130', '300'
],
'7:92003235:+_7:140787584:-': [
'AKAP9_BRAF', '7:92003235:+', '7:140787584:-', '113', '299'
],
'22:29287134:+_11:128807180:+': [
'EWSR1_FLI1', '22:29287134:+', '11:128807180:+', '70', '299'
],
'8:42968214:+_10:43116584:+': [
'HOOK3_RET', '8:42968214:+', '10:43116584:+', '88', '275'
],
'22:29287134:+_12:50814280:+': [
'EWSR1_ATF1', '22:29287134:+', '12:50814280:+', '49', '299'
],
'19:15254152:-_15:34347969:+': [
'BRD4_NUTM1', '19:15254152:-', '15:34347969:+', '82', '232'
],
'2:42301394:+_2:29223584:-': [
'EML4_ALK', '2:42301394:+', '2:29223584:-', '52', '221'
],
'5:150404680:-_6:117324415:-': [
'CD74_ROS1', '5:150404680:-', '6:117324415:-', '75', '139'
],
'21:41494375:-_7:13935838:-': [
'TMPRSS2_ETV1', '21:41494375:-', '7:13935838:-', '59', '300'
]
}
11 changes: 11 additions & 0 deletions tests/test_fusiontoolparser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
- name: Parse results of fusion tools
command: >
bin/fusiontoolparser.py \
--input-fusioncatcher tests/parsing/fusioncatcher_1.txt \
--input-fusioncatcher2 tests/parsing/fusioncatcher_2.tsv \
--input-starfusion tests/parsing/starfusion.tsv \
--input-arriba tests/parsing/arriba.tsv \
-o tests/ \
-s test
files:
- path: "tests/Detected_Fusions.csv"

0 comments on commit bb7a9b4

Please sign in to comment.