@@ -34,19 +34,34 @@ interface CreateApolloAnnotationProps {
3434 refSeqId : string
3535}
3636
37- // TODO: Integrate SO
38- const isGeneOrTranscript = ( annotationFeature : AnnotationFeatureSnapshot ) => {
37+ const isGeneOrTranscript = (
38+ annotationFeature : AnnotationFeatureSnapshot ,
39+ apolloSessionModel : ApolloSessionModel ,
40+ ) => {
41+ const { featureTypeOntology } =
42+ apolloSessionModel . apolloDataStore . ontologyManager
43+ if ( ! featureTypeOntology ) {
44+ throw new Error ( 'featureTypeOntology is undefined' )
45+ }
3946 return (
40- annotationFeature . type === 'gene' ||
41- annotationFeature . type === 'mRNA' ||
42- annotationFeature . type === 'transcript'
47+ featureTypeOntology . isTypeOf ( annotationFeature . type , 'gene' ) ||
48+ featureTypeOntology . isTypeOf ( annotationFeature . type , 'mRNA' ) ||
49+ featureTypeOntology . isTypeOf ( annotationFeature . type , 'transcript' )
4350 )
4451}
4552
46- // TODO: Integrate SO
47- const isTranscript = ( annotationFeature : AnnotationFeatureSnapshot ) => {
53+ const isTranscript = (
54+ annotationFeature : AnnotationFeatureSnapshot ,
55+ apolloSessionModel : ApolloSessionModel ,
56+ ) => {
57+ const { featureTypeOntology } =
58+ apolloSessionModel . apolloDataStore . ontologyManager
59+ if ( ! featureTypeOntology ) {
60+ throw new Error ( 'featureTypeOntology is undefined' )
61+ }
4862 return (
49- annotationFeature . type === 'mRNA' || annotationFeature . type === 'transcript'
63+ featureTypeOntology . isTypeOf ( annotationFeature . type , 'mRNA' ) ||
64+ featureTypeOntology . isTypeOf ( annotationFeature . type , 'transcript' )
5065 )
5166}
5267
@@ -109,7 +124,7 @@ export function CreateApolloAnnotation({
109124 const checkedAnnotationFeatureChildren = Object . values (
110125 annotationFeature . children ,
111126 )
112- . filter ( ( child ) => isTranscript ( child ) )
127+ . filter ( ( child ) => isTranscript ( child , apolloSessionModel ) )
113128 . filter ( ( child ) => checkedChildrens . includes ( child . _id ) )
114129 const mins = checkedAnnotationFeatureChildren . map ( ( f ) => f . min )
115130 const maxes = checkedAnnotationFeatureChildren . map ( ( f ) => f . max )
@@ -202,7 +217,7 @@ export function CreateApolloAnnotation({
202217 </ DialogTitle >
203218 < DialogContent >
204219 < Box sx = { { ml : 3 } } >
205- { isGeneOrTranscript ( annotationFeature ) && (
220+ { isGeneOrTranscript ( annotationFeature , apolloSessionModel ) && (
206221 < FormControlLabel
207222 control = {
208223 < Checkbox
@@ -217,7 +232,7 @@ export function CreateApolloAnnotation({
217232 { annotationFeature . children && (
218233 < Box sx = { { display : 'flex' , flexDirection : 'column' , ml : 3 } } >
219234 { Object . values ( annotationFeature . children )
220- . filter ( ( child ) => isTranscript ( child ) )
235+ . filter ( ( child ) => isTranscript ( child , apolloSessionModel ) )
221236 . map ( ( child ) => (
222237 < FormControlLabel
223238 key = { child . _id }
0 commit comments