Skip to content

Commit

Permalink
Merge branch 'TASK-4688' into TASK-4688-2.8.4
Browse files Browse the repository at this point in the history
  • Loading branch information
j-coll committed Sep 15, 2023
2 parents abd4e68 + 9f49693 commit a270dff
Show file tree
Hide file tree
Showing 42 changed files with 104 additions and 108 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ protected InterpretationMethod getInterpretationMethod(String name) {
.setName(name)
.setDependencies(Collections.singletonList(new Software()
.setName("OpenCGA")
.setVersion(GitRepositoryState.get().getBuildVersion())
.setCommit(GitRepositoryState.get().getCommitId())));
.setVersion(GitRepositoryState.getInstance().getBuildVersion())
.setCommit(GitRepositoryState.getInstance().getCommitId())));
return method;
}

Expand Down Expand Up @@ -114,8 +114,8 @@ protected void saveInterpretation(String studyId, ClinicalAnalysis clinicalAnaly

// Interpretation method
InterpretationMethod method = new InterpretationMethod(getId(), null, null,
Collections.singletonList(new Software().setName("OpenCGA").setVersion(GitRepositoryState.get().getBuildVersion())
.setCommit(GitRepositoryState.get().getCommitId())));
Collections.singletonList(new Software().setName("OpenCGA").setVersion(GitRepositoryState.getInstance().getBuildVersion())
.setCommit(GitRepositoryState.getInstance().getCommitId())));

// Analyst
ClinicalAnalyst analyst = clinicalInterpretationManager.getAnalyst(token);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ protected void run() throws ToolException {
protected void saveInterpretation(String studyId, ClinicalAnalysis clinicalAnalysis) throws ToolException, StorageEngineException,
CatalogException, IOException {
// Interpretation method
InterpretationMethod method = new InterpretationMethod(getId(), GitRepositoryState.get().getBuildVersion(),
GitRepositoryState.get().getCommitId(), Collections.singletonList(
InterpretationMethod method = new InterpretationMethod(getId(), GitRepositoryState.getInstance().getBuildVersion(),
GitRepositoryState.getInstance().getCommitId(), Collections.singletonList(
new Software()
.setName("Exomiser")
.setRepository("Docker: " + ExomiserWrapperAnalysisExecutor.DOCKER_IMAGE_NAME)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
public class CircosLocalAnalysisExecutor extends CircosAnalysisExecutor implements StorageToolExecutor {

public final static String R_DOCKER_IMAGE = "opencb/opencga-ext-tools:"
+ GitRepositoryState.get().getBuildVersion();
+ GitRepositoryState.getInstance().getBuildVersion();
private VariantStorageManager storageManager;

private File snvsFile;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
public class GenomePlotLocalAnalysisExecutor extends GenomePlotAnalysisExecutor implements StorageToolExecutor {

public final static String R_DOCKER_IMAGE = "opencb/opencga-ext-tools:"
+ GitRepositoryState.get().getBuildVersion();
+ GitRepositoryState.getInstance().getBuildVersion();

private GenomePlotConfig plotConfig;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,31 +16,21 @@

package org.opencb.opencga.analysis.variant.hrdetect;

import htsjdk.samtools.reference.BlockCompressedIndexedFastaSequenceFile;
import htsjdk.samtools.reference.FastaSequenceIndex;
import htsjdk.samtools.reference.ReferenceSequence;
import htsjdk.samtools.util.GZIIndex;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.opencb.biodata.models.variant.StudyEntry;
import org.opencb.biodata.models.variant.Variant;
import org.opencb.biodata.models.variant.avro.VariantType;
import org.opencb.commons.datastore.core.Query;
import org.opencb.commons.datastore.core.QueryOptions;
import org.opencb.commons.datastore.core.QueryResultWriter;
import org.opencb.commons.exec.Command;
import org.opencb.commons.utils.DockerUtils;
import org.opencb.opencga.analysis.ResourceUtils;
import org.opencb.opencga.analysis.StorageToolExecutor;
import org.opencb.opencga.catalog.exceptions.CatalogException;
import org.opencb.opencga.core.common.GitRepositoryState;
import org.opencb.opencga.core.exceptions.ToolException;
import org.opencb.opencga.core.exceptions.ToolExecutorException;
import org.opencb.opencga.core.response.OpenCGAResult;
import org.opencb.opencga.core.response.VariantQueryResult;
import org.opencb.opencga.core.tools.annotations.ToolExecutor;
import org.opencb.opencga.core.tools.variant.HRDetectAnalysisExecutor;
import org.opencb.opencga.core.tools.variant.MutationalSignatureAnalysisExecutor;
import org.opencb.opencga.storage.core.exceptions.StorageEngineException;
import org.opencb.opencga.storage.core.variant.adaptors.VariantQueryParam;
import org.opencb.opencga.storage.core.variant.adaptors.iterators.VariantDBIterator;
Expand All @@ -53,14 +43,12 @@
import java.nio.file.Paths;
import java.util.*;

import static org.opencb.opencga.analysis.variant.mutationalSignature.MutationalSignatureAnalysis.CATALOGUES_FILENAME_DEFAULT;

@ToolExecutor(id="opencga-local", tool = HRDetectAnalysis.ID,
framework = ToolExecutor.Framework.LOCAL, source = ToolExecutor.Source.STORAGE)
public class HRDetectLocalAnalysisExecutor extends HRDetectAnalysisExecutor
implements StorageToolExecutor {

public final static String R_DOCKER_IMAGE = "opencb/opencga-ext-tools:" + GitRepositoryState.get().getBuildVersion();
public final static String R_DOCKER_IMAGE = "opencb/opencga-ext-tools:" + GitRepositoryState.getInstance().getBuildVersion();

private final static String CNV_FILENAME = "cnv.tsv";
private final static String INDEL_FILENAME = "indel.vcf";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,12 @@
public class MutationalSignatureLocalAnalysisExecutor extends MutationalSignatureAnalysisExecutor
implements StorageToolExecutor {

public static final String R_DOCKER_IMAGE = "opencb/opencga-ext-tools:" + GitRepositoryState.get().getBuildVersion();

private static final String SVCLASS = "SVCLASS";
private static final String EXT_SVTYPE = "EXT_SVTYPE";

public final static String R_DOCKER_IMAGE = "opencb/opencga-ext-tools:"
+ GitRepositoryState.getInstance().getBuildVersion();

private Path opencgaHome;

private Logger logger = LoggerFactory.getLogger(this.getClass());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public String getDockerImageName() {
}

public String getDockerImageVersion() {
return GitRepositoryState.get().getBuildVersion();
return GitRepositoryState.getInstance().getBuildVersion();
}

private Logger privateLogger = LoggerFactory.getLogger(DockerWrapperAnalysisExecutor.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.embedded.EmbeddedSolrServer;
import org.apache.solr.core.NodeConfig;
import org.apache.solr.core.SolrResourceLoader;
import org.junit.rules.ExternalResource;
import org.opencb.commons.datastore.solr.SolrManager;
import org.opencb.opencga.analysis.variant.manager.VariantStorageManager;
import org.opencb.opencga.core.common.GitRepositoryState;
import org.opencb.opencga.core.config.storage.StorageConfiguration;

Expand Down Expand Up @@ -40,8 +38,8 @@ protected void before() throws Throwable {

Path rootDir = getTmpRootDir();

String mainConfigSet = "opencga-rga-configset-" + GitRepositoryState.get().getBuildVersion();
String auxConfigSet = "opencga-rga-aux-configset-" + GitRepositoryState.get().getBuildVersion();
String mainConfigSet = "opencga-rga-configset-" + GitRepositoryState.getInstance().getBuildVersion();
String auxConfigSet = "opencga-rga-aux-configset-" + GitRepositoryState.getInstance().getBuildVersion();
copyConfigSetConfiguration(mainConfigSet, "managed-schema");
copyConfigSetConfiguration(auxConfigSet, "aux-managed-schema");

Expand Down
2 changes: 1 addition & 1 deletion opencga-app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@
<arg value="${build.dir}/misc/git"/>
</exec>
<exec executable="cp">
<arg value="${project.basedir}/../opencga-core/target/generated-resources/git.properties"/>
<arg value="${project.basedir}/../opencga-core/target/generated-resources/org/opencb/opencga/core/git.properties"/>
<arg value="${build.dir}/misc/git"/>
</exec>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -800,8 +800,8 @@ public void printUsage() {
if (parsedCommand.isEmpty()) {
System.err.println("");
System.err.println("Program: OpenCGA Admin (OpenCB)");
System.err.println("Version: " + GitRepositoryState.get().getBuildVersion());
System.err.println("Git commit: " + GitRepositoryState.get().getCommitId());
System.err.println("Version: " + GitRepositoryState.getInstance().getBuildVersion());
System.err.println("Git commit: " + GitRepositoryState.getInstance().getCommitId());
System.err.println("Description: Big Data platform for processing and analysing NGS data");
System.err.println("");
System.err.println("Usage: opencga-admin.sh [-h|--help] [--version] <command> [options]");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
*/
public class AdminMain {

public static final String VERSION = GitRepositoryState.get().getBuildVersion();
public static final String VERSION = GitRepositoryState.getInstance().getBuildVersion();

public static void main(String[] args) {

Expand Down Expand Up @@ -71,8 +71,8 @@ public static void main(String[] args) {
String parsedCommand = cliOptionsParser.getCommand();
if (parsedCommand == null || parsedCommand.isEmpty()) {
if (cliOptionsParser.getGeneralOptions().version) {
System.out.println("Version " + GitRepositoryState.get().getBuildVersion());
System.out.println("Git version: " + GitRepositoryState.get().getBranch() + " " + GitRepositoryState.get().getCommitId());
System.out.println("Version " + GitRepositoryState.getInstance().getBuildVersion());
System.out.println("Git version: " + GitRepositoryState.getInstance().getBranch() + " " + GitRepositoryState.getInstance().getCommitId());
System.exit(0);
} else if (cliOptionsParser.getGeneralOptions().help) {
cliOptionsParser.printUsage();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ private String parseVersion(String version) {

public static String getDefaultVersion() {
String version;
version = GitRepositoryState.get().getBuildVersion();
version = GitRepositoryState.getInstance().getBuildVersion();
// Remove extra information
version = version.split("-")[0];
return version;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -468,8 +468,8 @@ public void printUsage() {
if (parsedCommand.isEmpty()) {
System.err.println("");
System.err.println("Program: OpenCGA Analysis (OpenCB)");
System.err.println("Version: " + GitRepositoryState.get().getBuildVersion());
System.err.println("Git commit: " + GitRepositoryState.get().getCommitId());
System.err.println("Version: " + GitRepositoryState.getInstance().getBuildVersion());
System.err.println("Git commit: " + GitRepositoryState.getInstance().getCommitId());
System.err.println("Description: Big Data platform for processing and analysing NGS data");
System.err.println("");
System.err.println("Usage: opencga-internal.sh [-h|--help] [--version] <command> [options]");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
*/
public class InternalMain {

public static final String VERSION = GitRepositoryState.get().getBuildVersion();
public static final String VERSION = GitRepositoryState.getInstance().getBuildVersion();

public static void main(String[] args) {
System.exit(privateMain(args));
Expand All @@ -48,8 +48,8 @@ public static int privateMain(String[] args) {
String parsedCommand = cliOptionsParser.getCommand();
if (parsedCommand == null || parsedCommand.isEmpty()) {
if (cliOptionsParser.getGeneralOptions().version) {
System.out.println("Version " + GitRepositoryState.get().getBuildVersion());
System.out.println("Git version: " + GitRepositoryState.get().getBranch() + " " + GitRepositoryState.get().getCommitId());
System.out.println("Version " + GitRepositoryState.getInstance().getBuildVersion());
System.out.println("Git version: " + GitRepositoryState.getInstance().getBranch() + " " + GitRepositoryState.getInstance().getCommitId());
return 0;
} else if (cliOptionsParser.getGeneralOptions().help) {
cliOptionsParser.printUsage();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ public class CommandLineUtils {
private static final Logger logger = LoggerFactory.getLogger(CommandLineUtils.class);

public static String getVersionString() {
String res = PrintUtils.getKeyValueAsFormattedString("\tOpenCGA CLI version: ", "\t" + GitRepositoryState.get().getBuildVersion() + "\n");
res += PrintUtils.getKeyValueAsFormattedString("\tGit version:", "\t\t" + GitRepositoryState.get().getBranch() + " " + GitRepositoryState.get().getCommitId() + "\n");
String res = PrintUtils.getKeyValueAsFormattedString("\tOpenCGA CLI version: ", "\t" + GitRepositoryState.getInstance().getBuildVersion() + "\n");
res += PrintUtils.getKeyValueAsFormattedString("\tGit version:", "\t\t" + GitRepositoryState.getInstance().getBranch() + " " + GitRepositoryState.getInstance().getCommitId() + "\n");
res += PrintUtils.getKeyValueAsFormattedString("\tProgram:", "\t\tOpenCGA (OpenCB)" + "\n");
res += PrintUtils.getKeyValueAsFormattedString("\tDescription: ", "\t\tBig Data platform for processing and analysing NGS data" + "\n");
return res;
}

public static String getHelpVersionString() {
String res = PrintUtils.getHelpVersionFormattedString("OpenCGA CLI version: ", "\t" + GitRepositoryState.get().getBuildVersion() + "\n");
res += PrintUtils.getHelpVersionFormattedString("Git version:", "\t\t" + GitRepositoryState.get().getBranch() + " " + GitRepositoryState.get().getCommitId() + "\n");
String res = PrintUtils.getHelpVersionFormattedString("OpenCGA CLI version: ", "\t" + GitRepositoryState.getInstance().getBuildVersion() + "\n");
res += PrintUtils.getHelpVersionFormattedString("Git version:", "\t\t" + GitRepositoryState.getInstance().getBranch() + " " + GitRepositoryState.getInstance().getCommitId() + "\n");
res += PrintUtils.getHelpVersionFormattedString("Program:", "\t\tOpenCGA (OpenCB)" + "\n");
res += PrintUtils.getHelpVersionFormattedString("Description: ", "\t\tBig Data platform for processing and analysing NGS data" + "\n");
return res;
Expand Down Expand Up @@ -90,7 +90,7 @@ public static String[] processShortCuts(String[] args) {
break;
case "--build-version":
case "build-version":
println(GitRepositoryState.get().getBuildVersion());
println(GitRepositoryState.getInstance().getBuildVersion());
break;
case "logout":
return ArrayUtils.addAll(new String[]{"users"}, args);
Expand All @@ -99,7 +99,7 @@ public static String[] processShortCuts(String[] args) {
if (args.length > 1 && args[1].equals("studies")) {
println(String.join(", ", OpencgaMain.getShell().getSessionManager().getSession().getStudies()), Color.GREEN);
} else {
printWarn("Opencga version " + GitRepositoryState.get().getBuildVersion() + " can only list studies");
printWarn("Opencga version " + GitRepositoryState.getInstance().getBuildVersion() + " can only list studies");
}
} else {
printWarn("List studies is only available in Shell mode");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public void print(JobTop top) {

jobTable.restoreCursorPosition();
jobTable.println("OpenCGA jobs TOP");
jobTable.println(" Version " + GitRepositoryState.get().getBuildVersion());
jobTable.println(" Version " + GitRepositoryState.getInstance().getBuildVersion());
jobTable.println(" " + TextOutputWriter.SIMPLE_DATE_FORMAT.format(Date.from(Instant.now())));
jobTable.println();
jobTable.print(Enums.ExecutionStatus.RUNNING + ": " + top.getStats().getRunning() + ", ");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ private void init() {
private Session createEmptySession() {
Session session = new Session();
session.setHost(host);
session.setVersion(GitRepositoryState.get().getBuildVersion());
session.setVersion(GitRepositoryState.getInstance().getBuildVersion());
session.setTimestamp(System.currentTimeMillis());
session.setStudies(new ArrayList());
session.setCurrentStudy(NO_STUDY);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ public static void completeInternalStatus(Document document) {

completeStatus(internal);
Document status = internal.get("status", Document.class);
status.put("version", GitRepositoryState.get().getBuildVersion());
status.put("commit", GitRepositoryState.get().getCommitId());
status.put("version", GitRepositoryState.getInstance().getBuildVersion());
status.put("commit", GitRepositoryState.getInstance().getCommitId());

String id = status.getString("id");
if (StringUtils.isEmpty(id)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public class MetaMongoDBAdaptor extends MongoDBAdaptor implements MetaDBAdaptor
Filters.eq(ID, MongoDBAdaptorFactory.METADATA_OBJECT_ID),
Filters.eq(OLD_ID, MongoDBAdaptorFactory.METADATA_OBJECT_ID));
private final MongoDBCollection metaCollection;
private static final String VERSION = GitRepositoryState.get().getBuildVersion();
private static final String VERSION = GitRepositoryState.getInstance().getBuildVersion();

public MetaMongoDBAdaptor(MongoDBCollection metaMongoDBCollection, Configuration configuration,
MongoDBAdaptorFactory dbAdaptorFactory) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ public void audit(String operationId, String userId, Enums.Action action, Enums.
public void audit(String operationId, String userId, Enums.Action action, Enums.Resource resource, String resourceId,
String resourceUuid, String studyId, String studyUuid, ObjectMap params, AuditRecord.Status status,
ObjectMap attributes) {
String apiVersion = GitRepositoryState.get().getBuildVersion();
String apiVersion = GitRepositoryState.getInstance().getBuildVersion();
Date date = TimeUtils.getDate();

String auditId = UuidUtils.generateOpenCgaUuid(UuidUtils.Entity.AUDIT);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ public DataResult<FacetField> facetedQuery(Study study, String collection, Query
//***************** PRIVATE ****************/

private void populateConfigCollectionMap() {
String version = GitRepositoryState.get().getBuildVersion();
String version = GitRepositoryState.getInstance().getBuildVersion();

CONFIGS_COLLECTION.put(DATABASE_PREFIX + COHORT_SOLR_COLLECTION, COHORT_CONF_SET + "-" + version);
CONFIGS_COLLECTION.put(DATABASE_PREFIX + FILE_SOLR_COLLECTION, FILE_CONF_SET + "-" + version);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public void validate(TemplateManifest manifest) throws CatalogException {
}

// Check version
GitRepositoryState gitRepositoryState = GitRepositoryState.get();
GitRepositoryState gitRepositoryState = GitRepositoryState.getInstance();
String version = gitRepositoryState.getBuildVersion();
String versionShort;
if (version.contains("-")) {
Expand Down
Loading

0 comments on commit a270dff

Please sign in to comment.