Skip to content

Commit

Permalink
Add check that the filtered feature is not supplementary e.g. 2048 flag
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed Feb 16, 2021
1 parent f1acc3c commit 07d4907
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions plugins/linear-comparative-view/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,11 @@ const useStyles = makeStyles(theme => ({
},
}))

function getTag(f: Feature, tag: string) {
const tags = f.get('tags')
return tags ? tags[tag] : f.get(tag)
}

function WindowSizeDlg(props: {
display: any
handleClose: () => void
Expand All @@ -176,10 +181,7 @@ function WindowSizeDlg(props: {
let done = false
;(async () => {
if (preFeature.get('flags') & 2048) {
const SA: string =
(preFeature.get('tags')
? preFeature.get('tags').SA
: preFeature.get('SA')) || ''
const SA: string = getTag(preFeature, 'SA') || ''
const primaryAln = SA.split(';')[0]
const [saRef, saStart] = primaryAln.split(',')
const { rpcManager } = getSession(track)
Expand All @@ -191,7 +193,9 @@ function WindowSizeDlg(props: {
region: { refName: saRef, start: +saStart - 1, end: +saStart },
})) as any[]
const primaryFeat = feats.find(
f => f.get('name') === preFeature.get('name'),
f =>
f.get('name') === preFeature.get('name') &&
!(f.get('flags') & 2048),
)
if (!done) {
setPrimaryFeature(primaryFeat)
Expand All @@ -215,8 +219,7 @@ function WindowSizeDlg(props: {
const clipPos = getClip(cigar, 1)
const flags = feature.get('flags')
const qual = feature.get('qual') as string
const SA: string =
(feature.get('tags') ? feature.get('tags').SA : feature.get('SA')) || ''
const SA: string = getTag(feature, 'SA') || ''
const readName = feature.get('name')
const readAssembly = `${readName}_assembly`
const [trackAssembly] = getConf(track, 'assemblyNames')
Expand All @@ -238,7 +241,7 @@ function WindowSizeDlg(props: {
const saLength = getLength(saCigar)
const saLengthSansClipping = getLengthSansClipping(saCigar)
const saStrandNormalized = saStrand === '-' ? -1 : 1
const saClipPos = getClip(saCigar, 1) // saStrandNormalized)
const saClipPos = getClip(saCigar, 1)
const saRealStart = +saStart - 1
return {
refName: saRef,
Expand Down

0 comments on commit 07d4907

Please sign in to comment.