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

Add support for documentation generation for metrics classes. #1782

Merged
merged 6 commits into from
Apr 4, 2022

Conversation

cmnbroad
Copy link
Contributor

@cmnbroad cmnbroad commented Mar 8, 2022

@derekca @gbrandt6 @droazen @lbergelson FYI.

This implements documentation generation for metrics classes. It uses the existing @DocumentedFeature annotation, along with a custom doc template (which is easier than overloading the existing template), and a few lines of custom doclet code that selects that template for metrics classes and displays all public fields (in all super classes in the class hierarchy of the annotated metrics class) in a table.

There are two commits; one with the core code, and one that add the annotations to the various metrics classes. A separate sweep should probably be done to add metrics-specific summaries (using the @DocumentedFeature summary attribute) for each class, and also some of the metrics source classes seem to have no documentation at all.

Alternative implementations would be:

  • add a new class-level annotation to Barclay, analogous to @DocumentedFeature, and interpret it to mean "document all for non-@argument fields in a table", or
  • Add a new explicit field-level annotation to Barclay, analogous to @Argument, but that would require field-level annotation of each metric variable in each class

But the solution in this PR requires no Barclay changes, and given that the behavior seems pretty specific to metrics, I think its the simplest solution - its basically all custom code in Picard that specializes/overrides the default Barclay doclet. The one caveat is that if we want the GATK doc build to pick up the metrics doc as well, we'll need to propagate the new template and the few lines of custom doclet code to the GATK repo, since GATK uses it's own custom doclet and templates.

Below is some sample output (I don't have all the correct style sheets locally so these are not quite "publish-ready).

Index Page: (note that only AlignmentSummaryMetrics has a n actual summary, because its the only one I wrote - as mentioned above, all of the classes need to have a short summary line to be added):
Screen Shot 2022-03-08 at 10 56 29 AM

Detail Page:
Screen Shot 2022-03-08 at 10 56 41 AM

@cmnbroad cmnbroad marked this pull request as draft March 8, 2022 16:11
@cmnbroad
Copy link
Contributor Author

@derekca Can you verify that the result is what you're looking for (I included sample screen shots, but I can give you the actual files if you want to look at them). Once we have that, we can move forward with the rest of the code review.

<h2>Overview</h2>
${description}

<#-- Create the argument summary -->
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These are not arguments, their metrics....

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

<#list arguments.all as arg>
<@argumentDetails arg=arg/>
</#list>
</#if>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This if block and the comment are irrelevant and should be removed..

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

final Map<String, String> metricsField = new HashMap();
metricsField.put(METRICS_MAP_NAME_KEY, fd.name());
metricsField.put(METRICS_MAP_SUMMARY_KEY, fd.getRawCommentText());
metricsFields.add(metricsField);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hm. Reviewing you own code days later is interesting. metricsFields -> metricsList and metricsField -> metricsFields.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

@cmnbroad cmnbroad marked this pull request as ready for review March 15, 2022 15:23
@derekca
Copy link
Contributor

derekca commented Mar 15, 2022

@cmnbroad I'm not familiar enough with how the backend works, but what you're describing here is basically what we had in mind. I think that it should help us in migrating over the bulk of the information that we need onto the GATK repo.
Whatever else is leftover can be done manually by us in User Ed, if there is anything left over on the deprecated site.

Copy link
Contributor

@gbggrant gbggrant left a comment

Choose a reason for hiding this comment

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

LGTM. One very minor question.

@@ -43,6 +43,9 @@ private HelpConstants() {}
public final static String DOC_CAT_GENOTYPING_ARRAYS_MANIPULATION = "Genotyping Arrays Manipulation";
public final static String DOC_CAT_GENOTYPING_ARRAYS_MANIPULATION_SUMMARY = "Tools that manipulate data generated by Genotyping arrays";

public final static String DOC_CAT_METRICS = "Metrics";
public final static String DOC_CAT_METRICS_SUMMARY = "Metrics ";
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the trailing space on "Metrics " intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, that space is entirely unnecessary. Fixed.

@cmnbroad
Copy link
Contributor Author

@derekca

I think that it should help us in migrating over the bulk of the information that we need onto the GATK repo.

Not sure exactly what this refers to. Is the plan to restart the publishing of the Picard doc along with Picard releases (I assume we're still not doing that), or to just continue to publish the output of the GATK doc build ? In order for the metrics doc to be produced by the GATK doc build, a separate PR (a subset of this one) will be required in GATK to enable these there. Once this is merged, I'll add that PR to GATK.

@derekca
Copy link
Contributor

derekca commented Mar 29, 2022

@cmnbroad

Is the plan to restart the publishing of the Picard doc along with Picard releases (I assume we're still not doing that)

Basically, we will be shutting down the Picard site. There is no set date for the site to be shut down, but it will happen as soon as we finish migrating all the information from that site into GATK documentation as part of this ticket.

So, any new Picard documentation or updates should go directly to the GATK docs, and not to the site.

or to just continue to publish the output of the GATK doc build ?

Yes, exactly. The GATK docs will continue to get built, but now they can pull the [missing] Picard metrics information as well.

In order for the metrics doc to be produced by the GATK doc build, a separate PR (a subset of this one) will be required in GATK to enable these there. Once this is merged, I'll add that PR to GATK.

Okay, if that makes the most sense, then let's do that!

@cmnbroad
Copy link
Contributor Author

Oh I see derekca - that sounds good. I'll need to rebase this now since its out-of-date and then we can merge it so I can make the GATK PR.

@gbggrant
Copy link
Contributor

@cmnbroad is this PR ready to merge?

final FieldDoc[] fieldDocs = currentWorkUnit.getClassDoc().fields(false);
for (final FieldDoc fd : fieldDocs) {
if (fd.isPublic()) {
final Map<String, String> metricsFields = new HashMap();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The stricter GATK build complains about this raw type. Fixed.

@cmnbroad
Copy link
Contributor Author

cmnbroad commented Apr 4, 2022

I updated one line due to fix usage of a raw generic type that was detected by the GATK build when I made the GATK pr to reflect these changes. This is ready once tests pass.

@cmnbroad cmnbroad merged commit 5854951 into master Apr 4, 2022
@cmnbroad cmnbroad deleted the cn_metrics_doc branch April 4, 2022 13:38
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.

3 participants