From 4a59997308433345caea2722d5e48b4fd8ecb7e3 Mon Sep 17 00:00:00 2001 From: Eric Weitz Date: Thu, 10 Sep 2020 22:47:04 -0400 Subject: [PATCH] Use centromere position ratio, not raw position, to account for small genomes like yeast --- src/js/views/chromosome-model.js | 41 ++++++++++++++++---------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/src/js/views/chromosome-model.js b/src/js/views/chromosome-model.js index fb3fab08..dd42670f 100644 --- a/src/js/views/chromosome-model.js +++ b/src/js/views/chromosome-model.js @@ -130,32 +130,33 @@ function deleteExtraneousBands(chr, hasBands) { function getCentromerePosition(hasBands, bands) { - const hasTelocentricPArm = ( - // As with almost all mouse chromosome, chimpanzee chr22 - hasBands && bands[0].name[0] === 'p' && bands[1].name[0] === 'q' && - bands[0].bp.stop - bands[0].bp.start < 2E6 - ); - - let hasTelocentricQArm = false; - if (hasBands) { - // As with Macaca mulatta chromosome Y - const lastBand = bands.slice(-1)[0]; - const penultimateBand = bands.slice(-2)[0]; + if (hasBands === false) return ''; - hasTelocentricQArm = ( - hasBands && penultimateBand.name[0] === 'p' && lastBand.name[0] === 'q' && - lastBand.bp.stop - lastBand.bp.start < 2E6 - ); - } + // As with Macaca mulatta chromosome Y + const firstBand = bands[0]; + const lastBand = bands.slice(-1)[0]; + const chrLength = lastBand.bp.stop - firstBand.bp.start; + const smallLength = chrLength/10; - if (hasTelocentricPArm) { + if ( // As with almost all mouse chromosome, chimpanzee chr22 + firstBand.name[0] === 'p' && bands[1].name[0] === 'q' && + firstBand.bp.stop - firstBand.bp.start < smallLength + ) { return 'telocentric-p'; - } else if (hasTelocentricQArm) { + } + + const penultimateBand = bands.slice(-2)[0]; + + if ( + penultimateBand.name[0] === 'p' && lastBand.name[0] === 'q' && + lastBand.bp.stop - lastBand.bp.start < smallLength + ) { + // As with Macaca mulatta chromosome Y return 'telocentric-q'; - } else { - return ''; } + + return ''; } /**