Skip to content

Commit

Permalink
Merge pull request #78 from brentp/fixes
Browse files Browse the repository at this point in the history
set alt clip to 0 if there is no other alt support
  • Loading branch information
ernfrid authored Apr 2, 2018
2 parents e576190 + b48089e commit e2b31ae
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Requirements:

## `svtyper` vs `svtyper-sso`

`svtyper` is the original implementation of the genotyping algorithm, and works with multiple samples. `svtyper-sso` is an alternative implementation of `svtyper` that is optimized for genotyping a single sample. `svtyper-sso` is a parallelized implementation of `svtyper` that takes advantage of multiple CPU cores via the [multiprocessing][8] module. `svtyper-sso` can offer a 2x or more speedup (depending on how many CPU cores used) in genotyping a single sample.
`svtyper` is the original implementation of the genotyping algorithm, and works with multiple samples. `svtyper-sso` is an alternative implementation of `svtyper` that is optimized for genotyping a single sample. `svtyper-sso` is a parallelized implementation of `svtyper` that takes advantage of multiple CPU cores via the [multiprocessing][8] module. `svtyper-sso` can offer a 2x or more speedup (depending on how many CPU cores used) in genotyping a single sample. **_NOTE: svtyper-sso is not yet stable. There are minor logging differences between the two and svtyper-sso may exit with an error prematurely when processing CRAM files._**

## Example Usage

Expand Down
9 changes: 9 additions & 0 deletions svtyper/classic.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,10 +427,15 @@ def sv_genotype(bam_string,
alt_span = 0
ref_span = 0

if alt_span + alt_seq == 0 and alt_clip > 0:
# discount any SV that's only supported by clips.
alt_clip = 0

if ref_seq + alt_seq + ref_span + alt_span + alt_clip > 0:
# get bayesian classifier
if var.info['SVTYPE'] == "DUP": is_dup = True
else: is_dup = False

alt_splitters = alt_seq + alt_clip
QR = int(split_weight * ref_seq) + int(disc_weight * ref_span)
QA = int(split_weight * alt_splitters) + int(disc_weight * alt_span)
Expand Down Expand Up @@ -512,6 +517,10 @@ def sv_genotype(bam_string,
var2.genotype = var.genotype
vcf_out.write(var2.get_var_string() + '\n')

# throw warning if we've lost unpaired breakends
if True:

This comment has been minimized.

Copy link
@brentp

brentp Apr 3, 2018

Contributor

did you mean to use an actual boolean here?

This comment has been minimized.

Copy link
@ernfrid

ernfrid Apr 3, 2018

Author Contributor

Well that's embarrassing. Yes, I did. Fix coming shortly.

logging.warning('Unpaired breakends found in file. These will not be present in output.')

# close the files
vcf_in.close()
vcf_out.close()
Expand Down
3 changes: 3 additions & 0 deletions svtyper/singlesample.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,9 @@ def tally_variant_read_fragments(split_slop, min_aligned, breakpoint, sam_fragme
if alt_span < 0.5 and (alt_seq + alt_clip) >= 1:
alt_span = 0
ref_span = 0
if alt_span + alt_seq == 0 and alt_clip > 0:
# discount any SV that's only supported by clips.
alt_clip = 0

counts = { 'ref_seq' : ref_seq, 'alt_seq' : alt_seq,
'ref_span' : ref_span, 'alt_span' : alt_span,
Expand Down
2 changes: 1 addition & 1 deletion svtyper/version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__author__ = "Colby Chiang (colbychiang@wustl.edu)"
__version__ = "v0.5.2"
__version__ = "v0.6.0"
2 changes: 1 addition & 1 deletion tests/data/example.gt.vcf
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@
2 56652247 82193 G <DEL> 0.00 . TOOL=LUMPY;SVTYPE=DEL;SVLEN=-3645;END=56655892;STR=+-:57;IMPRECISE;CIPOS=-2,18;CIEND=0,0;EVENT=82193;SUP=57;PESUP=57;SRSUP=0;EVTYPE=PE;PRIN GT:GQ:DP:RO:AO:SQ:GL:QR:QA:RS:AS:ASC:RP:AP:AB 0/0:200:129:129:0:0.00:-0,-39,-128:128:0:58:0:0:70:0:0
2 59623256 91676 T <DEL> 821.08 . TOOL=LUMPY;SVTYPE=DEL;SVLEN=-7791;END=59631047;STR=+-:225;CIPOS=0,0;CIEND=0,0;EVENT=91676;SUP=225;PESUP=180;SRSUP=45;EVTYPE=PE,SR;PRIN GT:GQ:DP:RO:AO:SQ:GL:QR:QA:RS:AS:ASC:RP:AP:AB 0/1:200:129:87:41:821.08:-87,-5,-55:86:40:41:10:2:45:27:0.32
2 61880174 92462 C <DEL> 0.00 . TOOL=LUMPY;SVTYPE=DEL;SVLEN=-931;END=61881105;STR=+-:110;CIPOS=0,0;CIEND=0,0;EVENT=92462;SUP=110;PESUP=1;SRSUP=109;EVTYPE=PE,SR;PRIN GT:GQ:DP:RO:AO:SQ:GL:QR:QA:RS:AS:ASC:RP:AP:AB 0/0:200:130:130:0:0.00:-0,-39,-129:129:0:60:0:0:69:0:0
2 62916470 92781 A <DEL> 0.00 . TOOL=LUMPY;SVTYPE=DEL;SVLEN=-5164;END=62921634;STR=+-:32;CIPOS=0,0;CIEND=0,0;EVENT=92781;SUP=32;PESUP=22;SRSUP=10;EVTYPE=PE,SR;PRIN GT:GQ:DP:RO:AO:SQ:GL:QR:QA:RS:AS:ASC:RP:AP:AB 0/0:200:137:136:0:0.00:-0,-41,-135:135:0:60:0:0:75:0:0
2 62916470 92781 A <DEL> 0.00 . TOOL=LUMPY;SVTYPE=DEL;SVLEN=-5164;END=62921634;STR=+-:32;CIPOS=0,0;CIEND=0,0;EVENT=92781;SUP=32;PESUP=22;SRSUP=10;EVTYPE=PE,SR;PRIN GT:GQ:DP:RO:AO:SQ:GL:QR:QA:RS:AS:ASC:RP:AP:AB 0/0:200:136:136:0:0.00:-0,-41,-135:135:0:60:0:0:75:0:0
2 64479691 93866 A <DEL> 0.00 . TOOL=LUMPY;SVTYPE=DEL;SVLEN=-4887;END=64484578;STR=+-:15;IMPRECISE;CIPOS=-1,86;CIEND=0,0;EVENT=93866;SUP=15;PESUP=15;SRSUP=0;EVTYPE=PE;PRIN GT:GQ:DP:RO:AO:SQ:GL:QR:QA:RS:AS:ASC:RP:AP:AB 0/0:200:99:99:0:0.00:-0,-30,-98:98:0:47:0:0:51:0:0
2 66505594 94494 T <DEL> 842.31 . TOOL=LUMPY;SVTYPE=DEL;SVLEN=-1958;END=66507552;STR=+-:235;CIPOS=0,0;CIEND=0,0;EVENT=94494;SUP=235;PESUP=167;SRSUP=68;EVTYPE=PE,SR;PRIN GT:GQ:DP:RO:AO:SQ:GL:QR:QA:RS:AS:ASC:RP:AP:AB 0/1:200:92:53:38:842.31:-86,-2,-29:52:37:24:6:3:28:27:0.42
2 67974877 94992 A <DEL> 0.00 . TOOL=LUMPY;SVTYPE=DEL;SVLEN=-201;END=67975078;STR=+-:10;CIPOS=0,0;CIEND=0,0;EVENT=94992;SUP=10;PESUP=0;SRSUP=10;EVTYPE=SR;PRIN GT:GQ:DP:RO:AO:SQ:GL:QR:QA:RS:AS:ASC:RP:AP:AB 0/0:200:149:148:0:0.00:-0,-44,-147:147:0:71:0:0:76:0:0
Expand Down

0 comments on commit e2b31ae

Please sign in to comment.