@@ -47,7 +47,7 @@ class Genome {
47
47
}
48
48
49
49
// For backward compatibility
50
- if ( this . chromosomes . size > 0 ) {
50
+ if ( this . chromosomes . size > 0 ) {
51
51
this . chromosomeNames = Array . from ( this . chromosomes . keys ( ) )
52
52
}
53
53
@@ -59,7 +59,7 @@ class Genome {
59
59
60
60
if ( config . cytobandBbURL ) {
61
61
this . cytobandSource = new CytobandFileBB ( config . cytobandBbURL , Object . assign ( { } , config ) , this )
62
- } else if ( config . cytobandURL ) {
62
+ } else if ( config . cytobandURL ) {
63
63
this . cytobandSource = new CytobandFile ( config . cytobandURL , Object . assign ( { } , config ) )
64
64
}
65
65
@@ -85,7 +85,6 @@ class Genome {
85
85
}
86
86
87
87
88
-
89
88
get description ( ) {
90
89
return this . config . description || `${ this . id } \n${ this . name } `
91
90
}
@@ -143,23 +142,21 @@ class Genome {
143
142
async loadChromosome ( chr ) {
144
143
145
144
if ( ! this . chromosomes . has ( chr ) ) {
145
+ let chromosome
146
146
let sequenceRecord = await this . sequence . getSequenceRecord ( chr )
147
147
if ( sequenceRecord ) {
148
- const chromosome = new Chromosome ( chr , 0 , sequenceRecord . bpLength )
149
- this . chromosomes . set ( chr , chromosome )
148
+ chromosome = new Chromosome ( chr , 0 , sequenceRecord . bpLength )
150
149
} else {
151
150
// Try alias
152
151
if ( this . chromAlias ) {
153
152
const chromAliasRecord = await this . chromAlias . search ( chr )
154
153
if ( chromAliasRecord ) {
155
154
sequenceRecord = await this . sequence . getSequenceRecord ( chromAliasRecord . chr )
156
- const chromosome = new Chromosome ( chromAliasRecord . chr , 0 , sequenceRecord . bpLength )
157
- this . chromosomes . set ( chr , chromosome )
155
+ chromosome = new Chromosome ( chromAliasRecord . chr , 0 , sequenceRecord . bpLength )
158
156
}
159
157
}
160
-
161
- this . chromosomes . set ( chr , undefined ) // Prevents future attempts
162
158
}
159
+ this . chromosomes . set ( chr , chromosome ) // <= chromosome might be undefined, setting it prevents future attempts
163
160
}
164
161
165
162
return this . chromosomes . get ( chr )
0 commit comments