File tree Expand file tree Collapse file tree 5 files changed +19
-8
lines changed Expand file tree Collapse file tree 5 files changed +19
-8
lines changed Original file line number Diff line number Diff line change 17
17
</ option >
18
18
< option value ="https://hgdownload.soe.ucsc.edu/hubs/GCF/013/103/735/GCF_013103735.1/hub.txt "> 24 large chromosomes
19
19
</ option >
20
- < option value ="https://hgdownload.soe.ucsc.edu/hubs/GCA/009/914/755/GCA_009914755.4/hub.txt "> T2T</ option >
20
+ < option value =""> T2T</ option >
21
21
</ select >
22
22
23
23
< label >
43
43
includeTracks : true
44
44
}
45
45
46
- const hub = await Hub . loadHub ( "https://hgdownload.soe.ucsc.edu/hubs/GCA/009/914/755/GCA_009914755.4/hub.txt " , hubOptions )
46
+ const hub = await Hub . loadHub ( "" , hubOptions )
47
47
48
48
const igvConfig = {
49
49
reference : hub . getGenomeConfig ( ) ,
Original file line number Diff line number Diff line change @@ -100,7 +100,8 @@ export default class Trix {
100
100
const indexes = await this . getIndex ( opts )
101
101
for ( let i = 0 ; i < indexes . length ; i ++ ) {
102
102
const [ key , value ] = indexes [ i ]
103
- const trimmedKey = key . slice ( 0 , searchWord . length )
103
+ const trimmedEnd = Math . min ( key . length , searchWord . length )
104
+ const trimmedKey = key . slice ( 0 , trimmedEnd )
104
105
if ( trimmedKey < searchWord ) {
105
106
start = value
106
107
end = value + 65536
Original file line number Diff line number Diff line change @@ -5,6 +5,13 @@ import ChromSizes from "./chromSizes.js"
5
5
import Twobit from "./twobit.js"
6
6
import CachedSequence from "./cachedSequence.js"
7
7
8
+ /**
9
+ * Create a sequence object. The referenced object can include multiple sequence references, in particular
10
+ * fasta and 2bit URLs. This is for backward compatibility, the 2bit URL has preference.
11
+ *
12
+ * @param reference
13
+ * @returns {Promise<CachedSequence|ChromSizes|NonIndexedFasta> }
14
+ */
8
15
async function loadSequence ( reference ) {
9
16
10
17
let fasta
Original file line number Diff line number Diff line change @@ -42,12 +42,12 @@ class Genome {
42
42
43
43
this . sequence = await loadSequence ( config )
44
44
45
- if ( config . chromSizes ) {
45
+ if ( config . chromSizesURL ) {
46
46
// a chromSizes file is neccessary for 2bit sequences for whole-genome view or chromosome pulldown
47
- this . chromosomes = await loadChromSizes ( config . chromSizes )
47
+ this . chromosomes = await loadChromSizes ( config . chromSizesURL )
48
48
} else {
49
49
// if the sequence defines chromosomes use them (fasta does, 2bit does not)
50
- this . chromosomes = this . sequence . chromosomes || new Map ( ) // This might be undefined, depending on sequence type
50
+ this . chromosomes = this . sequence . chromosomes || new Map ( )
51
51
}
52
52
53
53
if ( this . chromosomes . size > 0 ) {
@@ -144,9 +144,8 @@ class Genome {
144
144
145
145
async loadChromosome ( chr ) {
146
146
147
- let chromAliasRecord
148
147
if ( this . chromAlias ) {
149
- chromAliasRecord = await this . chromAlias . search ( chr )
148
+ const chromAliasRecord = await this . chromAlias . search ( chr )
150
149
if ( chromAliasRecord ) {
151
150
chr = chromAliasRecord . chr
152
151
}
Original file line number Diff line number Diff line change @@ -14,10 +14,14 @@ suite("ucsc utilities", function () {
14
14
const trix = new Trix ( ixxFile , ixFile )
15
15
const results = await trix . search ( "ykoX" )
16
16
assert . ok ( results )
17
+
17
18
const exactMatches = results . get ( 'ykox' )
18
19
assert . ok ( exactMatches )
19
20
assert . ok ( exactMatches [ 0 ] . startsWith ( 'NP_389226.1' ) )
20
21
console . log ( results )
22
+
23
+ const nomatches = await trix . search ( "zzzz" ) ;
24
+ assert . isUndefined ( nomatches ) ;
21
25
} )
22
26
23
27
test ( "test gene bb extra index search" , async function ( ) {
You can’t perform that action at this time.
0 commit comments