Skip to content
Snippets Groups Projects
Commit 6ae3d411 authored by Alexander Rose's avatar Alexander Rose
Browse files

added StructureElement.Loci.toStructure

parent c34e1be4
No related branches found
No related tags found
No related merge requests found
...@@ -78,6 +78,17 @@ export namespace Loci { ...@@ -78,6 +78,17 @@ export namespace Loci {
return Loci(structure, []); return Loci(structure, []);
} }
export function toStructure(loci: Loci): Structure {
const units: Unit[] = []
for (const e of loci.elements) {
const { unit, indices } = e
const elements = new Int32Array(OrderedSet.size(indices))
OrderedSet.forEach(indices, (v, i) => elements[i] = unit.elements[v])
units.push(unit.getChild(SortedArray.ofSortedArray(elements)))
}
return Structure.create(units, { parent: loci.structure.parent })
}
export function remap(loci: Loci, structure: Structure): Loci { export function remap(loci: Loci, structure: Structure): Loci {
if (structure === loci.structure) return loci if (structure === loci.structure) return loci
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment