@@ -84,31 +84,32 @@ export default class AllVsAllPAFAdapter extends BaseFeatureDataAdapter {
84
84
getFeatures ( query : Region , opts : PAFOptions = { } ) {
85
85
return ObservableCreate < Feature > ( async observer => {
86
86
let pafRecords = await this . setup ( opts )
87
- const { config } = opts
88
87
89
88
// note: this is not the adapter config, it is responding to a display
90
89
// setting passed in via the opts parameter
91
- if ( config && readConfObject ( config , 'colorBy' ) === 'meanQueryIdentity' ) {
90
+ if (
91
+ opts . config &&
92
+ readConfObject ( opts . config , 'colorBy' ) === 'meanQueryIdentity'
93
+ ) {
92
94
pafRecords = getWeightedMeans ( pafRecords )
93
95
}
94
96
const assemblyNames = this . getAssemblyNames ( )
95
97
96
98
// The index of the assembly name in the query list corresponds to the
97
99
// adapter in the subadapters list
98
- const { start : qstart , end : qend , refName : qref , assemblyName } = query
99
- const index = assemblyNames . indexOf ( assemblyName )
100
+ const index = assemblyNames . indexOf ( query . assemblyName )
100
101
101
102
// if the getFeatures::query is on the query assembly, flip orientation
102
103
// of data
103
104
const flip = index === 0
104
105
if ( index === - 1 ) {
105
- console . warn ( `${ assemblyName } not found in this adapter` )
106
+ console . warn ( `${ query . assemblyName } not found in this adapter` )
106
107
observer . complete ( )
107
108
}
108
109
109
- // eslint-disable-next-line unicorn/no-for-loop
110
- for ( let i = 0 ; i < pafRecords . length ; i ++ ) {
111
- const r = pafRecords [ i ] !
110
+ const len = pafRecords . length
111
+ for ( let i = 0 ; i < len ; i ++ ) {
112
+ const currentPafRecord = pafRecords [ i ] !
112
113
let start = 0
113
114
let end = 0
114
115
let refName = ''
@@ -117,22 +118,26 @@ export default class AllVsAllPAFAdapter extends BaseFeatureDataAdapter {
117
118
let mateEnd = 0
118
119
119
120
if ( flip ) {
120
- start = r . qstart
121
- end = r . qend
122
- refName = r . qname
123
- mateName = r . tname
124
- mateStart = r . tstart
125
- mateEnd = r . tend
121
+ start = currentPafRecord . qstart
122
+ end = currentPafRecord . qend
123
+ refName = currentPafRecord . qname
124
+ mateName = currentPafRecord . tname
125
+ mateStart = currentPafRecord . tstart
126
+ mateEnd = currentPafRecord . tend
126
127
} else {
127
- start = r . tstart
128
- end = r . tend
129
- refName = r . tname
130
- mateName = r . qname
131
- mateStart = r . qstart
132
- mateEnd = r . qend
128
+ start = currentPafRecord . tstart
129
+ end = currentPafRecord . tend
130
+ refName = currentPafRecord . tname
131
+ mateName = currentPafRecord . qname
132
+ mateStart = currentPafRecord . qstart
133
+ mateEnd = currentPafRecord . qend
133
134
}
134
- const { extra, strand } = r
135
- if ( refName === qref && doesIntersect2 ( qstart , qend , start , end ) ) {
135
+ const { extra, strand } = currentPafRecord
136
+ const refName2 = refName . replace ( `${ query . assemblyName } #1#` , '' )
137
+ if (
138
+ refName2 === query . refName &&
139
+ doesIntersect2 ( query . start , query . end , start , end )
140
+ ) {
136
141
const { numMatches = 0 , blockLen = 1 , cg, ...rest } = extra
137
142
138
143
let CIGAR = extra . cg
@@ -146,12 +151,12 @@ export default class AllVsAllPAFAdapter extends BaseFeatureDataAdapter {
146
151
147
152
observer . next (
148
153
new SyntenyFeature ( {
149
- uniqueId : i + assemblyName ,
150
- assemblyName,
154
+ uniqueId : i + query . assemblyName ,
155
+ assemblyName : query . assemblyName ,
151
156
start,
152
157
end,
153
158
type : 'match' ,
154
- refName,
159
+ refName : refName2 ,
155
160
strand,
156
161
...rest ,
157
162
CIGAR ,
0 commit comments