-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2379 from opencb/TASK-4158
TASK-4158
- Loading branch information
Showing
120 changed files
with
1,940 additions
and
843 deletions.
There are no files selected for viewing
63 changes: 63 additions & 0 deletions
63
...analysis/src/main/java/org/opencb/opencga/analysis/clinical/ClinicalAnalysisLoadTask.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package org.opencb.opencga.analysis.clinical; | ||
|
||
import org.apache.commons.lang3.StringUtils; | ||
import org.opencb.opencga.analysis.tools.OpenCgaToolScopeStudy; | ||
import org.opencb.opencga.catalog.managers.FileManager; | ||
import org.opencb.opencga.catalog.models.ClinicalAnalysisLoadResult; | ||
import org.opencb.opencga.core.exceptions.ToolException; | ||
import org.opencb.opencga.core.models.clinical.ClinicalAnalysisLoadParams; | ||
import org.opencb.opencga.core.models.common.Enums; | ||
import org.opencb.opencga.core.models.file.File; | ||
import org.opencb.opencga.core.tools.annotations.Tool; | ||
import org.opencb.opencga.core.tools.annotations.ToolParams; | ||
|
||
import java.nio.file.Path; | ||
import java.nio.file.Paths; | ||
import java.util.Map; | ||
|
||
@Tool(id = ClinicalAnalysisLoadTask.ID, resource = Enums.Resource.CLINICAL_ANALYSIS, description = ClinicalAnalysisLoadTask.DESCRIPTION) | ||
public class ClinicalAnalysisLoadTask extends OpenCgaToolScopeStudy { | ||
public final static String ID = "load"; | ||
public static final String DESCRIPTION = "Load clinical analyses from a file"; | ||
|
||
private Path filePath; | ||
|
||
@ToolParams | ||
protected ClinicalAnalysisLoadParams params = new ClinicalAnalysisLoadParams(); | ||
|
||
@Override | ||
protected void check() throws Exception { | ||
super.check(); | ||
|
||
String fileStr = params.getFile(); | ||
if (StringUtils.isEmpty(fileStr)) { | ||
throw new ToolException("Missing input file when loading clinical analyses."); | ||
} | ||
|
||
File file = catalogManager.getFileManager().get(getStudy(), fileStr, FileManager.INCLUDE_FILE_URI_PATH, token).first(); | ||
filePath = Paths.get(file.getUri()); | ||
if (!filePath.toFile().exists()) { | ||
throw new ToolException("Input file '" + fileStr + "' does not exist: " + filePath); | ||
} | ||
} | ||
|
||
@Override | ||
protected void run() throws Exception { | ||
step(() -> { | ||
ClinicalAnalysisLoadResult loadResult = catalogManager.getClinicalAnalysisManager().load(getStudy(), filePath, token); | ||
|
||
// Add results as attributes | ||
addAttribute("Num. clinical analyses loaded", loadResult.getNumLoaded()); | ||
addAttribute("Num. clinical analyses not loaded", loadResult.getFailures().size()); | ||
addAttribute("Loading time (in sec.)", loadResult.getTime()); | ||
addAttribute("Clinical analyses file name", loadResult.getFilename()); | ||
|
||
// Add warnings with the not loaded clinical analysis | ||
if (loadResult.getFailures().size() > 0) { | ||
for (Map.Entry<String, String> entry : loadResult.getFailures().entrySet()) { | ||
addWarning("Clinical analysis " + entry.getKey() + " could not be loaded due to error: " + entry.getValue()); | ||
} | ||
} | ||
}); | ||
} | ||
} |
398 changes: 199 additions & 199 deletions
398
...sis/src/main/java/org/opencb/opencga/analysis/clinical/ClinicalInterpretationManager.java
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.