Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ public List<BrAPIGermplasm> getRawGermplasm(UUID programId) throws ApiException
List<BrAPIGermplasm> cacheList = new ArrayList<>(programGermplasmCache.get(programId).values());
return cacheList.stream().map(germplasm -> {
germplasm.setGermplasmName(Utilities.appendProgramKey(germplasm.getDefaultDisplayName(), program.getKey(), germplasm.getAccessionNumber()));
if(germplasm.getAdditionalInfo() != null && germplasm.getAdditionalInfo()
.has(BrAPIAdditionalInfoFields.GERMPLASM_RAW_PEDIGREE)) {
if(germplasm.getAdditionalInfo() != null && germplasm.getAdditionalInfo().has(BrAPIAdditionalInfoFields.GERMPLASM_RAW_PEDIGREE)
&& !(germplasm.getAdditionalInfo().get(BrAPIAdditionalInfoFields.GERMPLASM_RAW_PEDIGREE).isJsonNull())) {
germplasm.setPedigree(germplasm.getAdditionalInfo().get(BrAPIAdditionalInfoFields.GERMPLASM_RAW_PEDIGREE).getAsString());
}

Expand Down Expand Up @@ -178,7 +178,6 @@ private Map<String,BrAPIGermplasm> processGermplasmForDisplay(List<BrAPIGermplas

// Update pedigree string
for (BrAPIGermplasm germplasm: programGermplasm) {
if (germplasm.getPedigree() != null) {
JsonObject additionalInfo = germplasm.getAdditionalInfo();
if(additionalInfo == null) {
additionalInfo = new JsonObject();
Expand All @@ -188,7 +187,10 @@ private Map<String,BrAPIGermplasm> processGermplasmForDisplay(List<BrAPIGermplas
String newPedigreeString = "";
String namePedigreeString = "";
String uuidPedigreeString = "";
List<String> parents = Arrays.asList(germplasm.getPedigree().split("/"));
List<String> parents = Arrays.asList("","");
if (germplasm.getPedigree() != null) {
parents = Arrays.asList(germplasm.getPedigree().split("/"));
}
if (parents.size() >= 1) {
if (programGermplasmByFullName.containsKey(parents.get(0))) {
String femaleParentAccessionNumber = programGermplasmByFullName.get(parents.get(0)).getAccessionNumber();
Expand All @@ -212,18 +214,17 @@ private Map<String,BrAPIGermplasm> processGermplasmForDisplay(List<BrAPIGermplas
}
}
//Add Unknown germplasm for display
if (germplasm.getAdditionalInfo().has("femaleParentUnknown") && germplasm.getAdditionalInfo().get("femaleParentUnknown").getAsBoolean()) {
if (additionalInfo.has("femaleParentUnknown") && additionalInfo.get("femaleParentUnknown").getAsBoolean()) {
namePedigreeString = "Unknown";
}
if (germplasm.getAdditionalInfo().has("maleParentUnknown") && germplasm.getAdditionalInfo().get("maleParentUnknown").getAsBoolean()) {
if (additionalInfo.has("maleParentUnknown") && additionalInfo.get("maleParentUnknown").getAsBoolean()) {
namePedigreeString += "/Unknown";
}
//For use in individual germplasm display
additionalInfo.addProperty(BrAPIAdditionalInfoFields.GERMPLASM_PEDIGREE_BY_NAME, namePedigreeString);
additionalInfo.addProperty(BrAPIAdditionalInfoFields.GERMPLASM_PEDIGREE_BY_UUID, uuidPedigreeString);

germplasm.setPedigree(newPedigreeString);
}

BrAPIExternalReference extRef = germplasm.getExternalReferences().stream().filter(reference -> referenceSource.equals(reference.getReferenceSource())).findFirst().orElseThrow(() -> new IllegalStateException("No BI external reference found"));
String germplasmId = extRef.getReferenceID();
Expand Down