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

Ultima develop code merge #1423

Merged
merged 27 commits into from
Dec 11, 2023
Merged

Ultima develop code merge #1423

merged 27 commits into from
Dec 11, 2023

Conversation

dror27
Copy link
Contributor

@dror27 dror27 commented Oct 28, 2023

This pull request includes Ultima Genomics code contributed to the public IGV version.

Code mainly has to do with additional rendering features for Flow Based tracks, specifically graphic indications of INDEL qualities.

NOTE: please hold on reviewing this pull request, pending out-of-bound communication,.

Ultima IGV Extensions

ported and refactored as extensions

WithJava added

Update gradle.yml

Update gradle.yml

Update gradle.yml

Update gradle.yml

Update gradle.yml

Update gradle.yml

Update gradle.yml

Update gradle.yml

t0 handling

guard against t0 missing

t0 processing corrected

should only apply to del of a single base and only when the deleted base is different from the two bases surrounding it. Otherwise, previous logic should be applied (now restored)

update token

M1 build added
@ilyasoifer
Copy link
Contributor

@jrobinso - this is the PR related to #1393. Can you suggest how to move forward with that? I am also attaching the documentation of the changes:
IGV Supplemental.pdf

@jrobinso
Copy link
Contributor

jrobinso commented Nov 8, 2023

@ilyasoifer Apologies for the delay, I am on vacation returning Nov 19. Will respond further via email.

@jrobinso
Copy link
Contributor

jrobinso commented Nov 8, 2023

WRT to next steps, we will need a test case we can explore ourselves. Also, eventually we would request the documentation in Markdown, as that is the language used for our documentation system (https://igv.org/doc/desktop/). Thanks.

@ilyasoifer
Copy link
Contributor

ilyasoifer commented Nov 9, 2023

@jrobinso - thanks for the feedback. We will add the test data (I assume to test/data). Could you please point me to the repository that contains the documentation so I can see how the md documents you are using are structured? Enjoy your vacation!

@dror27
Copy link
Contributor Author

dror27 commented Nov 11, 2023

@jrobinso - thanks for the feedback. We will add the test data (I assume to test/data). Could you please point me to the repository that contains the documentation so I can see how the md documents you are using are structured? Enjoy your vacation!

flow_renderer.sam added to test/data/sam. Once @ilyasoifer adds doc we can point to specific reads & locations for each new feature. Data is around chr1:10000

@helgathorv
Copy link
Contributor

@ilyasoifer Our new doc repo is not yet public, but here are some sample markdown files from the User Guide > Tracks and Data Types > Alignments. Let me know if you have any questions.
SampleIGVDoc.zip

@helgathorv
Copy link
Contributor

@ilyasoifer The IGV doc repo is now public at https://github.com/igvteam/igv-docs-website

@ilyasoifer
Copy link
Contributor

Thanks @helgathorv for these examples. Should we create a PR for the documentation in that repository or attach it to this PR?

@jrobinso
Copy link
Contributor

@ilyasoifer As this is just a single page of doc attaching it here is fine.

@ilyasoifer
Copy link
Contributor

@jrobinso and @helgathorv I added to this PR a folder called doc that contains a markdown file igv.md. Since the document also contains images, I thought it is more convenient to add it this way. Let me know if you would like me to otherwise re-arrange.

@ilyasoifer
Copy link
Contributor

ilyasoifer commented Nov 19, 2023

@dror27 - I think our code contains a small bug similar to what we encountered in broadinstitute/gatk#8337.
Specifically, the code automatically recognizes data that contains tp tag as Ultima. However, minimap2 aligner apparently also uses tp tag for a different reason.
Could you implement something similar to what I did in that PR? Thanks!

@dror27
Copy link
Contributor Author

dror27 commented Nov 20, 2023

@dror27 - I think our code contains a small bug similar to what we encountered in broadinstitute/gatk#8337. Specifically, the code automatically recognizes data that contains tp tag as Ultima. However, minimap2 aligner apparently also uses tp tag for a different reason. Could you implement something similar to what I did in that PR? Thanks!

Logic added to screen flow alignments based on read-group presence and fields

@jrobinso
Copy link
Contributor

Hi all, apologies for the lack of response, I've been delayed by travel and some pressing issues but will get to it ASAP.

@jrobinso
Copy link
Contributor

jrobinso commented Dec 4, 2023

Hi all, I might have missed but have instructions for use been posted somewhere? The documentation describes the visual features but how do we actually try it?

BTW the doc pages have been added to the igv-docs-website, any further changes to docs should be done there. Currently the page is at https://github.com/igvteam/igv-docs-website/tree/main/igv-docs/docs/UserGuide/tracks/alignments/ultima.

I'm concerned about this new (to IGV) concept of "extensions". Its not part of our current design, obviously, and I am not sure we want to take on a new concept such as this for the sake of a few visiual enhancements for data from a specific vendor. It might be a good concept, that we would consider as part of a major refactor, but is it required for the enhancements we are considering here?

@dror27
Copy link
Contributor Author

dror27 commented Dec 4, 2023

Hi all, I might have missed but have instructions for use been posted somewhere? The documentation describes the visual features but how do we actually try it?

BTW the doc pages have been added to the igv-docs-website, any further changes to docs should be done there. Currently the page is at https://github.com/igvteam/igv-docs-website/tree/main/igv-docs/docs/UserGuide/tracks/alignments/ultima.

I'm concerned about this new (to IGV) concept of "extensions". Its not part of our current design, obviously, and I am not sure we want to take on a new concept such as this for the sake of a few visiual enhancements for data from a specific vendor. It might be a good concept, that we would consider as part of a major refactor, but is it required for the enhancements we are considering here?

@jrobinso - as to the choice of implementing this visual feature using an extension modality - this has mainly been done as a the feature was developed over the past year or two - while IGV versions were moving on. The extension model allowed for isolating the code for the new visual feature into a separate set of classes, with minimal changes in IGV itself. This allowed updating the core IGV and tacking on it the visual extension.

This might not be required when the features are accepted as being part of the core IGV. Still, I can envision that some IGV users/developers might find it easier to use this extension mechanism to create new visualizations which would start as experimental and wind up in the general version.

The bottom line is that you - as the product's architects - need to take a decision. We will probably go with what ever you decide.

As to the doc, @ilyasoifer will respond.

@ilyasoifer
Copy link
Contributor

@jrobinso Data had been placed here: test/data/sam/flow_renderer.sam. Data are around chr1:10000. I believe that our extension automatically detects the Ultima-specific tags and activates the modified visualization of the indels.

Thanks for moving the docs to the other repo, should we removed them from this PR?
Thanks!

Hi all, I might have missed but have instructions for use been posted somewhere? The documentation describes the visual features but how do we actually try it?

BTW the doc pages have been added to the igv-docs-website, any further changes to docs should be done there. Currently the page is at https://github.com/igvteam/igv-docs-website/tree/main/igv-docs/docs/UserGuide/tracks/alignments/ultima.

I'm concerned about this new (to IGV) concept of "extensions". Its not part of our current design, obviously, and I am not sure we want to take on a new concept such as this for the sake of a few visiual enhancements for data from a specific vendor. It might be a good concept, that we would consider as part of a major refactor, but is it required for the enhancements we are considering here?

@jrobinso
Copy link
Contributor

jrobinso commented Dec 4, 2023

@dror27 An extension framework might be a good idea in general, but we have then escalated this PR significantly. For one thing we would need documentation on the framework itself. Its an interesting idea but given constraints here it would be some time before we are able to consider it.

If I understand this PR the changes, from a user perspective, amount to some additional visual elements for indels and some additions to the popup text. I would not expect this to require many changes to code, I think the bulk of changes here are for the extension framework. If you could remove that (the extension) it would certainly expedite review. The "ext" package might be renamed to "ultima" for specialized code that remains, similar to the "smrt" (pacbio) package.

@ilyasoifer The doc can be removed from the PR, no requirement to do so, but if you wish to make changes let's do it with PRs to the doc website.

@dror27
Copy link
Contributor Author

dror27 commented Dec 5, 2023

@jrobinso ok. I will update.

@dror27
Copy link
Contributor Author

dror27 commented Dec 5, 2023

@jrobinso @ilyasoifer - I have now removed the framework (concept and code). Additionally, the package has been renamed to .ultima. Thank you for your input and review

@jrobinso
Copy link
Contributor

jrobinso commented Dec 6, 2023

@dror27 Thanks for the quick turnaround, much easier to review now. I had left some comments on particular files prior to this, hopefully you can see them. I have not used the github review function before. 2 in particular, could you explain the changes to SessionWriter and LoadFromURLAction? I don't understand the SessionWriter change relevance, and am not sure about the "multiple tracks" addition either. LoadFromURLAction already supports loading multiple urls, what does this change allow?

@dror27
Copy link
Contributor Author

dror27 commented Dec 6, 2023

@jrobinso I was not able to see your individual comments, but I understand your concerns.

The two changes mentioned (loading mutliple tracks and session-writer changes) were remains of behaviors of previous IGV versions that we patched over. They are no longer required and were therefore removed.

src/main/java/org/broad/igv/session/SessionWriter.java Outdated Show resolved Hide resolved
src/main/java/org/broad/igv/variant/VariantMenu.java Outdated Show resolved Hide resolved
@@ -1057,6 +1082,180 @@ private void drawLargeIndelLabel(Graphics2D g, boolean isInsertion, String label
}
}

private void drawInsertions(Rectangle rect, Alignment alignment, RenderContext context, AlignmentTrack.RenderOptions renderOptions,
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a new method, most of it moved from somewhere else I think. The github diff tool here makes it hard to see what has actually changed, and what the consequence of this new method will be, but is it neccessary in the first place? Fewer changes are better.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jrobinso this method, drawInsertions, if I understand correctly, was authored outside the scope of this pull request (see Git Blame information).

I did notice that it, along with the following methods in this class (VariantRenderer) is not used. You may consider removing them:

  • drawInsertions
  • renderExpandedInsertion
  • getOutlierStatus
  • compareToBounds

Running "unused declarations" code analysis produces many more unused methods - so I think that this is a bigger issue and might not be related to this pull request.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks, could you remove this method? That will make for a cleaner merge. Also could you remove the doc as that has been moved to the igv doc repository? With this I think this will be ready to merge. Thanks for your prompt responses.

@dror27
Copy link
Contributor Author

dror27 commented Dec 10, 2023

Done - method drawInsertions and superfluous doc removed.

@jrobinso
Copy link
Contributor

OK great! I will do a pull and some quick tests and then merge, probably this evening. Thanks for you quick responses, it makes this easier.

@jrobinso jrobinso merged commit 787c5cf into igvteam:master Dec 11, 2023
@jrobinso
Copy link
Contributor

Thanks again for your contributions. This is merged and will be part of the upcoming 3.0 release. We hope to publish a preview before the end of the year, with a final release early in 2024. If you would like to suggest a short description (1-2 sentences) for the release notes please feel free to do so here. Otherwise we will derive a description from the documentation.

@dror27
Copy link
Contributor Author

dror27 commented Dec 11, 2023

@jrobinso thank you for the joint work and for the merge.

@ilyasoifer can you please suggest a short description (1-2 sentences) for the release notes? (we've removed the doc from the source tree).

My take on summarizing the deleted doc:

@dror27 dror27 deleted the ultima-develop branch December 11, 2023 06:44
@ilyasoifer
Copy link
Contributor

@jrobinso - thanks for the efficient merge. I agree with @dror27 description for the release note, just one minor tweak:

@jrobinso
Copy link
Contributor

@dror27 A problem has arose. We need a better test for "isFlow". The problem is "ti" and "tp" are not reserved tags, anyone can use these for any application and we now have non-Ultima data that uses "tp". So we need something more precise. Is there anything in the BAM header that would tell us this is a "flow" tagged file? Any other suggestions?

Problem is reported here (or rather symptom): #1468

  private boolean isFlow(SAMRecord record) {

        // must have one of the key attributes
        for ( String name : KEY_ATTR.split(",") ) {
            if ( record.hasAttribute(name) ) {
                return true;
            }
        }
        return false;
    }

@ilyasoifer
Copy link
Contributor

ilyasoifer commented Jan 23, 2024 via email

@jrobinso
Copy link
Contributor

@ilyasoifer Thanks, I have some ideas too but I'll wait for your suggestions. If you branch its probably better to do so from branch "2.17", as opposed to main, but either will do. It will be merged to both.

@dror27
Copy link
Contributor Author

dror27 commented Jan 23, 2024

In newer IGV code, we also test for the "ULTIMA" value in the "PL" (platform) attribute of the associated read group, the presence for the "MC" (maxHmer) in the read group and finally the presence "tp" attribute on the record itself.

Does it make sense?

   final SAMReadGroupRecord readGroup = samAlignment.getRecord().getReadGroup();
    if ( !RG_ATTR_PL_ULTIMA.equals(readGroup.getAttribute(RG_ATTR_PL))
         &&  (readGroup.getAttribute(RG_ATTR_MC) == null) )
        return false;
    if ( !samAlignment.getRecord().hasAttribute(ATTR_TP)  )
        return false;

@dror27
Copy link
Contributor Author

dror27 commented Jan 23, 2024

@jrobinso and @ilyasoifer - please see new pull request to address:
#1471

@jrobinso
Copy link
Contributor

That looks pretty robust. I'm also going to add a try/catch for any future conflicts, but with this test I doubt they'll be any.

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.

None yet

4 participants