@@ -1898,7 +1898,11 @@ Ideogram.prototype.drawChromosomeLabels = function() {
18981898 lines = d . name . match ( / ^ ( .* ) \s + ( [ ^ \s ] + ) $ / ) . slice ( 1 ) . reverse ( ) ;
18991899 }
19001900
1901- if ( 'sex' in ideo . config && i === ideo . sexChromosomes . index ) {
1901+ if (
1902+ 'sex' in ideo . config &&
1903+ ideo . config . ploidy === 2 &&
1904+ i === ideo . sexChromosomes . index
1905+ ) {
19021906 if ( ideo . config . sex === 'male' ) {
19031907 lines = [ 'XY' ] ;
19041908 } else {
@@ -3446,10 +3450,6 @@ Ideogram.prototype.initDrawChromosomes = function(bandsArray) {
34463450 ideo . chromosomes [ taxid ] = { } ;
34473451
34483452 ideo . setSexChromosomes ( chrs ) ;
3449- // if ('sex' in ideo.config && ideo.config.sex === 'male') {
3450- // chrs.splice(ideo.sexChromosomes.index, 1);
3451- // ideo.config.chromosomes[taxid] = chrs;
3452- // }
34533453
34543454 for ( j = 0 ; j < chrs . length ; j ++ ) {
34553455 chromosome = chrs [ j ] ;
@@ -3461,7 +3461,13 @@ Ideogram.prototype.initDrawChromosomes = function(bandsArray) {
34613461 ideo . chromosomes [ taxid ] [ chromosome ] = chrModel ;
34623462 ideo . chromosomesArray . push ( chrModel ) ;
34633463
3464- if ( 'sex' in ideo . config && ideo . sexChromosomes . index + 2 === chrIndex ) {
3464+ if (
3465+ 'sex' in ideo . config &&
3466+ (
3467+ ideo . config . ploidy === 2 && ideo . sexChromosomes . index + 2 === chrIndex ||
3468+ ideo . config . sex === 'female' && chrModel . name === 'Y'
3469+ )
3470+ ) {
34653471 continue ;
34663472 }
34673473
@@ -3476,7 +3482,11 @@ Ideogram.prototype.initDrawChromosomes = function(bandsArray) {
34763482 . attr ( "transform" , transform )
34773483 . attr ( "id" , chrModel . id + "-chromosome-set" ) ;
34783484
3479- if ( 'sex' in ideo . config && ideo . sexChromosomes . index + 1 === chrIndex ) {
3485+ if (
3486+ 'sex' in ideo . config &&
3487+ ideo . config . ploidy === 2 &&
3488+ ideo . sexChromosomes . index + 1 === chrIndex
3489+ ) {
34803490 ideo . drawSexChromosomes ( bandsArray , taxid , container , defs , j , chrs ) ;
34813491 continue ;
34823492 }
@@ -3533,7 +3543,7 @@ Ideogram.prototype.setSexChromosomes = function(chrs) {
35333543 // https://en.wikipedia.org/wiki/Category:Sex_chromosome_aneuploidies
35343544
35353545
3536- if ( ! this . config . sex ) return ;
3546+ if ( this . config . ploidy !== 2 || ! this . config . sex ) return ;
35373547
35383548 var ideo = this ,
35393549 sexChrs = { 'X' : 1 , 'Y' : 1 } ,
0 commit comments