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

SV test and utils cleanup #5116

Merged
merged 1 commit into from
Aug 27, 2018
Merged

Conversation

SHuang-Broad
Copy link
Contributor

Does:

Note:

@TedBrookings tagging you as the victim for reviewing.
Please feel free to reassign.

@codecov-io
Copy link

codecov-io commented Aug 15, 2018

Codecov Report

❗ No coverage uploaded for pull request base (master@43750e9). Click here to learn what that means.
The diff coverage is 93.478%.

@@            Coverage Diff             @@
##             master     #5116   +/-   ##
==========================================
  Coverage          ?   86.707%           
  Complexity        ?     29097           
==========================================
  Files             ?      1810           
  Lines             ?    134816           
  Branches          ?     14939           
==========================================
  Hits              ?    116895           
  Misses            ?     12521           
  Partials          ?      5400
Impacted Files Coverage Δ Complexity Δ
...iscovery/TestUtilsForAssemblyBasedSVDiscovery.java 95.522% <ø> (ø) 13 <0> (?)
...e/hellbender/tools/spark/sv/utils/SVFileUtils.java 24.691% <ø> (ø) 4 <0> (?)
...tsFromContigAlignmentsSAMSparkIntegrationTest.java 97.561% <ø> (ø) 6 <0> (?)
...der/tools/spark/sv/discovery/SvDiscoveryUtils.java 2.564% <0%> (ø) 1 <0> (?)
.../sv/StructuralVariationDiscoveryPipelineSpark.java 91.946% <100%> (ø) 16 <0> (?)
...n/CpxVariantReInterpreterSparkIntegrationTest.java 97.5% <100%> (ø) 8 <0> (?)
...e/hellbender/tools/spark/sv/utils/SVVCFWriter.java 87.5% <100%> (ø) 11 <0> (?)
.../evidence/FindBreakpointEvidenceSparkUnitTest.java 94.891% <100%> (ø) 15 <0> (?)
...iscoverFromLocalAssemblyContigAlignmentsSpark.java 90.526% <100%> (ø) 24 <0> (?)
.../DiscoverVariantsFromContigAlignmentsSAMSpark.java 82.143% <100%> (ø) 7 <0> (?)
... and 8 more

if (expectedVCFPath == null) {
expectedVcs = Collections.emptyList();
} else {
try (final VCFFileReader fileReader = new VCFFileReader(new File(expectedVCFPath), false)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick, but you can try-with-resources with multiple resources in one statement:
try (final VCFFileReader fileReader = new VCFFileReader(new File(expectedVCFPath), false);
final CloseableIterator iterator = fileReader.iterator()) {
...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

learned something. Thanks!

null,
Collections.emptyList(),
false);

Copy link
Contributor

Choose a reason for hiding this comment

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

I personally found it just slightly complicated to follow the logic of how null expected paths would play out. Maybe worth just putting a comment here that null paths are interpreted as "no variants", so the test will be asserting that the produced variants file is empty.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

documented StructuralVariationDiscoveryPipelineSparkIntegrationTest.svDiscoveryVCFEquivalenceTest(...)

@@ -150,6 +151,7 @@ public boolean requiresReads() {
protected void runTool(final JavaSparkContext ctx) {

validateParams();
final Set<VCFHeaderLine> defaultToolVCFHeaderLines = getDefaultToolVCFHeaderLines();
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like there's no reason to assign to a local variable, just pass the result of the call directly to SvDiscoveryInputMetadata()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

local var removed

}

public static SimpleInterval makeOneBpInterval(final String chr, final int pos) {
return new SimpleInterval(chr, pos, pos);
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe worth adding comment noting that SimpleIntervals are closed instead of semi-closed. I personally am occasionally confused by this difference.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think that's standard: SimpleInterval's, inherited from Locatable's from htsjdk, are 1-based, fully closed intervals. I learned this by doing some work on htsjdk.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added more doc for this method.

Copy link
Contributor

@TedBrookings TedBrookings left a comment

Choose a reason for hiding this comment

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

Mostly looks good to me. I made a few nitpick comments.

The only remaining concern is that you created SVFileUtilsUnitTest (which is good) but two sets of functions there do not appear to have unit tests anywhere: readKmersFile/writeKmersFile, and readIntervalsFile/writeIntervalsFile. Given that the test paradigm would be pretty much identical to what you did for sam files, and the inverse pairs are right in the same class, I think it might be worth either banging out unit tests for them, or adding an issue to do so. The argument I see against it is that tools that use them have integration tests (except writeIntervalsFile which is totally unused). My feelings are mixed so I'm just going to bring it to your attention and ask you to think about it.

@SHuang-Broad
Copy link
Contributor Author

@TedBrookings created ticket #5139 for the concerns you have

  * some clean up on util classes in SV packages and
    get default headers into output VCF
  * remove phantom sga-related test files and
    move large test data files to the new sub-dir: src/test/resources/large/sv/
  * integration test for new interpretation tool SvDiscoverFromLocalAssemblyContigAlignmentsSpark
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Expand integration test cases in StructuralVariationDiscoveryPipelineSparkIntegrationTest
3 participants