@@ -806,21 +806,24 @@ export default {
806806 }
807807 },
808808 depthVizRegionGlyph : function (exon , regionGroup , regionX , modelName ) {
809- let exonId = ' exon' + exon .exon_number .replace (" /" , " -" );
810- if (regionGroup .select (" g#" + exonId).empty ()) {
811- regionGroup .append (' g' )
812- .attr (" id" , exonId)
813- .attr (' class' , ' region-glyph coverage-problem-glyph' )
814- .attr (" modelName" , modelName)
815- .attr (' transform' , ' translate(' + (regionX - 6 ) + ' ,-6)' )
816- .data ([exon])
817- .append (' use' )
818- .attr (' height' , ' 16' )
819- .attr (' width' , ' 16' )
820- .attr (' href' , ' #coverage-problem-symbol' )
821- .attr (' xlink' ,' http://www.w3.org/1999/xlink' )
822- .data ([exon])
823- .attr (" modelName" , this .sampleModel .name );
809+ if (exon .hasOwnProperty (' exon_number' ) && exon .exon_number && exon .exon_number .length > 0 ) {
810+ let exonId = ' exon' + exon .exon_number .replace (" /" , " -" );
811+ if (regionGroup .select (" g#" + exonId).empty ()) {
812+ regionGroup .append (' g' )
813+ .attr (" id" , exonId)
814+ .attr (' class' , ' region-glyph coverage-problem-glyph' )
815+ .attr (" modelName" , modelName)
816+ .attr (' transform' , ' translate(' + (regionX - 6 ) + ' ,-6)' )
817+ .data ([exon])
818+ .append (' use' )
819+ .attr (' height' , ' 16' )
820+ .attr (' width' , ' 16' )
821+ .attr (' href' , ' #coverage-problem-symbol' )
822+ .attr (' xlink' ,' http://www.w3.org/1999/xlink' )
823+ .data ([exon])
824+ .attr (" modelName" , this .sampleModel .name );
825+ }
826+
824827 }
825828 },
826829 onVariantClick : function (variant , model ) {
@@ -1086,19 +1089,22 @@ export default {
10861089 const matchingVariants = self .sampleModel .loadedVariants .features .filter (function (v ) {
10871090 return v .start === variant .start && v .alt === variant .alt && v .ref === variant .ref ;
10881091 })
1092+ let theDepthSource = " genotype_depth"
10891093 if (matchingVariants .length > 0 ) {
1090- theDepth = matchingVariants[0 ].bamDepth ;
1091- // If samtools mpileup didn't return coverage for this position, use the variant's depth field
1094+ theDepth = matchingVariants[0 ].genotypeDepth ;
1095+ // If we don't have the read count from the genotype depth on the variant,
1096+ // use the average base coverage (from samtools pileup) that was calculated for this position
10921097 if (theDepth == null || theDepth === ' ' ) {
1093- theDepth = matchingVariants[0 ].genotypeDepth ;
1098+ theDepth = matchingVariants[0 ].bamDepth ;
1099+ theDepthSource = " average_base_coverage"
10941100 }
10951101 if (matchingVariants[0 ].genotype && matchingVariants[0 ].genotype .altCount ) {
10961102 theAltCount = matchingVariants[0 ].genotype .altCount ;
10971103 }
10981104 }
10991105 // If we have the exact depth for this variant, show it. Otherwise, we will show
11001106 // the calculated (binned, averaged) depth at this position.
1101- let currentPoint = {pos: variant .start , depth: theDepth, altCount : theAltCount }
1107+ let currentPoint = {pos: variant .start , depth: theDepth, depthSource : theDepthSource }
11021108 self .$refs .depthVizRef .showCurrentPoint (currentPoint);
11031109 }
11041110 self .showCoverageCircleOther (variant);
0 commit comments