Skip to content

Commit

Permalink
Require strand in calculateStackPosition
Browse files Browse the repository at this point in the history
The function is only used in two places, both of which specify a valid
strand value.
  • Loading branch information
victorlin committed Jan 6, 2025
1 parent 170c6f5 commit cad5eb6
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/util/entropyCreateStateFromJsons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -349,13 +349,11 @@ function _frame(
*/
function calculateStackPosition(
genes: Gene[],
strand: Strand | null = null,
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], []);
if (strand) {
cdss = cdss.filter((cds) => cds.strand===strand);
}
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
Expand Down

0 comments on commit cad5eb6

Please sign in to comment.