Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce a Primer element #242

Merged
merged 8 commits into from
Nov 22, 2023
Merged

Introduce a Primer element #242

merged 8 commits into from
Nov 22, 2023

Conversation

isaacguerreir
Copy link
Contributor

@isaacguerreir isaacguerreir commented Nov 21, 2023

I made the component to visualize primers (#232).

So far, so good. Some problems I would like to ask for some help.

  1. We have a gap between the complementary sequence and the reverse primer line, but we do not have a gap between the forward primer line and the sequence.
  2. When I select a specific area where a forward prime component is rendered, the component is erased. Do you know why?

image

@isaacguerreir isaacguerreir requested review from jjti and bugzpodder and removed request for jjti November 21, 2023 19:35
@jjti
Copy link
Collaborator

jjti commented Nov 22, 2023

@isaacguerreir this is epic. You killed it, this is dope.

I made a couple small changes to address your points:

Screenshot 2023-11-21 at 8 05 00 PM

We have a gap between the complementary sequence and the reverse primer line, but we do not have a gap between the forward primer line and the sequence.

I don't like this part of SeqBlock, because it's so.. brittle and hard-coded, but it was a slightly misordered height calc in this block:

// height and yDiff of cut sites
const cutSiteYDiff = 0; // spacing for cutSite names
const cutSiteHeight = zoomed && cutSiteRows.length ? lineHeight : 0;
// height and yDiff of the sequence strand
const indexYDiff = cutSiteYDiff + cutSiteHeight;
const indexHeight = seqType === "aa" ? 0 : lineHeight; // if aa, no seq row is shown

When I select a specific area where a forward prime component is rendered, the component is erased. Do you know why?

This was just ordering in the SeqBlock. I changed it so Highlight.Block is first and the Forward Primer is above it:

        <Selection.Block
          findXAndWidth={this.findXAndWidth}
          firstBase={firstBase}
          fullSeq={fullSeq}
          lastBase={lastBase}
          selectHeight={selectHeight}
          onUnmount={onUnmount}
        />
        {primerFwdRows.length && (
          <PrimeRows
            bpsPerBlock={bpsPerBlock}
            direction={1}
            elementHeight={elementHeight}
            findXAndWidth={this.findXAndWidthElement}
            firstBase={firstBase}
            fullSeq={fullSeq}
            inputRef={inputRef}
            lastBase={lastBase}
            primerRows={primerFwdRows}
            seqBlockRef={this}
            width={size.width}
            yDiff={primerFwdYDiff}
          />
        )}

@@ -141,6 +155,12 @@ export default class Linear extends React.Component<LinearProps> {
if (zoomed) {
blockHeight += showComplement ? lineHeight : 0; // double for complement + 2px margin
}
if (primerFwdRows[i].length) {
blockHeight += primerFwdRows[i].length * lineHeight;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because it's a row of rows, we have to multiple the row count by lineHeight (in case there's >1 rows of primers)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I didn't get it. Should I change something?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No this and the other comments are just me sharing the things I changed as an FYI about some internal details

}) => {
return (
<g
className="la-vz-linear-annotation-row"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here and in a couple other places we'll want "primers" in place of annotations

@@ -32,7 +32,16 @@ export interface Translation extends NameRange {
direction: -1 | 1;
}

/** Primer is a single primer for PCR. Not visualized right now. */
/** PrimerProp is a single primer to visualize above/below the linear viewer. */
export interface PrimerProp {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've been trying to make these *Prop version of arguments. They're like the regular thing, but as a "Prop" when passed as props they can be missing id/color, whereas Primer cannot

@@ -141,6 +155,12 @@ export default class Linear extends React.Component<LinearProps> {
if (zoomed) {
blockHeight += showComplement ? lineHeight : 0; // double for complement + 2px margin
}
if (primerFwdRows[i].length) {
blockHeight += primerFwdRows[i].length * lineHeight;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No this and the other comments are just me sharing the things I changed as an FYI about some internal details

@isaacguerreir
Copy link
Contributor Author

Should I make a Circle visual element? Or this is not imperative for accepting this PR?

@jjti
Copy link
Collaborator

jjti commented Nov 22, 2023

Should I make a Circle visual element? Or this is not imperative for accepting this PR?

I think that'd be great, and probably part of the acceptance criteria for closing #232

But that we can merge this and release it without having it Circular (yet)

One more small thing: could you please add docs on the primers prop to the README?

@isaacguerreir
Copy link
Contributor Author

Should I make a Circle visual element? Or this is not imperative for accepting this PR?

I think that'd be great, and probably part of the acceptance criteria for closing #232

But that we can merge this and release it without having it Circular (yet)

One more small thing: could you please add docs on the primers prop to the README?

Primer props added on the README.

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
Copy link
Collaborator

@jjti jjti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small fixes to sed replace annotations > primers

src/Linear/Primers.tsx Outdated Show resolved Hide resolved
src/Linear/Primers.tsx Outdated Show resolved Hide resolved
src/Linear/Primers.tsx Outdated Show resolved Hide resolved
src/Linear/Primers.tsx Outdated Show resolved Hide resolved
isaacguerreir and others added 2 commits November 22, 2023 14:39
Co-authored-by: Joshua Timmons <joshua.timmons1@gmail.com>
- change `annotation` to `primer` on component ids
- fix typos

Co-authored-by: Joshua Timmons <joshua.timmons1@gmail.com>
Copy link
Collaborator

@jjti jjti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, this is cool!

@jjti jjti merged commit eaaef94 into develop Nov 22, 2023
2 checks passed
@jjti
Copy link
Collaborator

jjti commented Nov 22, 2023

released @isaacguerreir : https://github.com/Lattice-Automation/seqviz/releases/tag/3.10.0 🎉

@isaacguerreir
Copy link
Contributor Author

Thanks for helping me, @jjti. I was talking today with @guzmanvig about how the code is definitely much simpler than it should be for the complexity it's taking it. So thanks for making so many comments and the cleanness of the Seqviz code.

@leshane leshane linked an issue Nov 27, 2023 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Introduce a Primer element
2 participants