-
Notifications
You must be signed in to change notification settings - Fork 596
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
Conversation
LeeTL1220
commented
Aug 15, 2018
- Closes Need an IGV-compatible seg file to be produced alongside the copy ratio calls. #5114
- Updates the WDL as well to expose the new files.
Codecov Report
@@ 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
|
There was a problem hiding this 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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar comment here.
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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"; |
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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>. | ||
* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
White space.
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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);; |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Null check for call
.
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be final
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
59a43c8
to
11d4370
Compare
@samuelklee Back to you... |
Looks good, thanks! |