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

Added Called Legacy Segment code #5115

Merged
merged 4 commits into from
Aug 28, 2018
Merged

Added Called Legacy Segment code #5115

merged 4 commits into from
Aug 28, 2018

Conversation

LeeTL1220
Copy link
Contributor

@codecov-io
Copy link

codecov-io commented Aug 15, 2018

Codecov Report

Merging #5115 into master will increase coverage by 0.025%.
The diff coverage is 60%.

@@               Coverage Diff               @@
##              master     #5115       +/-   ##
===============================================
+ Coverage     86.496%   86.521%   +0.025%     
- Complexity     29205     29314      +109     
===============================================
  Files           1814      1816        +2     
  Lines         135364    135885      +521     
  Branches       15042     15116       +74     
===============================================
+ Hits          117084    117569      +485     
- Misses         12819     12846       +27     
- Partials        5461      5470        +9
Impacted Files Coverage Δ Complexity Δ
...bender/tools/copynumber/CallCopyRatioSegments.java 92.308% <100%> (+1.399%) 2 <0> (ø) ⬇️
...opynumber/formats/records/CalledLegacySegment.java 25% <25%> (ø) 2 <2> (?)
...ats/collections/CalledLegacySegmentCollection.java 68.085% <68.085%> (ø) 7 <7> (?)
...pynumber/CallCopyRatioSegmentsIntegrationTest.java 94.737% <80%> (-5.263%) 4 <0> (ø)
...ils/read/markduplicates/sparkrecords/Fragment.java 92% <0%> (-1.75%) 14% <0%> (+7%)
...r/utils/read/markduplicates/sparkrecords/Pair.java 98.276% <0%> (-1.724%) 49% <0%> (+22%)
...institute/hellbender/utils/test/ReadTestUtils.java 94.34% <0%> (-1.115%) 5% <0%> (ø)
...idation/CompareDuplicatesSparkIntegrationTest.java 96.296% <0%> (-0.37%) 10% <0%> (+3%)
...stitute/hellbender/tools/spark/ApplyBQSRSpark.java 100% <0%> (ø) 5% <0%> (+2%) ⬆️
...roadinstitute/hellbender/utils/read/ReadUtils.java 80.653% <0%> (ø) 211% <0%> (+2%) ⬆️
... and 8 more

Copy link
Contributor

@samuelklee samuelklee left a comment

Choose a reason for hiding this comment

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

Thanks for adding this! Some minor comments, mostly about style.

@@ -446,6 +446,7 @@ workflow CNVSomaticPairWorkflow {
File copy_ratio_parameters_tumor = ModelSegmentsTumor.copy_ratio_parameters
File allele_fraction_parameters_tumor = ModelSegmentsTumor.allele_fraction_parameters
File called_copy_ratio_segments_tumor = CallCopyRatioSegmentsTumor.called_copy_ratio_segments
File called_copy_ratio_segments_legacy_tumor = CallCopyRatioSegmentsTumor.called_copy_ratio_legacy_segments
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be called_copy_ratio_legacy_segments_tumor for consistency.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@@ -472,6 +473,7 @@ workflow CNVSomaticPairWorkflow {
File? copy_ratio_parameters_normal = ModelSegmentsNormal.copy_ratio_parameters
File? allele_fraction_parameters_normal = ModelSegmentsNormal.allele_fraction_parameters
File? called_copy_ratio_segments_normal = CallCopyRatioSegmentsNormal.called_copy_ratio_segments
File? called_copy_ratio_segments_legacy_normal = CallCopyRatioSegmentsNormal.called_copy_ratio_legacy_segments
Copy link
Contributor

Choose a reason for hiding this comment

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

Similar comment here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@@ -673,6 +675,7 @@ task CallCopyRatioSegments {

output {
File called_copy_ratio_segments = "${entity_id}.called.seg"
File called_copy_ratio_legacy_segments = "${entity_id}.called.seg.igv.seg"
Copy link
Contributor

Choose a reason for hiding this comment

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

This filename is pretty gross...can we just make the extension called.igv.seg?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@@ -75,7 +76,7 @@
public static final String NEUTRAL_SEGMENT_COPY_RATIO_UPPER_BOUND_LONG_NAME = "neutral-segment-copy-ratio-upper-bound";
public static final String OUTLIER_NEUTRAL_SEGMENT_COPY_RATIO_Z_SCORE_THRESHOLD_LONG_NAME = "outlier-neutral-segment-copy-ratio-z-score-threshold";
public static final String CALLING_COPY_RATIO_Z_SCORE_THRESHOLD_LONG_NAME = "calling-copy-ratio-z-score-threshold";

public static final String IGV_COMPATIBLE_FILE_SUFFIX = ".igv.seg";
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be called LEGACY_SEGMENTS_FILE_SUFFIX for consistency with the analogous constants in ModelSegments (alternatively, the names of those constants could be changed).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

* http://software.broadinstitute.org/cancer/software/genepattern/file-formats-guide#CBS</a>
* and <a href="https://software.broadinstitute.org/software/igv/SEG">
* https://software.broadinstitute.org/software/igv/SEG</a>.
*
Copy link
Contributor

Choose a reason for hiding this comment

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

White space.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done


@Override
public boolean equals(final Object o) {
if (this == o) return true;
Copy link
Contributor

Choose a reason for hiding this comment

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

Clean up these auto-generated methods by adding braces and final and removing white space.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, make sure to update these methods if call is required to be non-null.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@@ -29,5 +30,13 @@ public void testCallSegments() {
Assert.assertEquals(calledCopyRatioSegments.getMetadata(), copyRatioSegments.getMetadata());
Assert.assertEquals(calledCopyRatioSegments.getIntervals(), copyRatioSegments.getIntervals());
Assert.assertEquals(calledCopyRatioSegments.getRecords().stream().map(s -> s.getCall().getOutputString()).toArray(), new String[] {"+", "-", "0", "0"});

// Test writing the legacy format. Note that reading cannot be done through the CNV tools, since the header has been stripped away.
final File legacySegmentFile = new File(outputFile.getAbsolutePath() + CallCopyRatioSegments.IGV_COMPATIBLE_FILE_SUFFIX);
Copy link
Contributor

Choose a reason for hiding this comment

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

Clean up this path once the file suffix is changed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for reminder.... Done

final double segmentMean = dataLine.getDouble(CalledLegacySegmentTableColumn.SEGMENT_MEAN.columnName);
final String callOutputString = dataLine.get(CalledCopyRatioSegmentCollection.CalledCopyRatioSegmentTableColumn.CALL);
final CalledCopyRatioSegment.Call call = Arrays.stream(CalledCopyRatioSegment.Call.values())
.filter(c -> c.getOutputString().equals(callOutputString)).findFirst().orElse(null);;
Copy link
Contributor

Choose a reason for hiding this comment

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

Extra semicolon. When can the call ever be null?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed it to throw an exception.

Done

public CalledLegacySegment(final String sampleName, final SimpleInterval interval, final int numProbes, final double segmentMean,
final CalledCopyRatioSegment.Call call) {
super(sampleName, interval, numProbes, segmentMean);
this.call = call;
Copy link
Contributor

Choose a reason for hiding this comment

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

Null check for call.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done


public class CalledLegacySegment extends LegacySegment {

private CalledCopyRatioSegment.Call call;
Copy link
Contributor

Choose a reason for hiding this comment

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

Can be final?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@LeeTL1220 LeeTL1220 force-pushed the ll_called_legacy_segment branch from 59a43c8 to 11d4370 Compare August 28, 2018 14:13
@LeeTL1220
Copy link
Contributor Author

@samuelklee Back to you...

@LeeTL1220 LeeTL1220 assigned samuelklee and unassigned LeeTL1220 and samuelklee Aug 28, 2018
@samuelklee
Copy link
Contributor

Looks good, thanks!

@LeeTL1220 LeeTL1220 merged commit 63d4287 into master Aug 28, 2018
@LeeTL1220 LeeTL1220 deleted the ll_called_legacy_segment branch August 28, 2018 21:21
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.

3 participants