@@ -484,6 +484,11 @@ export default function vcfiobio(theGlobalApp) {
484484 return str . indexOf ( suffix , str . length - suffix . length ) !== - 1 ;
485485 }
486486
487+ function isIntegerString ( str ) {
488+ const num = parseInt ( str , 10 ) ;
489+ return ! isNaN ( num ) && num . toString ( ) === str ;
490+ }
491+
487492 exports . setSamples = function ( sampleNames ) {
488493 samples = sampleNames ;
489494 }
@@ -3402,14 +3407,25 @@ exports._parseClinInfoDeprecated = function(rec, clinvarMap) {
34023407 }
34033408
34043409
3405-
3410+ //
34063411 // Only keep the alt if we have a genotype that matches.
34073412 // For example
3408- // A->G 0|1 keep
3409- // A->G,C 0|1 keep A->G, but bypass A->C
3410- // A->G,C 0|2 bypass A->G, keep A->C
3411- // A->G,C 1|2 keep A->G, keep A->C
3412- // unknown . bypass
3413+ // A->G 0|1 keep (phased)
3414+ // A->G 0/1 keep (unphased)
3415+ // A->G 0/0 bypass (homozygous ref for this sample)
3416+ //
3417+ // multi-allelic
3418+ // A->G,C 0|1 keep A->G, but bypass A->C
3419+ // A->G,C 0|2 bypass A->G, keep A->C
3420+ // A->G,C 1|2 keep A->G, keep A->C
3421+ //
3422+ // non-diploid
3423+ // A->G 1 keep (homozygous alt non-diploid)
3424+ // A->G 0 bypass (homozygous ref non-diploid)
3425+ //
3426+ // unspecified
3427+ // A->G . bypass (assumed homozygousref)
3428+ //
34133429 var delim = null ;
34143430
34153431 if ( gt . gt . indexOf ( "|" ) > 0 ) {
@@ -3421,6 +3437,20 @@ exports._parseClinInfoDeprecated = function(rec, clinvarMap) {
34213437 } else if ( gt . gt == "." ) {
34223438 gt . keep = false ;
34233439 gt . zygosity = "HOMREF" ;
3440+ } else if ( isIntegerString ( gt . gt ) && parseInt ( gt . gt , 10 ) == 0 ) {
3441+ // when a single number is present, this is a non-diploid genotype
3442+ // when set to 0, this is homozygous ref
3443+ gt . keep = false ;
3444+ gt . zygosity = "HOMREF" ;
3445+ } else if ( isIntegerString ( gt . gt ) && parseInt ( gt . gt , 10 ) > 0 ) {
3446+ // when a single number is present, this is a non-diploid genotype
3447+ // when >= to 1 , this is homozygous alt
3448+ gt . keep = true ;
3449+ gt . zygosity = "HOM" ;
3450+ if ( isEduMode ) {
3451+ gt . eduGenotype = rec . ref + " " + alt ;
3452+ gt . eduGenotypeReversed = globalApp . utility . switchGenotype ( gt . eduGenotype ) ;
3453+ }
34243454 } else {
34253455 gt . keep = false ;
34263456 gt . zygosity = "gt_unknown" ;
0 commit comments