Skip to content

Commit

Permalink
Improve UNF Viewer to support rendering of circular strands
Browse files Browse the repository at this point in the history
  • Loading branch information
davous267 committed Apr 7, 2022
1 parent d3fc57e commit 570882f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions unf-web-viewer/js/unf_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,7 @@ function processSingleStrands(parsedJson, naStrands, objectsParent, fileIdToFile
(strand.isScaffold === true ? "scaf" : "stap") + ") with " + strand.nucleotides.length + " nts.\n";

let currNucleotide = strand.nucleotides.find(x => x.id === strand.fivePrimeId);
const startNucleotide = currNucleotide;
do {
// If nucleotide has an alternative position defined, use it as a primary source of position
if (currNucleotide.altPositions.length > 0) {
Expand Down Expand Up @@ -471,14 +472,15 @@ function processSingleStrands(parsedJson, naStrands, objectsParent, fileIdToFile

currNucleotide = strand.nucleotides.find(x => x.id === currNucleotide.next);
}
while (currNucleotide !== undefined);
while (currNucleotide !== undefined && currNucleotide !== startNucleotide);

const strandParent = new THREE.Object3D();
objectsParent.add(strandParent);

if (nucleotidePositions.length > 0) {
const geometry = new THREE.BufferGeometry().setFromPoints(nucleotidePositions);
const strandLine = new THREE.Line(geometry, lineMaterial);
const LineClass = startNucleotide === currNucleotide ? THREE.LineLoop : THREE.Line;
const strandLine = new LineClass(geometry, lineMaterial);
(nucleotideParents.length > 0 ? nucleotideParents[0] : strandParent).add(strandLine);

for (let i = 0; i < nucleotidePositions.length; ++i) {
Expand Down

0 comments on commit 570882f

Please sign in to comment.