Skip to content

Commit

Permalink
Merge branch 'alpha' into SCRUM-4654
Browse files Browse the repository at this point in the history
  • Loading branch information
VarunReddy1111 authored Jan 3, 2025
2 parents 5810356 + 889b888 commit 09862d5
Show file tree
Hide file tree
Showing 37 changed files with 1,052 additions and 8 deletions.
8 changes: 6 additions & 2 deletions src/main/cliapp/src/components/Actions/EntityDetailsAction.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
import { Link } from 'react-router-dom/cjs/react-router-dom.min';
import { Tooltip } from 'primereact/tooltip';

export const EntityDetailsAction = ({ identifier, disabled }) => {
export const EntityDetailsAction = ({ endpoint, identifier, disabled }) => {
const disabledClasses = disabled ? 'pointer-events-none opacity-50' : '';

if (!identifier) return null;

return (
<>
<Link to={`allele/${identifier}`} target="_blank" className={`${identifier.replace(':', '')} ${disabledClasses}`}>
<Link
to={`${endpoint}/${identifier}`}
target="_blank"
className={`${identifier.replace(':', '')} ${disabledClasses}`}
>
<i className="pi pi-info-circle"></i>
</Link>
<Tooltip target={`.${identifier.replace(':', '')}`} content={'Open Details'} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -370,8 +370,12 @@ export const GenericDataTable = (props) => {
{hasDetails && (
<Column
field="details"
editor={(props) => <EntityDetailsAction identifier={getIdentifier(props.rowData)} disabled={true} />}
body={(props) => <EntityDetailsAction identifier={getIdentifier(props)} disabled={isInEditMode} />}
editor={(props) => (
<EntityDetailsAction endpoint={endpoint} identifier={getIdentifier(props.rowData)} disabled={true} />
)}
body={(props) => (
<EntityDetailsAction endpoint={endpoint} identifier={getIdentifier(props)} disabled={isInEditMode} />
)}
showFilterMenu={false}
className={`text-center p-0 action-column ${isEditable ? 'visible' : 'hidden'}`}
bodyStyle={{ textAlign: 'center' }}
Expand Down
1 change: 1 addition & 0 deletions src/main/cliapp/src/service/DataLoadService.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ export class DataLoadService extends BaseAuthService {
'CONSTRUCT',
'ALLELE_ASSOCIATION',
'CONSTRUCT_ASSOCIATION',
'AGM_ASSOCIATION',
],
};
return bulkLoadTypes[loadType];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ private EntityFieldConstants() {
public static final String PA_SUBJECT = "phenotypeAnnotationSubject";
public static final String EXP_EXPERIMENT_SUBJECT = "entityAssayed";
public static final String ALLELE_ASSOCIATION_SUBJECT = "alleleAssociationSubject";
public static final String AGM_ASSOCIATION_SUBJECT = "agmAssociationSubject";
public static final String CODING_SEQUENCE_ASSOCIATION_SUBJECT = "codingSequenceAssociationSubject";
public static final String CONSTRUCT_ASSOCIATION_SUBJECT = "constructAssociationSubject";
public static final String EXON_ASSOCIATION_SUBJECT = "exonAssociationSubject";
Expand All @@ -32,6 +33,7 @@ private EntityFieldConstants() {
public static final String EXP_EXPERIMENT_TAXON = EXP_EXPERIMENT_SUBJECT + "." + TAXON;

public static final String ALLELE_ASSOCIATION_SUBJECT_DATA_PROVIDER = ALLELE_ASSOCIATION_SUBJECT + "." + DATA_PROVIDER;
public static final String AGM_ASSOCIATION_SUBJECT_DATA_PROVIDER = AGM_ASSOCIATION_SUBJECT + "." + DATA_PROVIDER;
public static final String CODING_SEQUENCE_ASSOCIATION_SUBJECT_DATA_PROVIDER = CODING_SEQUENCE_ASSOCIATION_SUBJECT + "." + DATA_PROVIDER;
public static final String CONSTRUCT_ASSOCIATION_SUBJECT_DATA_PROVIDER = CONSTRUCT_ASSOCIATION_SUBJECT + "." + DATA_PROVIDER;
public static final String EXON_ASSOCIATION_SUBJECT_DATA_PROVIDER = EXON_ASSOCIATION_SUBJECT + "." + DATA_PROVIDER;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ private VocabularyConstants() {
public static final String ALLELE_DISEASE_RELATION_VOCABULARY_TERM_SET = "allele_disease_relation";
public static final String AGM_DISEASE_RELATION_VOCABULARY_TERM_SET = "agm_disease_relation";

public static final String AGM_RELATION_VOCABULARY = "agm_relation";
public static final String AGM_STR_RELATION_VOCABULARY_TERM_SET = "agm_str_relation";

public static final String PHENOTYPE_RELATION_VOCABULARY = "phenotype_relation";

public static final String ALLELE_INHERITANCE_MODE_VOCABULARY = "allele_inheritance_mode";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package org.alliancegenome.curation_api.controllers.crud.associations.agmAssociations;

import java.util.List;

import org.alliancegenome.curation_api.controllers.base.BaseEntityCrudController;
import org.alliancegenome.curation_api.dao.associations.agmAssociations.AgmSequenceTargetingReagentAssociationDAO;
import org.alliancegenome.curation_api.interfaces.crud.associations.agmAssociations.AgmSequenceTargetingReagentAssociationCrudInterface;
import org.alliancegenome.curation_api.jobs.executors.associations.agmAssociations.AgmStrAssociationExecutor;
import org.alliancegenome.curation_api.model.entities.associations.agmAssociations.AgmSequenceTargetingReagentAssociation;
import org.alliancegenome.curation_api.model.ingest.dto.associations.agmAssociations.AgmSequenceTargetingReagentAssociationDTO;
import org.alliancegenome.curation_api.response.APIResponse;
import org.alliancegenome.curation_api.response.ObjectResponse;
import org.alliancegenome.curation_api.services.associations.agmAssociations.AgmStrAssociationService;

import jakarta.annotation.PostConstruct;
import jakarta.enterprise.context.RequestScoped;
import jakarta.inject.Inject;

@RequestScoped
public class AgmSequenceTargetingReagentAssociationCrudController extends
BaseEntityCrudController<AgmStrAssociationService, AgmSequenceTargetingReagentAssociation, AgmSequenceTargetingReagentAssociationDAO>
implements AgmSequenceTargetingReagentAssociationCrudInterface {

@Inject
AgmStrAssociationService agmStrAssociationService;
@Inject
AgmStrAssociationExecutor agmStrAssociationExecutor;

@Override
@PostConstruct
protected void init() {
setService(agmStrAssociationService);
}

public ObjectResponse<AgmSequenceTargetingReagentAssociation> getAssociation(Long alleleId, String relationName, Long geneId) {
return agmStrAssociationService.getAssociation(alleleId, relationName, geneId);
}

@Override
public APIResponse updateAgmStrAssociations(String dataProvider, List<AgmSequenceTargetingReagentAssociationDTO> associationData) {
return agmStrAssociationExecutor.runLoadApi(agmStrAssociationService, dataProvider, associationData);

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package org.alliancegenome.curation_api.dao.associations.agmAssociations;

import org.alliancegenome.curation_api.dao.base.BaseSQLDAO;
import org.alliancegenome.curation_api.model.entities.associations.agmAssociations.AgmSequenceTargetingReagentAssociation;

import jakarta.enterprise.context.ApplicationScoped;

@ApplicationScoped
public class AgmSequenceTargetingReagentAssociationDAO extends BaseSQLDAO<AgmSequenceTargetingReagentAssociation> {

protected AgmSequenceTargetingReagentAssociationDAO() {
super(AgmSequenceTargetingReagentAssociation.class);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public enum BackendBulkLoadType {
ORTHOLOGY("json"),
ALLELE_ASSOCIATION("json"),
CONSTRUCT_ASSOCIATION("json"),
AGM_ASSOCIATION("json"),
VARIANT("json"),
VARIATION("json"), // FMS variants as opposed to direct submission for VARIANT
VEPTRANSCRIPT("tsv"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public interface AffectedGenomicModelCrudInterface extends BaseSubmittedObjectCr
@Override
@GET
@Path("/{identifierString}")
@JsonView(View.AffectedGenomicModelView.class)
@JsonView(View.AffectedGenomicModelDetailView.class)
ObjectResponse<AffectedGenomicModel> getByIdentifier(@PathParam("identifierString") String identifierString);

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package org.alliancegenome.curation_api.interfaces.crud.associations.agmAssociations;

import java.util.List;

import org.alliancegenome.curation_api.interfaces.base.BaseIdCrudInterface;
import org.alliancegenome.curation_api.model.entities.associations.agmAssociations.AgmSequenceTargetingReagentAssociation;
import org.alliancegenome.curation_api.model.ingest.dto.associations.agmAssociations.AgmSequenceTargetingReagentAssociationDTO;
import org.alliancegenome.curation_api.response.APIResponse;
import org.alliancegenome.curation_api.response.ObjectResponse;
import org.alliancegenome.curation_api.view.View;
import org.eclipse.microprofile.openapi.annotations.tags.Tag;

import com.fasterxml.jackson.annotation.JsonView;

import jakarta.ws.rs.Consumes;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.POST;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.QueryParam;
import jakarta.ws.rs.core.MediaType;

@Path("/agmstrassociation")
@Tag(name = "CRUD - AGM Sequence Targeting Reagent Associations")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public interface AgmSequenceTargetingReagentAssociationCrudInterface extends BaseIdCrudInterface<AgmSequenceTargetingReagentAssociation> {

@GET
@Path("/findBy")
@JsonView(View.FieldsAndLists.class)
ObjectResponse<AgmSequenceTargetingReagentAssociation> getAssociation(@QueryParam("agmId") Long agmId, @QueryParam("relationName") String relationName, @QueryParam("strId") Long strId);

@POST
@Path("/bulk/{dataProvider}/associationFile")
@JsonView(View.FieldsAndLists.class)
APIResponse updateAgmStrAssociations(@PathParam("dataProvider") String dataProvider, List<AgmSequenceTargetingReagentAssociationDTO> associationData);
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.alliancegenome.curation_api.jobs.executors;

import static org.alliancegenome.curation_api.enums.BackendBulkLoadType.AGM;
import static org.alliancegenome.curation_api.enums.BackendBulkLoadType.AGM_ASSOCIATION;
import static org.alliancegenome.curation_api.enums.BackendBulkLoadType.AGM_DISEASE_ANNOTATION;
import static org.alliancegenome.curation_api.enums.BackendBulkLoadType.ALLELE;
import static org.alliancegenome.curation_api.enums.BackendBulkLoadType.ALLELE_ASSOCIATION;
Expand All @@ -17,6 +18,7 @@

import org.alliancegenome.curation_api.dao.loads.BulkLoadFileDAO;
import org.alliancegenome.curation_api.enums.BackendBulkLoadType;
import org.alliancegenome.curation_api.jobs.executors.associations.agmAssociations.AgmStrAssociationExecutor;
import org.alliancegenome.curation_api.jobs.executors.associations.alleleAssociations.AlleleGeneAssociationExecutor;
import org.alliancegenome.curation_api.jobs.executors.associations.constructAssociations.ConstructGenomicEntityAssociationExecutor;
import org.alliancegenome.curation_api.jobs.executors.gff.Gff3CDSExecutor;
Expand Down Expand Up @@ -49,6 +51,7 @@ public class BulkLoadJobExecutor {
@Inject VariantExecutor variantExecutor;
@Inject AlleleGeneAssociationExecutor alleleGeneAssociationExecutor;
@Inject ConstructGenomicEntityAssociationExecutor constructGenomicEntityAssociationExecutor;
@Inject AgmStrAssociationExecutor agmStrAssociationExecutor;
@Inject PhenotypeAnnotationExecutor phenotypeAnnotationExecutor;
@Inject GeneMolecularInteractionExecutor geneMolecularInteractionExecutor;
@Inject GeneGeneticInteractionExecutor geneGeneticInteractionExecutor;
Expand Down Expand Up @@ -77,7 +80,7 @@ public void process(BulkLoadFileHistory bulkLoadFileHistory, Boolean cleanUp) th

BackendBulkLoadType loadType = bulkLoadFileHistory.getBulkLoad().getBackendBulkLoadType();

List<BackendBulkLoadType> ingestTypes = List.of(AGM_DISEASE_ANNOTATION, ALLELE_DISEASE_ANNOTATION, GENE_DISEASE_ANNOTATION, DISEASE_ANNOTATION, AGM, ALLELE, GENE, VARIANT, CONSTRUCT, FULL_INGEST, ALLELE_ASSOCIATION, CONSTRUCT_ASSOCIATION);
List<BackendBulkLoadType> ingestTypes = List.of(AGM_DISEASE_ANNOTATION, ALLELE_DISEASE_ANNOTATION, GENE_DISEASE_ANNOTATION, DISEASE_ANNOTATION, AGM, ALLELE, GENE, VARIANT, CONSTRUCT, FULL_INGEST, ALLELE_ASSOCIATION, AGM_ASSOCIATION, CONSTRUCT_ASSOCIATION);

if (ingestTypes.contains(loadType)) {

Expand Down Expand Up @@ -112,6 +115,9 @@ public void process(BulkLoadFileHistory bulkLoadFileHistory, Boolean cleanUp) th
if (loadType == CONSTRUCT_ASSOCIATION || loadType == FULL_INGEST) {
constructGenomicEntityAssociationExecutor.execLoad(bulkLoadFileHistory, cleanUp);
}
if (loadType == AGM_ASSOCIATION || loadType == FULL_INGEST) {
agmStrAssociationExecutor.execLoad(bulkLoadFileHistory, cleanUp);
}

} else if (bulkLoadFileHistory.getBulkLoad().getBackendBulkLoadType() == BackendBulkLoadType.MOLECULE) {
moleculeExecutor.execLoad(bulkLoadFileHistory);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
package org.alliancegenome.curation_api.jobs.executors.associations.agmAssociations;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

import org.alliancegenome.curation_api.enums.BackendBulkDataProvider;
import org.alliancegenome.curation_api.jobs.executors.LoadFileExecutor;
import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFileHistory;
import org.alliancegenome.curation_api.model.entities.bulkloads.BulkManualLoad;
import org.alliancegenome.curation_api.model.ingest.dto.IngestDTO;
import org.alliancegenome.curation_api.model.ingest.dto.associations.agmAssociations.AgmSequenceTargetingReagentAssociationDTO;
import org.alliancegenome.curation_api.services.associations.agmAssociations.AgmStrAssociationService;

import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import lombok.extern.jbosslog.JBossLog;

@JBossLog
@ApplicationScoped
public class AgmStrAssociationExecutor extends LoadFileExecutor {

@Inject AgmStrAssociationService agmStrAssociationService;

public void execLoad(BulkLoadFileHistory bulkLoadFileHistory, Boolean cleanUp) {

BulkManualLoad manual = (BulkManualLoad) bulkLoadFileHistory.getBulkLoad();
BackendBulkDataProvider dataProvider = manual.getDataProvider();
log.info("Running with dataProvider: " + dataProvider.name());

IngestDTO ingestDto = readIngestFile(bulkLoadFileHistory, AgmSequenceTargetingReagentAssociationDTO.class);
if (ingestDto == null) {
return;
}

List<AgmSequenceTargetingReagentAssociationDTO> associations = ingestDto.getAgmStrAssociationIngestSet();
if (associations == null) {
associations = new ArrayList<>();
}

List<Long> associationIdsLoaded = new ArrayList<>();
List<Long> associationIdsBefore = new ArrayList<>();
if (cleanUp) {
associationIdsBefore.addAll(agmStrAssociationService.getAssociationsByDataProvider(dataProvider));
associationIdsBefore.removeIf(Objects::isNull);
}

bulkLoadFileHistory.getBulkLoadFile().setRecordCount(associations.size() + bulkLoadFileHistory.getBulkLoadFile().getRecordCount());
bulkLoadFileDAO.merge(bulkLoadFileHistory.getBulkLoadFile());

bulkLoadFileHistory.setCount(associations.size());
updateHistory(bulkLoadFileHistory);

boolean success = runLoad(agmStrAssociationService, bulkLoadFileHistory, dataProvider, associations, associationIdsLoaded);
if (success && cleanUp) {
runCleanup(agmStrAssociationService, bulkLoadFileHistory, dataProvider.name(), associationIdsBefore, associationIdsLoaded, "agm str association");
}
bulkLoadFileHistory.finishLoad();
updateHistory(bulkLoadFileHistory);
updateExceptions(bulkLoadFileHistory);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import lombok.ToString;
import org.alliancegenome.curation_api.constants.LinkMLSchemaConstants;
import org.alliancegenome.curation_api.interfaces.AGRCurationSchemaVersion;
import org.alliancegenome.curation_api.model.entities.associations.agmAssociations.AgmSequenceTargetingReagentAssociation;
import org.alliancegenome.curation_api.model.entities.associations.constructAssociations.ConstructGenomicEntityAssociation;
import org.alliancegenome.curation_api.model.entities.slotAnnotations.agmSlotAnnotations.AgmSecondaryIdSlotAnnotation;
import org.alliancegenome.curation_api.view.View;
Expand All @@ -24,7 +25,7 @@
@Entity
@Data
@EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true)
@ToString(exclude = {"agmDiseaseAnnotations", "constructGenomicEntityAssociations", "agmSecondaryIds"}, callSuper = true)
@ToString(exclude = {"agmDiseaseAnnotations", "constructGenomicEntityAssociations", "agmSecondaryIds", "agmSequenceTargetingReagentAssociations"}, callSuper = true)
@Schema(name = "AffectedGenomicModel", description = "POJO that represents the AGM")
@AGRCurationSchemaVersion(min = "1.5.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = {GenomicEntity.class}, partial = true)
public class AffectedGenomicModel extends GenomicEntity {
Expand Down Expand Up @@ -68,4 +69,16 @@ public class AffectedGenomicModel extends GenomicEntity {
@Column(columnDefinition = "TEXT")
private List<String> synonyms;

@IndexedEmbedded(includePaths = {
"agmSequenceTargetingReagentAssociationObject.name",
"agmSequenceTargetingReagentAssociationObject.name_keyword",
"agmSequenceTargetingReagentAssociationObject.synonyms",
"agmSequenceTargetingReagentAssociationObject.synonyms_keyword",
"agmSequenceTargetingReagentAssociationObject.secondaryIdentifiers",
"agmSequenceTargetingReagentAssociationObject.secondaryIdentifiers_keyword"
})
@OneToMany(mappedBy = "agmAssociationSubject", cascade = CascadeType.ALL, orphanRemoval = true)
@JsonView({ View.FieldsAndLists.class, View.AffectedGenomicModelDetailView.class })
private List<AgmSequenceTargetingReagentAssociation> agmSequenceTargetingReagentAssociations;

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import org.alliancegenome.curation_api.constants.LinkMLSchemaConstants;
import org.alliancegenome.curation_api.interfaces.AGRCurationSchemaVersion;
import org.alliancegenome.curation_api.model.entities.associations.agmAssociations.AgmSequenceTargetingReagentAssociation;
import org.alliancegenome.curation_api.model.entities.associations.sequenceTargetingReagentAssociations.SequenceTargetingReagentGeneAssociation;
import org.alliancegenome.curation_api.view.View;
import org.eclipse.microprofile.openapi.annotations.media.Schema;
Expand Down Expand Up @@ -36,7 +37,7 @@
@Entity
@Data
@EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true)
@ToString(exclude = { "sequenceTargetingReagentGeneAssociations" }, callSuper = true)
@ToString(exclude = { "sequenceTargetingReagentGeneAssociations", "agmSequenceTargetingReagentAssociations" }, callSuper = true)
@Schema(name = "SequenceTargetingReagent", description = "POJO that represents the SequenceTargetingReagent")
@AGRCurationSchemaVersion(min = "2.3.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { GenomicEntity.class }, partial = true)
public class SequenceTargetingReagent extends GenomicEntity {
Expand Down Expand Up @@ -73,4 +74,8 @@ public class SequenceTargetingReagent extends GenomicEntity {
@OneToMany(mappedBy = "sequenceTargetingReagentAssociationSubject", cascade = CascadeType.ALL, orphanRemoval = true)
@JsonView({ View.FieldsAndLists.class, View.SequenceTargetingReagentDetailView.class })
private List<SequenceTargetingReagentGeneAssociation> sequenceTargetingReagentGeneAssociations;

@OneToMany(mappedBy = "agmSequenceTargetingReagentAssociationObject", cascade = CascadeType.ALL, orphanRemoval = true)
@JsonView({ View.FieldsAndLists.class, View.SequenceTargetingReagentDetailView.class })
private List<AgmSequenceTargetingReagentAssociation> agmSequenceTargetingReagentAssociations;
}
Loading

0 comments on commit 09862d5

Please sign in to comment.