Skip to content

Commit

Permalink
fixup! Require strand in calculateStackPosition
Browse files Browse the repository at this point in the history
  • Loading branch information
victorlin committed Jan 9, 2025
1 parent cad5eb6 commit 28bd3ed
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/util/entropyCreateStateFromJsons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -352,12 +352,13 @@ function calculateStackPosition(
strand: Strand,
): number {
/* List of CDSs, sorted by their earliest occurrence in the genome (for any segment) */
let cdss = genes.reduce((acc: CDS[], gene) => [...acc, ...gene.cds], []);
cdss = cdss.filter((cds) => cds.strand===strand);
cdss.sort((a, b) =>
Math.min(...a.segments.map((s) => s.rangeGenome[0])) < Math.min(...b.segments.map((s) => s.rangeGenome[0])) ?
-1 : 1
);
const cdss = genes
.reduce((acc: CDS[], gene) => [...acc, ...gene.cds], [])
.filter((cds) => cds.strand===strand)
.sort((a, b) =>
Math.min(...a.segments.map((s) => s.rangeGenome[0])) < Math.min(...b.segments.map((s) => s.rangeGenome[0])) ?
-1 : 1
);
let stack: CDS[] = []; // current CDSs in stack
for (const newCds of cdss) {
/* remove any CDS from the stack which has ended (completely) before this one starts */
Expand Down

0 comments on commit 28bd3ed

Please sign in to comment.