From 93cd0941598cbd152b07774b235b2cafc2ea97d0 Mon Sep 17 00:00:00 2001 From: Yang-Yang Feng Date: Sat, 6 Jan 2018 17:25:38 -0600 Subject: [PATCH] update tests for stranded option --- .DS_Store | Bin 0 -> 6148 bytes src/.DS_Store | Bin 0 -> 6148 bytes src/junctions/junctions_extractor.h | 1 - ...fy-default-stranded-annotatedjunctions.out | 2 + ...ify-default-stranded-annotatedvariants.out | 35 +++++++++++++ ...ts-identify-default-stranded-junctions.out | 1 + .../junctions-extract/expected-stranded-a.out | 49 ++++++++++++++++++ .../expected-stranded-a30.out | 41 +++++++++++++++ .../test_cis_splice_effects_identify.py | 25 ++++++++- .../test_junctions_extract.py | 14 +++++ 10 files changed, 166 insertions(+), 2 deletions(-) create mode 100644 .DS_Store create mode 100644 src/.DS_Store create mode 100644 tests/integration-test/data/cis-splice-effects-identify/expected-cis-splice-effects-identify-default-stranded-annotatedjunctions.out create mode 100644 tests/integration-test/data/cis-splice-effects-identify/expected-cis-splice-effects-identify-default-stranded-annotatedvariants.out create mode 100644 tests/integration-test/data/cis-splice-effects-identify/expected-cis-splice-effects-identify-default-stranded-junctions.out create mode 100644 tests/integration-test/data/junctions-extract/expected-stranded-a.out create mode 100644 tests/integration-test/data/junctions-extract/expected-stranded-a30.out diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..516735cad1461644c8c3950ec59dd89b5473f0a1 GIT binary patch literal 6148 zcmeHKO-~a+7=8ze-4euRnM7nDaV(UPU1GeS zrx6=dEmJ@y#;_@+nA+s8g(Ga;pcT*x{A&vEceg~dv_dx3kuKifxZ#Gei(Y&h*cOs; zE=(+-0FNdGl&*z2-j5+(dB6j=NzvfjkoBP_@Hx(mJqe!_-w=n6;FX|uLWdOQXQJ;z zUK8X}2mFw{JX6G;9sl|tCf%n7VmibVQl;r2&vE_J0jJ$?{Wxw237$j+> z@{^5?7bdP1jZ%4%Kju{VrM(|_?bJy-NzG}$5VgSbT~*$6()~esJC4JPvg7Uqez$Jk zT8^XC2_nCpaoyVuA}{XN;!flxd$t^JH}KN^x_NuE?H|E)(~10@APL+c4AK*$#Gkr3 zeR}%f@xqKXS9#Q%u}&8kD>K%^`MF-td}A1Q?#(Z)KX3J3zkT=q!^cmbzkC%7CWZr2 z*iD54_=bX#Mhe8&_>8%d!VEi%C#1CNEla zK`WpY&;#gJKm&luVySM@X3%t$^Wqz07Xeq2J>`O!sj7e9ZbY<#_!K6Fd zEyb%U>`RpH#MI@3shOF&p)fH!#?iFr*9iMl8NC=@;)9QpToO^GbQQN8#UrYK*tm7=1jD zwQjQ9ZHqO+6Aswwh#TarwZ?Vtt%xypT!D<8^U9dhl+j6Z9?j^rmeCPs*)tFFTTEGZ zojJq{HQJH8;A%Q~Y6f-w3Hd4c1tVnrQ#{f)*f!_UJnC_r*31+z1x$e-RDgT7*l_I8 zN>jiTFa;_F=CFNBwlL&?5kGz-Bep<)=|%qJVM0(j$9l&W93xs0&97=fl|^ z1zsGm^ytIk!r{Y(nO!)cIGvs2M@ol_Jz8lBm;y}&`u=tz`~TJV=l^Dq-I)TWz`s(! z4d!?A8B+>-YbQC`Ya{wST}*hT$0~#s-HOSTt@w^9 Ffltiee2)MC literal 0 HcmV?d00001 diff --git a/src/junctions/junctions_extractor.h b/src/junctions/junctions_extractor.h index c1b8820..d858320 100644 --- a/src/junctions/junctions_extractor.h +++ b/src/junctions/junctions_extractor.h @@ -161,7 +161,6 @@ class JunctionsExtractor { region_ = "."; } JunctionsExtractor(string bam1, string region1, int strandness1) : bam_(bam1), region_(region1), strandness_(strandness1) { - //cerr << "param constructor called" << endl; min_anchor_length_ = 8; min_intron_length_ = 70; max_intron_length_ = 500000; diff --git a/tests/integration-test/data/cis-splice-effects-identify/expected-cis-splice-effects-identify-default-stranded-annotatedjunctions.out b/tests/integration-test/data/cis-splice-effects-identify/expected-cis-splice-effects-identify-default-stranded-annotatedjunctions.out new file mode 100644 index 0000000..77c9ac8 --- /dev/null +++ b/tests/integration-test/data/cis-splice-effects-identify/expected-cis-splice-effects-identify-default-stranded-annotatedjunctions.out @@ -0,0 +1,2 @@ +chrom start end name score strand splice_site acceptors_skipped exons_skipped donors_skipped anchor known_donor known_acceptor known_junction genes transcripts variant_info +22 93668 97252 JUNC00000001 5 - CT-AC 0 0 0 N 0 0 0 NA NA 22:94626-94627 diff --git a/tests/integration-test/data/cis-splice-effects-identify/expected-cis-splice-effects-identify-default-stranded-annotatedvariants.out b/tests/integration-test/data/cis-splice-effects-identify/expected-cis-splice-effects-identify-default-stranded-annotatedvariants.out new file mode 100644 index 0000000..535a82b --- /dev/null +++ b/tests/integration-test/data/cis-splice-effects-identify/expected-cis-splice-effects-identify-default-stranded-annotatedvariants.out @@ -0,0 +1,35 @@ +##fileformat=VCFv4.1 +##FILTER= +##INFO= +##FORMAT= +##INFO= +##FORMAT= +##FORMAT= +##FORMAT= +##FORMAT= +##FILTER= +##FILTER= +##contig= +##test= +##reference=file:///lustre/scratch105/projects/g1k/ref/main_project/human_g1k_v37.fasta +##readme=AAAAAA +##readme=BBBBBB +##INFO= +##INFO= +##INFO= +##INFO= +##INFO= +##INFO= +##INFO= +##INFO= +#CHROM POS ID REF ALT QUAL FILTER INFO FORMAT A B +22 38192 . G T 19.2 PASS AN=4;AC=2;genes=EP300;transcripts=ENST00000263253;distances=0;annotations=splicing_exonic GT:GQ 0/1:215 0/1:225 +22 94627 . G C 29.2 PASS AN=4;AC=2;genes=EP300;transcripts=ENST00000263253;distances=1;annotations=splicing_intronic GT:GQ 0/1:215 0/1:225 +22 97780 . G T 29.2 PASS AN=4;AC=2;genes=EP300;transcripts=ENST00000263253;distances=2;annotations=splicing_exonic GT:GQ 0/1:215 0/1:225 +22 167675 . G T 29.2 PASS AN=4;AC=2;genes=RANGAP1;transcripts=ENST00000356244,ENST00000405486,ENST00000407260,ENST00000455915;distances=2,2,2,2;annotations=splicing_exonic,splicing_exonic,splicing_exonic,splicing_exonic GT:GQ 0/1:215 0/1:225 +22 167677 . G T 29.2 PASS AN=4;AC=2;genes=RANGAP1;transcripts=ENST00000356244,ENST00000405486,ENST00000407260,ENST00000455915;distances=0,0,0,0;annotations=splicing_exonic,splicing_exonic,splicing_exonic,splicing_exonic GT:GQ 0/1:215 0/1:225 +22 167679 . G T 29.2 PASS AN=4;AC=2;genes=RANGAP1;transcripts=ENST00000356244,ENST00000405486,ENST00000407260,ENST00000455915;distances=2,2,2,2;annotations=splicing_intronic,splicing_intronic,splicing_intronic,splicing_intronic GT:GQ 0/1:215 0/1:225 +22 175311 . G T 29.2 PASS AN=4;AC=2;genes=RANGAP1;transcripts=ENST00000356244,ENST00000405486,ENST00000407260,ENST00000455915;distances=2,2,2,2;annotations=splicing_intronic,splicing_intronic,splicing_intronic,splicing_intronic GT:GQ 0/1:215 0/1:225 +22 175501 . G T 29.2 PASS AN=4;AC=2;genes=RANGAP1;transcripts=ENST00000356244,ENST00000405486,ENST00000407260,ENST00000455915;distances=2,2,2,2;annotations=splicing_intronic,splicing_intronic,splicing_intronic,splicing_intronic GT:GQ 0/1:215 0/1:225 +22 206991 . G T 29.2 PASS AN=4;AC=2;genes=RANGAP1;transcripts=ENST00000356244;distances=0;annotations=splicing_exonic GT:GQ 0/1:215 0/1:225 +22 206993 . G T 29.2 PASS AN=4;AC=2;genes=RANGAP1;transcripts=ENST00000356244;distances=2;annotations=splicing_exonic GT:GQ 0/1:215 0/1:225 diff --git a/tests/integration-test/data/cis-splice-effects-identify/expected-cis-splice-effects-identify-default-stranded-junctions.out b/tests/integration-test/data/cis-splice-effects-identify/expected-cis-splice-effects-identify-default-stranded-junctions.out new file mode 100644 index 0000000..4befce5 --- /dev/null +++ b/tests/integration-test/data/cis-splice-effects-identify/expected-cis-splice-effects-identify-default-stranded-junctions.out @@ -0,0 +1 @@ +22 93614 97301 JUNC00000001 5 - 93614 97301 255,0,0 2 54,50 0,3637 diff --git a/tests/integration-test/data/junctions-extract/expected-stranded-a.out b/tests/integration-test/data/junctions-extract/expected-stranded-a.out new file mode 100644 index 0000000..ccf6819 --- /dev/null +++ b/tests/integration-test/data/junctions-extract/expected-stranded-a.out @@ -0,0 +1,49 @@ +1 22379140 22405017 JUNC00000001 236 - 22379140 22405017 255,0,0 2 95,96 0,25781 +1 22379151 22405017 JUNC00000002 261 + 22379151 22405017 255,0,0 2 84,96 0,25770 +1 22379167 22405020 JUNC00000003 245 ? 22379167 22405020 255,0,0 2 68,99 0,25754 +1 22379198 22400683 JUNC00000004 17 + 22379198 22400683 255,0,0 2 37,97 0,21388 +1 22379202 22400683 JUNC00000005 18 - 22379202 22400683 255,0,0 2 33,97 0,21384 +1 22379210 22400675 JUNC00000006 6 ? 22379210 22400675 255,0,0 2 25,89 0,21376 +1 22379367 22404979 JUNC00000007 1 - 22379367 22404979 255,0,0 2 42,58 0,25554 +1 22380382 22404963 JUNC00000010 1 - 22380382 22404963 255,0,0 2 58,42 0,24539 +1 22400613 22405020 JUNC00000011 94 - 22400613 22405020 255,0,0 2 99,99 0,4308 +1 22400615 22405020 JUNC00000012 119 + 22400615 22405020 255,0,0 2 97,99 0,4306 +1 22400616 22405019 JUNC00000013 27 ? 22400616 22405019 255,0,0 2 96,98 0,4305 +1 22404977 22408287 JUNC00000016 315 ? 22404977 22408287 255,0,0 2 99,73 0,3237 +1 22404977 22408287 JUNC00000014 1767 + 22404977 22408287 255,0,0 2 99,73 0,3237 +1 22404977 22408287 JUNC00000015 1814 - 22404977 22408287 255,0,0 2 99,73 0,3237 +1 22404983 22413017 JUNC00000017 7 - 22404983 22413017 255,0,0 2 93,86 0,7948 +1 22405013 22405292 JUNC00000018 3 - 22405013 22405292 255,0,0 2 63,94 0,185 +1 22405022 22413024 JUNC00000019 5 + 22405022 22413024 255,0,0 2 54,93 0,7909 +1 22405283 22408281 JUNC00000024 6 + 22405283 22408281 255,0,0 2 91,67 0,2931 +1 22405301 22408241 JUNC00000025 1 ? 22405301 22408241 255,0,0 2 73,27 0,2913 +1 22405322 22408287 JUNC00000026 5 - 22405322 22408287 255,0,0 2 52,73 0,2892 +1 22408214 22413030 JUNC00000022 241 ? 22408214 22413030 255,0,0 2 73,99 0,4717 +1 22408214 22413030 JUNC00000021 2371 + 22408214 22413030 255,0,0 2 73,99 0,4717 +1 22408214 22413030 JUNC00000020 2266 - 22408214 22413030 255,0,0 2 73,99 0,4717 +1 22408221 22412968 JUNC00000027 1 - 22408221 22412968 255,0,0 2 62,37 0,4710 +1 22412942 22413260 JUNC00000028 1894 + 22412942 22413260 255,0,0 2 99,99 0,219 +1 22412942 22413260 JUNC00000029 2028 - 22412942 22413260 255,0,0 2 99,99 0,219 +1 22412942 22413260 JUNC00000030 196 ? 22412942 22413260 255,0,0 2 99,99 0,219 +1 22413260 22416446 JUNC00000032 31 ? 22413260 22416446 255,0,0 2 99,11 0,3175 +1 22413260 22418018 JUNC00000033 144 ? 22413260 22418018 255,0,0 2 99,98 0,4660 +1 22413260 22418019 JUNC00000031 326 + 22413260 22418019 255,0,0 2 99,99 0,4660 +1 22413261 22418019 JUNC00000034 450 - 22413261 22418019 255,0,0 2 98,99 0,4659 +1 22413262 22416494 JUNC00000035 12 - 22413262 22416494 255,0,0 2 97,59 0,3173 +1 22413274 22416494 JUNC00000036 15 + 22413274 22416494 255,0,0 2 85,59 0,3161 +1 22413276 22481449 JUNC00000037 4 - 22413276 22481449 255,0,0 2 83,54 0,68119 +1 22413278 22481419 JUNC00000038 4 + 22413278 22481419 255,0,0 2 81,24 0,68117 +1 22413280 22418023 JUNC00000039 10 - 22413280 22418023 255,0,0 2 79,99 0,4644 +1 22413282 22481418 JUNC00000040 1 ? 22413282 22481418 255,0,0 2 77,23 0,68113 +1 22413287 22498575 JUNC00000041 1 + 22413287 22498575 255,0,0 2 72,28 0,85260 +1 22413289 22418023 JUNC00000042 6 + 22413289 22418023 255,0,0 2 70,99 0,4635 +1 22413295 22417924 JUNC00000043 2 + 22413295 22417924 255,0,0 2 64,36 0,4593 +1 22413316 22456130 JUNC00000044 1 ? 22413316 22456130 255,0,0 2 43,55 0,42759 +1 22413326 22498614 JUNC00000045 1 - 22413326 22498614 255,0,0 2 33,67 0,85221 +1 22413335 22445230 JUNC00000046 1 + 22413335 22445230 255,0,0 2 24,76 0,31819 +1 22446966 22447774 JUNC00000048 2 + 22446966 22447774 255,0,0 2 44,71 0,737 +1 22446980 22447761 JUNC00000049 1 - 22446980 22447761 255,0,0 2 30,58 0,723 +1 22447808 22448007 JUNC00000050 2 ? 22447808 22448007 255,0,0 2 38,70 0,129 +1 22447816 22448007 JUNC00000051 1 + 22447816 22448007 255,0,0 2 30,70 0,121 +1 22447997 22456136 JUNC00000052 1 + 22447997 22456136 255,0,0 2 72,28 0,8111 +1 22469441 22481452 JUNC00000053 1 + 22469441 22481452 255,0,0 2 43,57 0,11954 diff --git a/tests/integration-test/data/junctions-extract/expected-stranded-a30.out b/tests/integration-test/data/junctions-extract/expected-stranded-a30.out new file mode 100644 index 0000000..ef09d0a --- /dev/null +++ b/tests/integration-test/data/junctions-extract/expected-stranded-a30.out @@ -0,0 +1,41 @@ +1 22379140 22405017 JUNC00000001 236 - 22379140 22405017 255,0,0 2 95,96 0,25781 +1 22379151 22405017 JUNC00000002 261 + 22379151 22405017 255,0,0 2 84,96 0,25770 +1 22379167 22405020 JUNC00000003 245 ? 22379167 22405020 255,0,0 2 68,99 0,25754 +1 22379198 22400683 JUNC00000004 17 + 22379198 22400683 255,0,0 2 37,97 0,21388 +1 22379202 22400683 JUNC00000005 18 - 22379202 22400683 255,0,0 2 33,97 0,21384 +1 22379367 22404979 JUNC00000007 1 - 22379367 22404979 255,0,0 2 42,58 0,25554 +1 22380382 22404963 JUNC00000010 1 - 22380382 22404963 255,0,0 2 58,42 0,24539 +1 22400613 22405020 JUNC00000011 94 - 22400613 22405020 255,0,0 2 99,99 0,4308 +1 22400615 22405020 JUNC00000012 119 + 22400615 22405020 255,0,0 2 97,99 0,4306 +1 22400616 22405019 JUNC00000013 27 ? 22400616 22405019 255,0,0 2 96,98 0,4305 +1 22404977 22408287 JUNC00000016 315 ? 22404977 22408287 255,0,0 2 99,73 0,3237 +1 22404977 22408287 JUNC00000014 1767 + 22404977 22408287 255,0,0 2 99,73 0,3237 +1 22404977 22408287 JUNC00000015 1814 - 22404977 22408287 255,0,0 2 99,73 0,3237 +1 22404983 22413017 JUNC00000017 7 - 22404983 22413017 255,0,0 2 93,86 0,7948 +1 22405013 22405292 JUNC00000018 3 - 22405013 22405292 255,0,0 2 63,94 0,185 +1 22405022 22413024 JUNC00000019 5 + 22405022 22413024 255,0,0 2 54,93 0,7909 +1 22405283 22408281 JUNC00000024 6 + 22405283 22408281 255,0,0 2 91,67 0,2931 +1 22405322 22408287 JUNC00000026 5 - 22405322 22408287 255,0,0 2 52,73 0,2892 +1 22408214 22413030 JUNC00000022 241 ? 22408214 22413030 255,0,0 2 73,99 0,4717 +1 22408214 22413030 JUNC00000021 2371 + 22408214 22413030 255,0,0 2 73,99 0,4717 +1 22408214 22413030 JUNC00000020 2266 - 22408214 22413030 255,0,0 2 73,99 0,4717 +1 22408221 22412968 JUNC00000027 1 - 22408221 22412968 255,0,0 2 62,37 0,4710 +1 22412942 22413260 JUNC00000028 1894 + 22412942 22413260 255,0,0 2 99,99 0,219 +1 22412942 22413260 JUNC00000029 2028 - 22412942 22413260 255,0,0 2 99,99 0,219 +1 22412942 22413260 JUNC00000030 196 ? 22412942 22413260 255,0,0 2 99,99 0,219 +1 22413260 22418018 JUNC00000033 144 ? 22413260 22418018 255,0,0 2 99,98 0,4660 +1 22413260 22418019 JUNC00000031 326 + 22413260 22418019 255,0,0 2 99,99 0,4660 +1 22413261 22418019 JUNC00000034 450 - 22413261 22418019 255,0,0 2 98,99 0,4659 +1 22413262 22416494 JUNC00000035 12 - 22413262 22416494 255,0,0 2 97,59 0,3173 +1 22413274 22416494 JUNC00000036 15 + 22413274 22416494 255,0,0 2 85,59 0,3161 +1 22413276 22481449 JUNC00000037 4 - 22413276 22481449 255,0,0 2 83,54 0,68119 +1 22413280 22418023 JUNC00000039 10 - 22413280 22418023 255,0,0 2 79,99 0,4644 +1 22413289 22418023 JUNC00000042 6 + 22413289 22418023 255,0,0 2 70,99 0,4635 +1 22413295 22417924 JUNC00000043 2 + 22413295 22417924 255,0,0 2 64,36 0,4593 +1 22413316 22456130 JUNC00000044 1 ? 22413316 22456130 255,0,0 2 43,55 0,42759 +1 22413326 22498614 JUNC00000045 1 - 22413326 22498614 255,0,0 2 33,67 0,85221 +1 22446966 22447774 JUNC00000048 2 + 22446966 22447774 255,0,0 2 44,71 0,737 +1 22446980 22447761 JUNC00000049 1 - 22446980 22447761 255,0,0 2 30,58 0,723 +1 22447808 22448007 JUNC00000050 2 ? 22447808 22448007 255,0,0 2 38,70 0,129 +1 22447816 22448007 JUNC00000051 1 + 22447816 22448007 255,0,0 2 30,70 0,121 +1 22469441 22481452 JUNC00000053 1 + 22469441 22481452 255,0,0 2 43,57 0,11954 diff --git a/tests/integration-test/test_cis_splice_effects_identify.py b/tests/integration-test/test_cis_splice_effects_identify.py index 90a946e..e90e8a2 100755 --- a/tests/integration-test/test_cis_splice_effects_identify.py +++ b/tests/integration-test/test_cis_splice_effects_identify.py @@ -30,7 +30,30 @@ import unittest class TestCisSpliceEffectsIdentify(IntegrationTest, unittest.TestCase): - #Test default options. + #Test default options (but with RF strandedness). + def test_default_stranded(self): + variants = self.inputFiles("vcf/test1.vcf")[0] + bam1 = self.inputFiles("bam/test_hcc1395.2.bam")[0] + fasta = self.inputFiles("fa/test_chr22.fa")[0] + gtf = self.inputFiles("gtf/test_ensemble_chr22.2.gtf")[0] + output_annotatedjunctions = self.tempFile("observed-cse-identify.out") + output_annotatedvariants = self.tempFile("observed-cse-identify-variants.out") + output_junctions = self.tempFile("observed-cse-identify-junctions.out") + expected_annotatedjunctions = self.inputFiles("cis-splice-effects-identify/expected-cis-splice-effects-identify-default-stranded-annotatedjunctions.out")[0] + expected_annotatedvariants = self.inputFiles("cis-splice-effects-identify/expected-cis-splice-effects-identify-default-stranded-annotatedvariants.out")[0] + expected_junctions = self.inputFiles("cis-splice-effects-identify/expected-cis-splice-effects-identify-default-stranded-junctions.out")[0] + params = ["cis-splice-effects", "identify", + "-o ", output_annotatedjunctions, + "-v ", output_annotatedvariants, + "-j ", output_junctions, + variants, bam1, fasta, gtf] + rv, err = self.execute(params) + self.assertEqual(rv, 0, err) + self.assertFilesEqual(expected_annotatedjunctions, output_annotatedjunctions, err) + self.assertFilesEqual(expected_annotatedvariants, output_annotatedvariants, err) + self.assertFilesEqual(expected_junctions, output_junctions, err) + + #Test default options (but with unstranded). def test_default(self): variants = self.inputFiles("vcf/test1.vcf")[0] bam1 = self.inputFiles("bam/test_hcc1395.2.bam")[0] diff --git a/tests/integration-test/test_junctions_extract.py b/tests/integration-test/test_junctions_extract.py index e0bc7a6..40619e9 100755 --- a/tests/integration-test/test_junctions_extract.py +++ b/tests/integration-test/test_junctions_extract.py @@ -30,6 +30,20 @@ import unittest class TestExtract(IntegrationTest, unittest.TestCase): + def test_junctions_extract_anchor_stranded(self): + bam1 = self.inputFiles("bam/test_hcc1395.bam")[0] + output_file = self.tempFile("extract.out") + print "BAM1 is ", bam1 + for anchor in ["", "30"]: + expected_file = self.inputFiles("junctions-extract/expected-stranded-a" + + anchor + ".out")[0] + if anchor != "": + anchor = "-a " + anchor + params = ["junctions", "extract", anchor, "-o", output_file, bam1] + rv, err = self.execute(params) + self.assertEqual(rv, 0) + self.assertFilesEqual(expected_file, output_file) + def test_junctions_extract_anchor(self): bam1 = self.inputFiles("bam/test_hcc1395.bam")[0] output_file = self.tempFile("extract.out")