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

Allowed use of zero eigensamples in DenoiseReadCounts. #4411

Merged
merged 1 commit into from
Mar 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ public final class DenoiseReadCounts extends CommandLineProgram {
"If not specified or if the number of eigensamples available in the panel of normals " +
"is smaller than this, all eigensamples will be used.",
fullName = CopyNumberStandardArgument.NUMBER_OF_EIGENSAMPLES_LONG_NAME,
minValue = 0,
optional = true
)
private Integer numEigensamplesRequested = null;
Expand All @@ -176,8 +177,6 @@ protected Object doWork() {
throw new UserException.HardwareFeatureException("Cannot load the required HDF5 library. " +
"HDF5 is currently supported on x86-64 architecture and Linux or OSX systems.");
}
Utils.validateArg(numEigensamplesRequested == null || numEigensamplesRequested > 0,
"Number of eigensamples to use for denoising must be non-negative.");

IOUtils.canReadFile(inputReadCountFile);
logger.info(String.format("Reading read-counts file (%s)...", inputReadCountFile));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ static SVDDenoisedCopyRatioResult denoise(final SVDReadCountPanelOfNormals panel
if (!CopyNumberArgumentValidationUtils.isSameDictionary(panelOfNormals.getSequenceDictionary(), readCounts.getMetadata().getSequenceDictionary())) {
logger.warn("Sequence dictionaries in panel and case sample do not match.");
}
ParamUtils.isPositive(numEigensamples, "Number of eigensamples to use for denoising must be positive.");
ParamUtils.isPositiveOrZero(numEigensamples, "Number of eigensamples to use for denoising must be non-negative.");
Utils.validateArg(numEigensamples <= panelOfNormals.getNumEigensamples(),
"Number of eigensamples to use for denoising is greater than the number available in the panel of normals.");

Expand Down Expand Up @@ -424,6 +424,10 @@ public double visit(int sampleIndex, int intervalIndex, double value) {
private static RealMatrix subtractProjection(final RealMatrix standardizedValues,
final double[][] eigensampleVectors,
final int numEigensamples) {
if (numEigensamples == 0) {
return standardizedValues.copy();
}

final int numIntervals = eigensampleVectors.length;
final int numAllEigensamples = eigensampleVectors[0].length;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public final class DenoiseReadCountsIntegrationTest extends CommandLineProgramTe
private static final File WGS_ANNOTATED_INTERVALS_FILE = new File(TEST_SUB_DIR, "denoise-read-counts-wgs-annotated-intervals.tsv");
private static final File WGS_NO_GC_PON_FILE = new File(largeFileTestDir, "cnv_somatic_workflows_test_files/wgs-no-gc.pon.hdf5");
private static final File WGS_DO_GC_PON_FILE = new File(largeFileTestDir, "cnv_somatic_workflows_test_files/wgs-do-gc.pon.hdf5");
private static final List<Integer> NUMBER_OF_EIGENVALUES_LIST = Arrays.asList(null, 1, 10);
private static final List<Integer> NUMBER_OF_EIGENVALUES_LIST = Arrays.asList(null, 0, 1, 10);

//create all combinations of arguments
@DataProvider(name = "dataDenoiseReadCounts")
Expand All @@ -47,7 +47,7 @@ public Object[][] dataDenoiseReadCounts() {
if (numberOfEigenvalues != null) {
arguments.addArgument(CopyNumberStandardArgument.NUMBER_OF_EIGENSAMPLES_LONG_NAME, numberOfEigenvalues.toString());
}
data.add(Arrays.asList(arguments, ponFile == null)); //set isStandardizedEqualsDenoised = true if no PoN
data.add(Arrays.asList(arguments, ponFile == null || (numberOfEigenvalues != null && numberOfEigenvalues == 0))); //set isStandardizedEqualsDenoised = true if no PoN or if number of eigenvalues is zero
}
}
}
Expand Down