Skip to content

Commit 358c4f8

Browse files
author
josh
committed
Fix rendering of distinct compSeqs
1 parent 46ee7fa commit 358c4f8

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

src/SeqViz.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ export default class SeqViz extends React.Component<SeqVizProps, SeqVizState> {
294294
seq: string;
295295
seqType: SeqType;
296296
} => {
297-
const { annotations, file, name = "", seq } = props || this.props;
297+
const { annotations, compSeq, file, name = "", seq } = props || this.props;
298298

299299
if (file) {
300300
// Parse a sequence file
@@ -319,7 +319,7 @@ export default class SeqViz extends React.Component<SeqVizProps, SeqVizState> {
319319
const seqType = guessType(seq);
320320
return {
321321
annotations: this.parseAnnotations(annotations, seq),
322-
compSeq: complement(seq, seqType).compSeq,
322+
compSeq: compSeq || complement(seq, seqType).compSeq,
323323
name,
324324
seq,
325325
seqType,

src/index.test.tsx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,4 +89,25 @@ describe("SeqViz rendering (React)", () => {
8989
expect(getAllByTestId("la-vz-selection-block")).toBeTruthy();
9090
expect(getAllByTestId("la-vz-selection-edge")).toHaveLength(1);
9191
});
92+
93+
// https://github.com/Lattice-Automation/seqviz/issues/203
94+
it("renders a distinct compSeq", () => {
95+
const seq = "ATGC";
96+
const compSeq = "00TA";
97+
98+
const { getAllByTestId } = render(
99+
<SeqViz {...props} compSeq={compSeq} selection={{ end: 15, start: 1 }} seq={seq} viewer="linear" />
100+
);
101+
expect(getAllByTestId("la-vz-seqviz")).toBeTruthy();
102+
103+
const seqValue = getAllByTestId("la-vz-seq")
104+
.map(s => s.textContent)
105+
.join("");
106+
const compSeqValue = getAllByTestId("la-vz-comp-seq")
107+
.map(s => s.textContent)
108+
.join("");
109+
110+
expect(seqValue).toEqual(seq);
111+
expect(compSeqValue).toEqual(compSeq);
112+
});
92113
});

0 commit comments

Comments
 (0)