Skip to content

Commit

Permalink
Merge pull request #83 from KPMP/develop
Browse files Browse the repository at this point in the history
Q1 2023 Atlas Release
  • Loading branch information
zwright authored Mar 28, 2023
2 parents 3f4c0cf + 16fa10b commit c98a86d
Show file tree
Hide file tree
Showing 166 changed files with 2,178 additions and 533 deletions.
621 changes: 617 additions & 4 deletions .classpath
100644 → 100755

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions .gitignore
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ build
.settings
bin
.gradle
.DS_Store
20 changes: 9 additions & 11 deletions .project
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,27 @@
<projectDescription>
<name>pegasus-data</name>
<comment></comment>
<projects>
</projects>
<projects/>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
</natures>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
<arguments/>
</buildCommand>
<buildCommand>
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
<arguments>
</arguments>
<arguments/>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
</natures>
<linkedResources/>
<filteredResources>
<filter>
<id>1</id>
<name></name>
<type>30</type>
<name/>
<matcher>
<id>org.eclipse.core.resources.regexFilterMatcher</id>
<arguments>node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
Expand Down
Empty file modified .travis.yml
100644 → 100755
Empty file.
Empty file modified Dockerfile
100644 → 100755
Empty file.
8 changes: 8 additions & 0 deletions README.md
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,11 @@ Repository for the Atlas Explorer Tool service layer
2. Update .env ENV_MYSQL_PASSWORD to the password for QA KE
3. Add your IP address to a new security group called sg-0597e054f11d2e31a (Developer to KE Mariadb)
4. Restart your knowledge-environment (don't worry that you have your own copy of mariadb, it'll be ignored)

If you have already followed these steps and are still having trouble connecting, check to see if your ip address has changed, you may need to update the security group rules

# Talking to GraphQL

1. Start up your atlas/knowledge-environment server
2. Open a tool like GraphQLPlayground and connect to "http://localhost:3030/graphql"
3. Write and execute your query
3 changes: 2 additions & 1 deletion build.gradle
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ apply plugin: 'io.spring.dependency-management'

jar {
baseName='pegasus-data'
version= '2.0'
version= '1.7'
}

repositories {
Expand All @@ -46,6 +46,7 @@ dependencies {
testImplementation 'org.mockito:mockito-core'
testImplementation 'org.springframework.boot:spring-boot-starter-test:2.2.0.RELEASE'
implementation 'org.springframework.boot:spring-boot-starter-cache'
implementation 'com.hazelcast:hazelcast-all:4.2.5'
}

springBoot {
Expand Down
Empty file modified gradle/wrapper/gradle-wrapper.jar
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip
Empty file modified gradlew.bat
100644 → 100755
Empty file.
Empty file modified src/main/java/org/.DS_Store
100644 → 100755
Empty file.
Empty file modified src/main/java/org/kpmp/Application.java
100644 → 100755
Empty file.
Empty file modified src/main/java/org/kpmp/DataTypeEnum.java
100644 → 100755
Empty file.
Empty file modified src/main/java/org/kpmp/FullDataTypeEnum.java
100644 → 100755
Empty file.
Empty file modified src/main/java/org/kpmp/OmicsTypeEnum.java
100644 → 100755
Empty file.
28 changes: 24 additions & 4 deletions src/main/java/org/kpmp/Query.java
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
import org.kpmp.cellType.CellTypeService;
import org.kpmp.cellTypeSummary.ClusterHierarchy;
import org.kpmp.cellTypeSummary.ClusterHierarchyService;
import org.kpmp.dataSummary.AtlasRepoSummaryResult;
import org.kpmp.dataSummary.DataSummaryService;
import org.kpmp.datasetSummary.DatasetSummary;
import org.kpmp.dataSummary.DataTypeSummary;
import org.kpmp.gene.GeneService;
import org.kpmp.gene.MyGeneInfoHit;
import org.kpmp.geneExpression.RTExpressionByTissueType;
Expand All @@ -22,6 +23,7 @@
import org.kpmp.participant.ParticipantDataTypeSummary;
import org.kpmp.participant.ParticipantService;
import org.kpmp.participant.ParticipantSummaryDataset;
import org.kpmp.participant.ParticipantTissueTypeSummary;
import org.kpmp.umap.PlotData;
import org.kpmp.umap.UmapDataService;
import org.slf4j.Logger;
Expand Down Expand Up @@ -99,7 +101,7 @@ public PlotData getUmapPlotData(String dataType, String geneSymbol, String tissu
}
}

public List<DatasetSummary> getGeneDatasetInformation(String geneSymbol) throws Exception {
public List<DataTypeSummary> getGeneDatasetInformation(String geneSymbol) throws Exception {
try {
return geneExpressionSummaryService.getGeneDatasetInformation(geneSymbol);
} catch (Exception e) {
Expand All @@ -108,7 +110,7 @@ public List<DatasetSummary> getGeneDatasetInformation(String geneSymbol) throws
}
}

public List<DatasetSummary> getSummaryData() throws Exception {
public List<DataTypeSummary> getSummaryData() throws Exception {
try {
return dataSummaryService.getSummaryData();
} catch (Exception e) {
Expand Down Expand Up @@ -165,4 +167,22 @@ public ParticipantSummaryDataset participantSummaryDataset(String redcap_id) thr
public ParticipantSummaryDataset participantClinicalDataset(String redcap_id) throws Exception {
return this.participantSummaryDataset(redcap_id);
}
}

public List<ParticipantTissueTypeSummary> getTissueTypeSummaryData() throws Exception {
try {
return participantService.getTissueData();
} catch (Exception e) {
logger.error(e.getMessage());
throw e;
}
}

public AtlasRepoSummaryResult getAtlasSummaryRows() throws Exception {
try {
return dataSummaryService.getAtlasRepoSummary();
} catch (Exception e) {
logger.error("Unable to get Atlas Summary data: ", e.getMessage());
throw e;
}
}
}
Empty file modified src/main/java/org/kpmp/RTComparisonTypeEnum.java
100644 → 100755
Empty file.
Empty file modified src/main/java/org/kpmp/TissueTypeEnum.java
100644 → 100755
Empty file.
Empty file modified src/main/java/org/kpmp/WebConfig.java
100644 → 100755
Empty file.
4 changes: 3 additions & 1 deletion src/main/java/org/kpmp/autocomplete/AutocompleteResult.java
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package org.kpmp.autocomplete;

import java.io.Serializable;
import java.util.List;

public class AutocompleteResult {
public class AutocompleteResult implements Serializable {

private static final long serialVersionUID = 762733408490639258L;
private String value;
private String name;
private String id;
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/org/kpmp/autocomplete/AutocompleteService.java
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import org.kpmp.gene.GeneService;
import org.kpmp.gene.MyGeneInfoHit;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

@Service
Expand All @@ -28,6 +29,7 @@ public AutocompleteService(GeneService geneService, CellTypeRepository cellTypeR
this.cellTypeRepository = cellTypeRepository;
}

@Cacheable("autocompleteQuery")
public List<AutocompleteResult> query(String searchTerm) throws IOException, Exception {
List<MyGeneInfoHit> myGeneInfoHits = geneService.querySymbolAndAlias(searchTerm);
List<CellType> cellTypes = cellTypeRepository.findByCellTypeContainingOrSynonymContaining(searchTerm);
Expand All @@ -40,6 +42,7 @@ public List<AutocompleteResult> query(String searchTerm) throws IOException, Exc
return myGeneResults;
}

@Cacheable("myGeneInfoHitsToAutocompleteResults")
public List<AutocompleteResult> convertMyGeneInfoHitsToAutocompleteResults(List<MyGeneInfoHit> hits) {
List<AutocompleteResult> autocompleteResults = new ArrayList<>();
for (MyGeneInfoHit hit : hits) {
Expand All @@ -49,6 +52,7 @@ public List<AutocompleteResult> convertMyGeneInfoHitsToAutocompleteResults(List<
return autocompleteResults;
}

@Cacheable("cellTypesToAutocompleteResults")
public List<AutocompleteResult> convertCellTypesToAutocompleteResults(List<CellType> cellTypes,
List<CellType> regions, List<CellType> subregions) {
List<CellType> cellTypeListNoDupes = cellTypes.stream().distinct().collect(Collectors.toList());
Expand Down
5 changes: 4 additions & 1 deletion src/main/java/org/kpmp/cellType/CellType.java
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.kpmp.cellType;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
Expand All @@ -14,7 +15,9 @@

@Entity
@Table(name = "cell_type")
public class CellType {
public class CellType implements Serializable {

private static final long serialVersionUID = -7240769211757430938L;

@Id
@Column(name = "cell_type_id")
Expand Down
11 changes: 5 additions & 6 deletions src/main/java/org/kpmp/cellType/CellTypeHierarchy.java
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.kpmp.cellType;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
Expand All @@ -8,8 +9,9 @@
import org.springframework.stereotype.Component;

@Component
public class CellTypeHierarchy {

public class CellTypeHierarchy implements Serializable {

private static final long serialVersionUID = 4174487460309851924L;
private Map<String, CellTypeStructureRegion> cellTypeRegionMap = new HashMap<>();

public List<CellTypeStructureRegion> getCellTypeRegions() {
Expand All @@ -19,7 +21,7 @@ public List<CellTypeStructureRegion> getCellTypeRegions() {
}

public void addCellTypeStructureRegion(CellTypeStructureRegion region) {

if (cellTypeRegionMap.containsKey(region.getRegionName())) {
CellTypeStructureRegion existingRegion = cellTypeRegionMap.get(region.getRegionName());
List<CellTypeStructureSubregion> subregions = region.getCellTypeSubregions();
Expand All @@ -31,7 +33,4 @@ public void addCellTypeStructureRegion(CellTypeStructureRegion region) {
}
}



}

Empty file modified src/main/java/org/kpmp/cellType/CellTypeHierarchyResolver.java
100644 → 100755
Empty file.
5 changes: 5 additions & 0 deletions src/main/java/org/kpmp/cellType/CellTypeRepository.java
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.util.List;

import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.query.Param;
Expand All @@ -10,17 +11,21 @@
@Repository
public interface CellTypeRepository extends CrudRepository<CellType, Integer> {

@Cacheable("cellTypeContainingOrSynonymContaining")
@Query(value = "SELECT ct.*, cs.* " + " FROM cell_type ct "
+ " JOIN celltype_synonym cs ON (ct.cell_type_id = cs.cell_type_id AND cs.cell_type_synonym LIKE %:searchTerm%) "
+ " UNION " + " SELECT ct.*, cs.* " + " FROM cell_type ct "
+ " LEFT JOIN celltype_synonym cs ON ct.cell_type_id = cs.cell_type_id "
+ " WHERE ct.cell_type LIKE %:searchTerm% ", nativeQuery = true)
List<CellType> findByCellTypeContainingOrSynonymContaining(@Param("searchTerm") String searchTerm);

@Cacheable("cellTypeIsNotNullOrderByCellTypeOrdering")
List<CellType> findAllByCellTypeIsNotNullOrderByCellTypeOrdering();

@Cacheable("structureRegionContaining")
List<CellType> findByStructureRegionContaining(String searchTerm);

@Cacheable("structureSubregionContaining")
List<CellType> findByStructureSubregionContaining(String searchTerm);

}
Empty file modified src/main/java/org/kpmp/cellType/CellTypeService.java
100644 → 100755
Empty file.
4 changes: 3 additions & 1 deletion src/main/java/org/kpmp/cellType/CellTypeStructureRegion.java
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package org.kpmp.cellType;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class CellTypeStructureRegion {
public class CellTypeStructureRegion implements Serializable {

private static final long serialVersionUID = 3141535632314917816L;
private String regionName;
private Map<String, CellTypeStructureSubregion> subregionMap = new HashMap<>();
private List<String> subregionOrderdList = new ArrayList<>();
Expand Down
Empty file.
4 changes: 3 additions & 1 deletion src/main/java/org/kpmp/cellType/CellTypeStructureSubregion.java
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package org.kpmp.cellType;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import com.google.common.base.Objects;

public class CellTypeStructureSubregion {
public class CellTypeStructureSubregion implements Serializable {

private static final long serialVersionUID = 1366955014710403152L;
private String subregionName;
private List<CellType> cellTypes = new ArrayList<>();

Expand Down
52 changes: 28 additions & 24 deletions src/main/java/org/kpmp/cellType/CellTypeSynonym.java
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package org.kpmp.cellType;

import javax.persistence.FetchType;
import javax.persistence.Id;
import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
Expand All @@ -12,33 +14,35 @@
@Entity
@Table(name = "celltype_synonym")
@IdClass(CellTypeSynonymId.class)
public class CellTypeSynonym {
public class CellTypeSynonym implements Serializable {

private static final long serialVersionUID = -5650797130903696615L;

@Id
@Column(name="cell_type_id")
private int cellTypeId;
@Id
@Column(name = "cell_type_id")
private int cellTypeId;

@Id
@Column(name="cell_type_synonym")
private String cellTypeSynonym;
@Id
@Column(name = "cell_type_synonym")
private String cellTypeSynonym;

@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name="cell_type_id", nullable = false, insertable = false, updatable = false)
private CellType cellType;
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "cell_type_id", nullable = false, insertable = false, updatable = false)
private CellType cellType;

public int getCellTypeId() {
return cellTypeId;
}
public int getCellTypeId() {
return cellTypeId;
}

public void setCellTypeId(int cellTypeId) {
this.cellTypeId = cellTypeId;
}
public void setCellTypeId(int cellTypeId) {
this.cellTypeId = cellTypeId;
}

public String getCellTypeSynonym() {
return cellTypeSynonym;
}
public String getCellTypeSynonym() {
return cellTypeSynonym;
}

public void setCellTypeSynonym(String cellTypeSynonym) {
this.cellTypeSynonym = cellTypeSynonym;
}
public void setCellTypeSynonym(String cellTypeSynonym) {
this.cellTypeSynonym = cellTypeSynonym;
}
}
Empty file modified src/main/java/org/kpmp/cellType/CellTypeSynonymId.java
100644 → 100755
Empty file.
6 changes: 5 additions & 1 deletion src/main/java/org/kpmp/cellTypeSummary/ClusterHiearchyRepository.java
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,22 @@

import java.util.List;

import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.query.Param;

interface ClusterHiearchyRepository extends CrudRepository<ClusterHierarchy, ClusterHierarchyId> {

@Override
@Cacheable("clusterHierarchy")
List<ClusterHierarchy> findAll();

@Cacheable("clusterHierarchyCt")
@Query(value = "CALL cluster_hierarchy_sp(:cell_type);", nativeQuery = true)
List<ClusterHierarchy> findByCellType(@Param("cell_type") String cellType);

@Query(value = "CALL cluster_hierarchy_by_cluster_sp(:cluster);", nativeQuery = true)
@Cacheable("clusterHierarchyCluster")
@Query(value = "CALL cluster_hierarchy_by_cluster_sp(:cluster);", nativeQuery = true)
ClusterHierarchy findFirstByClusterOrRegion(String cluster);
}
Loading

0 comments on commit c98a86d

Please sign in to comment.