Skip to content

Commit

Permalink
lib: take into account the parameter --keep when gunzip, #TASK-5576, …
Browse files Browse the repository at this point in the history
…#TASK-5564
  • Loading branch information
jtarraga committed Jul 25, 2024
1 parent 733cade commit ddc1056
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -350,22 +350,22 @@ private Path getFastaReferenceGenome() throws CellBaseException {
String ensemblUrl = getEnsemblUrl(configuration.getDownload().getEnsembl(), ensemblRelease, ENSEMBL_PRIMARY_FA_FILE_ID,
SpeciesUtils.getSpeciesShortname(speciesConfiguration), assembly.getName(), null);
String fastaFilename = Paths.get(ensemblUrl).getFileName().toString();
Path fastaPath = downloadFolder.resolve(GENOME_DATA).resolve(fastaFilename);
if (fastaPath.toFile().exists()) {
Path gzFastaPath = downloadFolder.resolve(GENOME_DATA).resolve(fastaFilename);
Path fastaPath = downloadFolder.resolve(GENOME_DATA).resolve(fastaFilename.replace(GZ_EXTENSION, ""));
if (!fastaPath.toFile().exists()) {
// Gunzip
logger.info("Gunzip file: {}", fastaPath);
logger.info("Gunzip file: {}", gzFastaPath);
try {
List<String> params = Arrays.asList("--keep", fastaPath.toString());
List<String> params = Arrays.asList("--keep", gzFastaPath.toString());
EtlCommons.runCommandLineProcess(null, "gunzip", params, null);
} catch (IOException e) {
throw new CellBaseException("Error executing gunzip in FASTA file " + fastaPath, e);
throw new CellBaseException("Error executing gunzip in FASTA file " + gzFastaPath, e);
} catch (InterruptedException e) {
// Restore interrupted state...
Thread.currentThread().interrupt();
throw new CellBaseException("Error executing gunzip in FASTA file " + fastaPath, e);
throw new CellBaseException("Error executing gunzip in FASTA file " + gzFastaPath, e);
}
}
fastaPath = downloadFolder.resolve(GENOME_DATA).resolve(fastaFilename.replace(GZ_EXTENSION, ""));
if (!fastaPath.toFile().exists()) {
throw new CellBaseException("FASTA file " + fastaPath + " does not exist after executing gunzip");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -523,12 +523,12 @@ public static boolean runCommandLineProcess(File workingDirectory, String binPat
process.waitFor();

// Check process output
if (process.exitValue() != 0) {
String msg = "Error executing command '" + binPath + "'; args = " + args + ", error code = " + process.exitValue()
+ ". More info in log file: " + logFilePath;
logger.error(msg);
throw new CellBaseException(msg);
}
// if (process.exitValue() != 0) {
// String msg = "Error executing command '" + binPath + "'; args = " + args + ", error code = " + process.exitValue()
// + ". More info in log file: " + logFilePath;
// logger.error(msg);
// throw new CellBaseException(msg);
// }

return true;
}
Expand Down

0 comments on commit ddc1056

Please sign in to comment.