-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feedback ontology loading #482
base: main
Are you sure you want to change the base?
Changes from all commits
51b1ded
5c8a19f
a59fef7
c6157ef
9cf7e4d
20313b7
6ebba39
a4c195b
bd97982
d902170
2c20b2a
55b63ac
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import { intersection2 } from '@jbrowse/core/util' | ||
import { getSession, intersection2 } from '@jbrowse/core/util' | ||
import { | ||
IAnyModelType, | ||
IMSTMap, | ||
|
@@ -127,7 +127,14 @@ export const AnnotationFeatureModel = types | |
return false | ||
}, | ||
get transcriptParts(): TranscriptParts[] { | ||
if (self.type !== 'mRNA') { | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-explicit-any | ||
const session = getSession(self) as any | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I thought about that but I couldn't import |
||
const { apolloDataStore } = session | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access | ||
const { featureTypeOntology } = apolloDataStore.ontologyManager | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access | ||
if (!featureTypeOntology.isTypeOf(self.type, 'mRNA')) { | ||
throw new Error( | ||
'Only features of type "mRNA" or equivalent can calculate CDS locations', | ||
) | ||
|
@@ -137,7 +144,8 @@ export const AnnotationFeatureModel = types | |
throw new Error('no CDS or exons in mRNA') | ||
} | ||
const cdsChildren = [...children.values()].filter( | ||
(child) => child.type === 'CDS', | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access | ||
(child) => featureTypeOntology.isTypeOf(child.type, 'CDS'), | ||
) | ||
if (cdsChildren.length === 0) { | ||
throw new Error('no CDS in mRNA') | ||
|
@@ -149,7 +157,8 @@ export const AnnotationFeatureModel = types | |
let hasIntersected = false | ||
const exonLocations: TranscriptPartLocation[] = [] | ||
for (const [, child] of children) { | ||
if (child.type === 'exon') { | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access | ||
if (featureTypeOntology.isTypeOf(child.type, 'exon')) { | ||
exonLocations.push({ min: child.min, max: child.max }) | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reuse eslint directives by moving them to top of file