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

Updated plotting for ModelSegments CNV pipeline. #3729

Merged
merged 3 commits into from
Oct 25, 2017
Merged

Conversation

samuelklee
Copy link
Contributor

This is rebased off of #3716, since it depends on code there. Hence, only the second commit needs to be reviewed in this PR.

The code and tests are quite similar to that for PlotSegmentedCopyRatio/PlotACNVResults. However, I've changed the R scripts to be more efficient (WGS plots no longer take several hours). Furthermore, PlotModeledSegments is more flexible than PlotACNVResults in that it plots CR, AF, or both on the fly depending on the available inputs. I've also added some more input validation, changed some terminology, and moved over to data.table for reading TSVs in R.

/**
* @author Samuel Lee <slee@broadinstitute.org>
*/
final class PlottingUtils {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note to self: add parameter validation to the methods in this class, just for consistency.

@codecov-io
Copy link

codecov-io commented Oct 20, 2017

Codecov Report

Merging #3729 into master will decrease coverage by 0.011%.
The diff coverage is 75.294%.

@@               Coverage Diff               @@
##              master     #3729       +/-   ##
===============================================
- Coverage     79.642%   79.632%   -0.011%     
- Complexity     17608     17872      +264     
===============================================
  Files           1138      1146        +8     
  Lines          63529     64546     +1017     
  Branches        9693      9882      +189     
===============================================
+ Hits           50596     51399      +803     
- Misses          9057      9251      +194     
- Partials        3876      3896       +20
Impacted Files Coverage Δ Complexity Δ
...copynumber/formats/CopyNumberStandardArgument.java 0% <0%> (ø) 0 <0> (?)
...ls/copynumber/plotting/PlotDenoisedCopyRatios.java 100% <100%> (ø) 6 <6> (?)
...formats/collections/SampleLocatableCollection.java 95.652% <100%> (+0.652%) 9 <2> (+2) ⬆️
...tools/copynumber/coverage/copyratio/CopyRatio.java 34.783% <34.783%> (ø) 4 <4> (?)
...ynumber/multidimensional/model/ModeledSegment.java 56.25% <56.25%> (ø) 6 <6> (?)
...number/coverage/copyratio/CopyRatioCollection.java 61.538% <61.538%> (ø) 3 <3> (?)
...ltidimensional/model/ModeledSegmentCollection.java 69.767% <69.767%> (ø) 3 <3> (?)
...ender/tools/copynumber/plotting/PlottingUtils.java 80% <80%> (ø) 11 <11> (?)
...tools/copynumber/plotting/PlotModeledSegments.java 93.443% <93.443%> (ø) 23 <23> (?)
...discovery/prototype/SuspectedTransLocDetector.java 0% <0%> (ø) 0% <0%> (ø) ⬇️
... and 21 more

@samuelklee samuelklee requested a review from LeeTL1220 October 23, 2017 12:15
@samuelklee
Copy link
Contributor Author

@LeeTL1220 Do you mind reviewing the second commit? Most of it consists of lightly edited code that is already in master, so hopefully the review should be quick.

Copy link
Contributor

@LeeTL1220 LeeTL1220 left a comment

Choose a reason for hiding this comment

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

Comments are pretty minor. Also, a question or two...

private void checkRegularReadableUserFiles() {
Utils.nonNull(outputPrefix);
IOUtils.canReadFile(inputStandardizedCopyRatiosFile);
IOUtils.canReadFile(inputDenoisedCopyRatiosFile);
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this work if the input file is not specified?

Copy link
Contributor

Choose a reason for hiding this comment

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

(the input files are optional)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Whoops, they should not be.

* <h3>Example</h3>
*
* <pre>
* gatk-launch --javaOptions "-Xmx4g" PlotACNVResults \
Copy link
Contributor

Choose a reason for hiding this comment

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

IS this command line correct? PlotACNVResults?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch.

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 also need to update the rest of this javadoc.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated the javadoc for PlotDenoisedCopyRatios as well.

Assert.assertTrue(new File(outputDir, OUTPUT_PREFIX + ".deltaMAD.txt").length() > 0);
Assert.assertTrue(new File(outputDir, OUTPUT_PREFIX + ".scaledDeltaMAD.txt").exists());
Assert.assertTrue(new File(outputDir, OUTPUT_PREFIX + ".scaledDeltaMAD.txt").length() > 0);
final double standardizedMAD = ParamUtils.readValuesFromFile(new File(outputDir, OUTPUT_PREFIX + ".standardizedMAD.txt"))[0];
Copy link
Contributor

Choose a reason for hiding this comment

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

Are these MAD numbers akin to the old qc metric?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They are exactly the same. I figured that changing the name of the metric to be descriptive/informative couldn't hurt. Let me know which of these files we can do away with, if any (do we really need both scaleDeltaMAD and scaledMAD, for example)?

Copy link
Contributor

Choose a reason for hiding this comment

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

It really does make some of our collaborator's lives easier to have all of those....

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No problem. I think it might make sense to move the emission of these to DenoiseReadCounts, eventually.

@@ -0,0 +1,167 @@
package org.broadinstitute.hellbender.tools.copynumber.plotting;
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm assuming that you have looked at the plots themselves to ensure that they are okay...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup!

Copy link
Contributor

Choose a reason for hiding this comment

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

Great... ignore this comment then.

write.table(round((standardizedMAD - denoisedMAD) / standardizedMAD, 3), file.path(output_dir, paste(output_prefix, ".scaledDeltaMAD.txt", sep="")), col.names=FALSE, row.names=FALSE)

#plot standardized and denoised copy ratio on top of each other
pre_color_blue="#3B5DFF"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note to self, white space.

@samuelklee
Copy link
Contributor Author

Will merge once @asmirnov239 reviews #3716.

@LeeTL1220
Copy link
Contributor

@samuelklee Looks good to me.

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