Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
- change `annotation` to `primer` on component ids
- fix typos

Co-authored-by: Joshua Timmons <[email protected]>
  • Loading branch information
isaacguerreir and jjti authored Nov 22, 2023
1 parent da9a85e commit 1108a68
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,12 @@ In the example above, the "Strong promoter" would span the first to twenty-secon

#### `primers (=[])`

An array of `Primer`s to render. Each `Primer` requires 0-based start (inclusive) and end (exclusive) indexes. `name`s are rendered on top of the annotations. Set the primer's direction to `1` for forward primer and `-1` for reverse primer.
An array of `Primer`s to render. Each `Primer` requires 0-based start (inclusive) and end (exclusive) indexes. `name`s are rendered on top of the primers. Set the primer's direction to `1` for forward primer and `-1` for reverse primer.

```js
primers = [
{ start: 33, end: 53, name: "LacZ Foward Primer", direction: 1 },
{ id: "18fbd562-9f87-4a17-aa20-b8448538cbe6", start: 3098, end: 3128, name: "LacZ Reverse Primer", direction: -1, color: "#FAA887" },
{ start: 3098, end: 3128, name: "LacZ Reverse Primer", direction: -1, color: "#FAA887" },
];
```

Expand Down
9 changes: 5 additions & 4 deletions src/Linear/Primers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const PrimeRows = (props: {
<g>
{props.primerRows.map((primers: NameRange[], i: number) => (
<PrimerRow
key={`annotation-linear-row-${primers[0].id}-${props.firstBase}-${props.lastBase}`}
key={`primer-linear-row-${primers[0].id}-${props.firstBase}-${props.lastBase}`}
bpsPerBlock={props.bpsPerBlock}
direction={props.direction}
findXAndWidth={props.findXAndWidth}
Expand Down Expand Up @@ -75,7 +75,7 @@ const PrimerRow = (props: {
}) => {
return (
<g
className="la-vz-linear-annotation-row"
className="la-vz-linear-primer-row"
height={props.height * 0.8}
transform={`translate(0, ${props.y})`}
width={props.width}
Expand All @@ -84,8 +84,8 @@ const PrimerRow = (props: {
.filter(a => a.direction == props.direction)
.map((a, i) => (
<SingleNamedElement
{...props} // include overflowLeft in the key to avoid two split annotations in the same row from sharing a key
key={`annotation-linear-${a.id}-${i}-${props.firstBase}-${props.lastBase}`}
{...props} // include overflowLeft in the key to avoid two split primers in the same row from sharing a key
key={`primer-linear-${a.id}-${i}-${props.firstBase}-${props.lastBase}`}
element={a}
elements={props.primers}
index={i}
Expand All @@ -94,6 +94,7 @@ const PrimerRow = (props: {
</g>
);
};

/**
* SingleNamedElement is a single rectangular element in the SeqBlock.
* It does a bunch of stuff to avoid edge-cases from wrapping around the 0-index, edge of blocks, etc.
Expand Down

0 comments on commit 1108a68

Please sign in to comment.