-
Notifications
You must be signed in to change notification settings - Fork 371
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
Make truncating the histogram optional in CollectInsertSizeMetrics #1779
base: master
Are you sure you want to change the base?
Conversation
@yfarjoun could you review this small PR? |
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 @takutosato for this enhancement.
A few requests to make the changes more inline with Picard "philosophy"....
import htsjdk.samtools.SAMFileWriter; | ||
import htsjdk.samtools.SAMFileWriterFactory; | ||
import htsjdk.samtools.SAMRecordSetBuilder; | ||
import htsjdk.samtools.*; |
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.
please bring back the individual imports
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.
Yup intellij
src/test/java/picard/analysis/CollectInsertSizeMetricsTest.java
Outdated
Show resolved
Hide resolved
setBuilder.addPair("outlierRead", 0, start, start + outlierInsertSize - readLength, | ||
false, false, cigar, cigar, false, true, 60); | ||
|
||
final SAMFileWriter writer = new SAMFileWriterFactory().setCreateIndex(true).makeBAMWriter(setBuilder.getHeader(), false, testSamFile); |
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.
use try-with-resources here.
} | ||
|
||
// Add an outlier | ||
int outlierInsertSize = 2000; |
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.
final
final int maxInsertSize = 400; | ||
int i = 0; | ||
int start = 1000; | ||
String cigar = readLength + "M"; |
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.
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
final int minInsertSize = 100; | ||
final int maxInsertSize = 400; | ||
int i = 0; | ||
int start = 1000; |
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.
final
final MetricsFile<InsertSizeMetrics, Comparable<?>> output = new MetricsFile<>(); | ||
output.read(new FileReader(outfile)); | ||
|
||
Assert.assertEquals(output.getAllHistograms().get(0).get(outlierInsertSize).getValue(), 1.0); |
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.
run with other argument to show that this argument makes a difference
setBuilder.setReadLength(readLength); | ||
final int minInsertSize = 100; | ||
final int maxInsertSize = 400; | ||
int i = 0; |
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.
rename readCount
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
Co-authored-by: Yossi Farjoun <farjoun@broadinstitute.org>
Co-authored-by: Yossi Farjoun <farjoun@broadinstitute.org>
@takutosato are you able to complete the last of @yfarjoun 's requested changes for this PR? |
From what I can see this looks almost ready to go? @takutosato would you like me to take a look at the last few changes requested or do you have some time to do it? |
Description
It's true that you can adjust some existing parameters to turn off truncating, but sometimes it's easier to just turn it off and the user should have that option.
Checklist (never delete this)
Never delete this, it is our record that procedure was followed. If you find that for whatever reason one of the checklist points doesn't apply to your PR, you can leave it unchecked but please add an explanation below.
Content
Review
For more detailed guidelines, see https://github.com/broadinstitute/picard/wiki/Guidelines-for-pull-requests