Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
holtgrewe committed Sep 27, 2022
1 parent 253e0c6 commit 774adf7
Showing 1 changed file with 72 additions and 68 deletions.
140 changes: 72 additions & 68 deletions varfish/vueapp/src/components/SubmissionList.vue
Expand Up @@ -380,6 +380,7 @@ export default {
fetchError: false,
rawModalUserAnnotations: null,
rawModalUserAnnotationsCount: 0,
modalUserAnnotations: [],
selectedSmallVariants: [],
}
},
Expand Down Expand Up @@ -411,74 +412,6 @@ export default {
this.applySubmissionListSortOrder(value)
},
},
/**
* Return filtered data to display in the annotated variant modal.
*/
modalUserAnnotations() {
const c = 300000000 // longer than longest chromosome
const ua = this.rawModalUserAnnotations
if (!ua) {
return []
}
const smallVariants = Object.values(ua.smallVariants)
.map((smallVar) => {
const flags = ua.smallVariantFlags[smallVar.variantId] || []
const rating = ua.acmgCriteriaRating[smallVar.variantId] || []
const comments = ua.smallVariantComments[smallVar.variantId] || []
return { ...smallVar, flags, rating, comments }
})
.filter((smallVar) => {
if (this.individualFilter) {
if (
!smallVar.caseNames.some((s) => s.includes(this.individualFilter))
) {
return false
}
}
if (this.modalIncludeAll) {
return true
} else if (
this.modalIncludeComments &&
smallVar.comments.length > 0
) {
return true
} else if (
this.modalIncludeCandidates &&
smallVar.flags.some((x) => x.flag_candidate)
) {
return true
} else if (
this.modalIncludeFinalCausatives &&
smallVar.flags.some((x) => x.flag_final_causative)
) {
return true
} else if (
this.modalIncludeAcmg3 &&
this.getAcmgRating(smallVar) >= 3
) {
return true
} else if (
this.modalIncludeAcmg4 &&
this.getAcmgRating(smallVar) >= 4
) {
return true
} else if (
this.modalIncludeAcmg5 &&
this.getAcmgRating(smallVar) >= 5
) {
return true
} else {
return false
}
})
smallVariants.sort(
(a, b) =>
a.chromosome_no * c + a.start - (b.chromosome_no * c + b.start)
)
return smallVariants
},
},
methods: {
...mapActions('clinvarExport', [
Expand All @@ -492,6 +425,7 @@ export default {
*/
fetchRawModalUserAnnotations() {
if (this.familyUuid) {
this.modalUserAnnotations.splice(0, this.modalUserAnnotations.length)
this.fetchError = false
this.loadingVariants = true
Vue.set(this, 'rawModalUserAnnotations', null)
Expand Down Expand Up @@ -556,6 +490,8 @@ export default {
'rawModalUserAnnotationsCount',
Object.keys(smallVariants).length
)
const userAnnotations = this._computeUserAnnotations(this.rawModalUserAnnotations)
Array.prototype.push.apply(this.modalUserAnnotations, userAnnotations);
this.loadingVariants = false
})
.catch((error) => {
Expand All @@ -566,6 +502,74 @@ export default {
}
},
/**
* Return filtered data to display in the annotated variant modal.
*/
_computeUserAnnotations(ua) {
const c = 300000000 // longer than longest chromosome
if (!ua) {
return []
}
const smallVariants = Object.values(ua.smallVariants)
.map((smallVar) => {
const flags = ua.smallVariantFlags[smallVar.variantId] || []
const rating = ua.acmgCriteriaRating[smallVar.variantId] || []
const comments = ua.smallVariantComments[smallVar.variantId] || []
return { ...smallVar, flags, rating, comments }
})
.filter((smallVar) => {
if (this.individualFilter) {
if (
!smallVar.caseNames.some((s) => s.includes(this.individualFilter))
) {
return false
}
}
if (this.modalIncludeAll) {
return true
} else if (
this.modalIncludeComments &&
smallVar.comments.length > 0
) {
return true
} else if (
this.modalIncludeCandidates &&
smallVar.flags.some((x) => x.flag_candidate)
) {
return true
} else if (
this.modalIncludeFinalCausatives &&
smallVar.flags.some((x) => x.flag_final_causative)
) {
return true
} else if (
this.modalIncludeAcmg3 &&
this.getAcmgRating(smallVar) >= 3
) {
return true
} else if (
this.modalIncludeAcmg4 &&
this.getAcmgRating(smallVar) >= 4
) {
return true
} else if (
this.modalIncludeAcmg5 &&
this.getAcmgRating(smallVar) >= 5
) {
return true
} else {
return false
}
})
smallVariants.sort(
(a, b) =>
a.chromosome_no * c + a.start - (b.chromosome_no * c + b.start)
)
return smallVariants
},
toggleData(name) {
this.$set(this, name, !this[name])
},
Expand Down

0 comments on commit 774adf7

Please sign in to comment.