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

Don't require python to just instantiate tool classes. #8128

Merged
merged 2 commits into from
Dec 23, 2022
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 @@ -205,9 +205,7 @@ public class CNNScoreVariants extends TwoPassVariantWalker {
@Argument(fullName = "python-profile", shortName = "python-profile", doc = "Run the tool with the Python CProfiler on and write results to this file.", optional = true)
private File pythonProfileResults;

// Create the Python executor. This doesn't actually start the Python process, but verifies that
// the requestedPython executable exists and can be located.
final StreamingPythonScriptExecutor<String> pythonExecutor = new StreamingPythonScriptExecutor<>(true);
private StreamingPythonScriptExecutor<String> pythonExecutor;

private List<String> batchList = new ArrayList<>(inferenceBatchSize);

Expand Down Expand Up @@ -284,6 +282,10 @@ public void onTraversalStart() {
}
}

// Create the Python executor. This doesn't actually start the Python process, but verifies that
// the requestedPython executable exists and can be located.
pythonExecutor = new StreamingPythonScriptExecutor<>(true);

final VCFHeader inputHeader = getHeaderForVariants();
if (inputHeader.getGenotypeSamples().size() > 1) {
logger.warn("CNNScoreVariants is a single sample tool but the input VCF has more than 1 sample.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,17 +129,19 @@ public class CNNVariantTrain extends CommandLineProgram {
@Argument(fullName = "annotation-set", shortName = "annotation-set", doc = "Which set of annotations to use.", optional = true)
private String annotationSet = "best_practices";

// Start the Python executor. This does not actually start the Python process, but fails if python can't be located
final PythonScriptExecutor pythonExecutor = new PythonScriptExecutor(true);
private PythonScriptExecutor pythonExecutor;


@Override
protected void onStartup() {
PythonScriptExecutor.checkPythonEnvironmentForPackage("vqsr_cnn");
// Start the Python executor. This does not actually start the Python process, but fails if python can't be located
pythonExecutor = new PythonScriptExecutor(true);
}

@Override
protected Object doWork() {

final Resource pythonScriptResource = new Resource("training.py", CNNVariantTrain.class);
List<String> arguments = new ArrayList<>(Arrays.asList(
"--data_dir", inputTensorDir,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,16 +117,19 @@ public class CNNVariantWriteTensors extends CommandLineProgram {
@Argument(fullName = "max-tensors", shortName = "max-tensors", doc = "Maximum number of tensors to write.", optional = true, minValue = 0)
private int maxTensors = 1000000;

// Start the Python executor. This does not actually start the Python process, but fails if python can't be located
final PythonScriptExecutor pythonExecutor = new PythonScriptExecutor(true);
private PythonScriptExecutor pythonExecutor;

@Override
protected void onStartup() {
PythonScriptExecutor.checkPythonEnvironmentForPackage("vqsr_cnn");

// Start the Python executor. This does not actually start the Python process, but fails if python can't be located
pythonExecutor = new PythonScriptExecutor(true);
}

@Override
protected Object doWork() {

final Resource pythonScriptResource = new Resource("training.py", CNNVariantWriteTensors.class);
List<String> arguments = new ArrayList<>(Arrays.asList(
"--reference_fasta", reference,
Expand Down