use of org.broadinstitute.hellbender.utils.io.Resource in project gatk by broadinstitute.
the class PlotACNVResults method writeSegmentedAlleleFractionPlot.
/**
* @param sampleName Sample name derived from input files
* @param contigNames List containing contig names
* @param contigLengths List containing contig lengths (same order as contigNames)
*/
private void writeSegmentedAlleleFractionPlot(final String sampleName, final List<String> contigNames, final List<Integer> contigLengths) {
//names separated by delimiter
final String contigNamesArg = contigNames.stream().collect(Collectors.joining(CONTIG_DELIMITER));
//lengths separated by delimiter
final String contigLengthsArg = contigLengths.stream().map(Object::toString).collect(Collectors.joining(CONTIG_DELIMITER));
final String outputDirArg = addTrailingSlashIfNecessary(outputDir);
final RScriptExecutor executor = new RScriptExecutor();
//this runs the R statement "source("CNVPlottingLibrary.R")" before the main script runs
executor.addScript(new Resource(CNV_PLOTTING_R_LIBRARY, PlotSegmentedCopyRatio.class));
executor.addScript(new Resource(ACNV_PLOTTING_R_SCRIPT, PlotACNVResults.class));
//--args is needed for Rscript to recognize other arguments properly
executor.addArgs("--args", "--sample_name=" + sampleName, "--snp_counts_file=" + snpCountsFile, "--tangent_file=" + tangentFile, "--segments_file=" + segmentsFile, "--contig_names=" + contigNamesArg, "--contig_lengths=" + contigLengthsArg, "--output_dir=" + outputDirArg, "--output_prefix=" + outputPrefix);
executor.exec();
}
Aggregations