Skip to content

Commit

Permalink
Several edits for issue #452
Browse files Browse the repository at this point in the history
  • Loading branch information
dariober committed Oct 30, 2024
1 parent f98e9d6 commit fa7d2a0
Show file tree
Hide file tree
Showing 16 changed files with 602 additions and 374 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ function selectColor(number: number) {
return `hsl(${hue},100%,50%)`
}

function ApolloRendering(props: ApolloRenderingProps) {
async function ApolloRendering(props: ApolloRenderingProps) {
const [contextCoord, setContextCoord] = useState<Coord>()
const [contextMenuFeature, setContextMenuFeature] =
useState<AnnotationFeature>()
Expand Down Expand Up @@ -117,9 +117,7 @@ function ApolloRendering(props: ApolloRenderingProps) {
apolloRowUnderMouse,
changeManager,
codonLayout,
featureLayout,
features,
featuresHeight: totalHeight,
getAssemblyId,
selectedFeature,
setApolloFeatureUnderMouse,
Expand All @@ -129,6 +127,9 @@ function ApolloRendering(props: ApolloRenderingProps) {
showStartCodons: showStarts,
showStopCodons: showStops,
} = displayModel
const featureLayout = await displayModel.getFeatureLayout()
const totalHeight = await displayModel.getFeaturesHeight()

// use this to convince useEffect that the features really did change
const featureSnap = [...features.values()].map((a) =>
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ export const TranscriptBasicInformation = observer(
const { notify } = session as unknown as AbstractSessionModel
const currentAssembly = session.apolloDataStore.assemblies.get(assembly)
const refData = currentAssembly?.getByRefName(refName)
const { changeManager } = session.apolloDataStore
const { changeManager, ontologyManager } = session.apolloDataStore

function handleStartChange(
async function handleStartChange(
newStart: number,
featureId: string,
oldStart: number,
Expand All @@ -103,7 +103,8 @@ export const TranscriptBasicInformation = observer(
// Let's check CDS start and end values. And possibly update those too
for (const child of subFeature.children) {
if (
(child[1].type === 'CDS' || child[1].type === 'exon') &&
((await ontologyManager.isTypeOf(child[1].type, 'CDS')) ||
(await ontologyManager.isTypeOf(child[1].type, 'exon'))) &&
child[1].min === oldStart
) {
const change = new LocationStartChange({
Expand All @@ -122,7 +123,7 @@ export const TranscriptBasicInformation = observer(
return
}

function handleEndChange(
async function handleEndChange(
newEnd: number,
featureId: string,
oldEnd: number,
Expand All @@ -138,7 +139,8 @@ export const TranscriptBasicInformation = observer(
// Let's check CDS start and end values. And possibly update those too
for (const child of subFeature.children) {
if (
(child[1].type === 'CDS' || child[1].type === 'exon') &&
((await ontologyManager.isTypeOf(child[1].type, 'CDS')) ||
(await ontologyManager.isTypeOf(child[1].type, 'exon'))) &&
child[1].max === oldEnd
) {
const change = new LocationEndChange({
Expand Down Expand Up @@ -409,7 +411,8 @@ export const TranscriptBasicInformation = observer(
variant="outlined"
value={item.min}
onChangeCommitted={(newStart: number) => {
handleStartChange(newStart, item.id, Number(item.oldMin))
// handleStartChange returns Promise<void>. Is this ok?
void handleStartChange(newStart, item.id, Number(item.oldMin))
}}
/>
<span style={{ margin: '0 10px' }}>
Expand All @@ -431,7 +434,7 @@ export const TranscriptBasicInformation = observer(
variant="outlined"
value={item.max}
onChangeCommitted={(newEnd: number) => {
handleEndChange(newEnd, item.id, Number(item.oldMax))
void handleEndChange(newEnd, item.id, Number(item.oldMax))
}}
/>
<span style={{ marginLeft: '8px', fontWeight: 'bold' }}>
Expand Down
Loading

0 comments on commit fa7d2a0

Please sign in to comment.