-
Notifications
You must be signed in to change notification settings - Fork 513
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 #10097 from cBioPortal/master
Merge master into v5.3.0
- Loading branch information
Showing
56 changed files
with
2,052 additions
and
694 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package org.cbioportal.model; | ||
|
||
/** | ||
* Data that can be binned, clinical or custom | ||
*/ | ||
public interface Binnable { | ||
String getAttrId(); | ||
String getAttrValue(); | ||
String getSampleId(); | ||
String getPatientId(); | ||
String getStudyId(); | ||
Boolean isPatientAttribute(); | ||
} |
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
9 changes: 9 additions & 0 deletions
9
service/src/main/java/org/cbioportal/service/AttributeByStudyService.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,9 @@ | ||
package org.cbioportal.service; | ||
|
||
import org.cbioportal.model.ClinicalAttribute; | ||
|
||
import java.util.List; | ||
|
||
public interface AttributeByStudyService { | ||
List<ClinicalAttribute> getClinicalAttributesByStudyIdsAndAttributeIds(List<String> studyIds, List<String> attributeIds); | ||
} |
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
10 changes: 10 additions & 0 deletions
10
service/src/main/java/org/cbioportal/service/CustomDataService.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,10 @@ | ||
package org.cbioportal.service; | ||
|
||
import org.cbioportal.service.util.CustomDataSession; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
|
||
public interface CustomDataService { | ||
Map<String, CustomDataSession> getCustomDataSessions(List<String> attributes); | ||
} |
58 changes: 58 additions & 0 deletions
58
service/src/main/java/org/cbioportal/service/impl/CustomDataServiceImpl.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,58 @@ | ||
package org.cbioportal.service.impl; | ||
|
||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import org.cbioportal.service.CustomDataService; | ||
import org.cbioportal.service.util.CustomDataSession; | ||
import org.cbioportal.service.util.SessionServiceRequestHandler; | ||
import org.cbioportal.session_service.domain.SessionType; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Service; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.concurrent.CompletableFuture; | ||
import java.util.stream.Collectors; | ||
|
||
@Service | ||
public class CustomDataServiceImpl implements CustomDataService { | ||
@Autowired | ||
private SessionServiceRequestHandler sessionServiceRequestHandler; | ||
|
||
@Autowired | ||
private ObjectMapper sessionServiceObjectMapper; | ||
|
||
/** | ||
* Retrieve CustomDataSession from session service for custom data attributes. | ||
* @param customAttributeIds - attribute id/hash of custom data used as session service key. | ||
* @return Map of custom data attribute id to the CustomDataSession | ||
*/ | ||
@Override | ||
public Map<String, CustomDataSession> getCustomDataSessions(List<String> customAttributeIds) { | ||
Map<String, CompletableFuture<CustomDataSession>> postFuturesMap = customAttributeIds.stream() | ||
.collect(Collectors.toMap( | ||
attributeId -> attributeId, | ||
attributeId -> CompletableFuture.supplyAsync(() -> { | ||
try { | ||
String customDataSessionJson = sessionServiceRequestHandler.getSessionDataJson( | ||
SessionType.custom_data, | ||
attributeId | ||
); | ||
return sessionServiceObjectMapper.readValue(customDataSessionJson, CustomDataSession.class); | ||
} catch (Exception e) { | ||
return null; | ||
} | ||
}) | ||
)); | ||
|
||
CompletableFuture.allOf(postFuturesMap.values().toArray(new CompletableFuture[postFuturesMap.size()])).join(); | ||
|
||
Map<String, CustomDataSession> customDataSessions = postFuturesMap.entrySet().stream() | ||
.filter(entry -> entry.getValue().join() != null) | ||
.collect(Collectors.toMap( | ||
entry -> entry.getKey(), | ||
entry -> entry.getValue().join() | ||
)); | ||
|
||
return customDataSessions; | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
service/src/main/java/org/cbioportal/service/util/BinnableCustomDataValue.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,49 @@ | ||
package org.cbioportal.service.util; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import org.cbioportal.model.Binnable; | ||
|
||
import java.io.Serializable; | ||
|
||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
public class BinnableCustomDataValue implements Binnable, Serializable { | ||
|
||
private final CustomDataValue customDataValue; | ||
private final String attrId; | ||
private final Boolean patientAttribute; | ||
|
||
public BinnableCustomDataValue( | ||
CustomDataValue customDataValue, | ||
String attributeId, | ||
Boolean patientAttribute | ||
) { | ||
this.customDataValue = customDataValue; | ||
this.attrId = attributeId; | ||
this.patientAttribute = patientAttribute; | ||
} | ||
|
||
public String getSampleId() { | ||
return customDataValue.getSampleId(); | ||
} | ||
|
||
public String getPatientId() { | ||
return customDataValue.getPatientId(); | ||
} | ||
|
||
public String getStudyId() { | ||
return customDataValue.getStudyId(); | ||
} | ||
|
||
public String getAttrId() { | ||
return attrId; | ||
} | ||
|
||
public Boolean isPatientAttribute() { | ||
return patientAttribute; | ||
} | ||
|
||
public String getAttrValue() { | ||
return customDataValue.getValue(); | ||
} | ||
|
||
} |
Oops, something went wrong.