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

Make truncating the histogram optional in CollectInsertSizeMetrics #1779

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

takutosato
Copy link
Contributor

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

  • Added or modified tests to cover changes and any new functionality
  • Edited the README / documentation (if applicable)
  • All tests passing on Travis

Review

  • Final thumbs-up from reviewer
  • Rebase, squash and reword as applicable

For more detailed guidelines, see https://github.com/broadinstitute/picard/wiki/Guidelines-for-pull-requests

@takutosato
Copy link
Contributor Author

@yfarjoun could you review this small PR?

Copy link
Contributor

@yfarjoun yfarjoun left a 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.*;
Copy link
Contributor

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

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 intellij

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);
Copy link
Contributor

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;
Copy link
Contributor

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";
Copy link
Contributor

Choose a reason for hiding this comment

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

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

final int minInsertSize = 100;
final int maxInsertSize = 400;
int i = 0;
int start = 1000;
Copy link
Contributor

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);
Copy link
Contributor

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;
Copy link
Contributor

Choose a reason for hiding this comment

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

rename readCount

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

@gbggrant
Copy link
Contributor

@takutosato are you able to complete the last of @yfarjoun 's requested changes for this PR?

@kachulis
Copy link
Contributor

@takutosato

@kockan
Copy link
Contributor

kockan commented Aug 10, 2023

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?

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.

5 participants