Skip to content
Merged
Show file tree
Hide file tree
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 @@ -204,8 +204,7 @@ private Map<String,BrAPIGermplasm> processGermplasmForDisplay(List<BrAPIGermplas
germplasm.setAdditionalInfo(additionalInfo);
}

// TODO: BI-1883 to cleanup this workaround for the pedigree string
String pedigree = processBreedbasePedigree(germplasm.getPedigree());
String pedigree = germplasm.getPedigree();
additionalInfo.addProperty(BrAPIAdditionalInfoFields.GERMPLASM_RAW_PEDIGREE, pedigree);

String gidPedigreeString = "";
Expand Down Expand Up @@ -281,34 +280,6 @@ private Map<String,BrAPIGermplasm> processGermplasmForDisplay(List<BrAPIGermplas
return programGermplasmMap;
}

// TODO: hack for now, probably should update breedbase
// Made a JIRA card BI-1883 for this
// Breedbase will return NA/NA for no pedigree or NA/father, mother/NA
// strip NAs before saving RAW_PEDIGREE, if there was a germplasm with name NA it would be in format NA [program key]
// so that case should be ok if we just strip NA/NA, NA/, or /NA<\0>
private String processBreedbasePedigree(String pedigree) {

if (pedigree != null) {
if (pedigree.equals("NA/NA")) {
return "";
}

// Technically processGermplasmForDisplay should handle ok without stripping these NAs but will strip anyways
// for consistency.
// We only allow the /NA case for single parent as we require a female parent in the pedigree
// keep the leading slash, will be handled by processGermplasmForDisplay
if (pedigree.endsWith("/NA")) {
return pedigree.substring(0, pedigree.length()-2);
}

// shouldn't have this case in our data but just in case
if (pedigree.startsWith("NA/")) {
return pedigree.substring(2);
}
}
return pedigree;
}

public List<BrAPIGermplasm> createBrAPIGermplasm(List<BrAPIGermplasm> postBrAPIGermplasmList, UUID programId, ImportUpload upload) {
GermplasmApi api = brAPIEndpointProvider.get(programDAO.getCoreClient(programId), GermplasmApi.class);
var program = programDAO.fetchOneById(programId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,12 @@ public List<Map<String, Object>> processListData(List<BrAPIGermplasm> germplasm,
row.put("Synonyms", joinedSynonyms);
}

// Pedigrees
if (germplasmEntry.getAdditionalInfo().get(BrAPIAdditionalInfoFields.GERMPLASM_PEDIGREE_BY_NAME) != null) {
String pedigreeString = germplasmEntry.getAdditionalInfo().get(BrAPIAdditionalInfoFields.GERMPLASM_PEDIGREE_BY_NAME).getAsString();
row.put("Pedigree", pedigreeString);
}

processedData.add(row);
}
return processedData;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public enum GermplasmFileColumns {
NAME("Germplasm Name", Column.ColumnDataType.STRING),
BREEDING_METHOD("Breeding Method", Column.ColumnDataType.STRING),
SOURCE("Source", Column.ColumnDataType.STRING),
PEDIGREE("Pedigree", Column.ColumnDataType.STRING),
FEMALE_PARENT_GID("Female Parent GID", Column.ColumnDataType.INTEGER),
MALE_PARENT_GID("Male Parent GID", Column.ColumnDataType.INTEGER),
ENTRY_NO("Entry No", Column.ColumnDataType.INTEGER),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,11 @@ public void getGermplasmListExport() {
assertEquals(2, resultTable.rowCount(), "Wrong number of rows were exported");
assertEquals("Germplasm A", resultTable.get(0, 1), "Incorrect data exported");
// Check that "GID" column matches "Entry No" for both (https://breedinginsight.atlassian.net/browse/BI-2266).
assertEquals(resultTable.get(0, 0), resultTable.get(0, 6), "Incorrect data exported");
assertEquals(resultTable.get(1, 0), resultTable.get(1, 6), "Incorrect data exported");
assertEquals(resultTable.get(0, 0), resultTable.get(0, 7), "Incorrect data exported");
assertEquals(resultTable.get(1, 0), resultTable.get(1, 7), "Incorrect data exported");
//Assert "Pedigree" column contains properly formatted data
assertEquals(resultTable.get(0, 4), "", "Incorrect data exported");
assertEquals(resultTable.get(1, 4), "Germplasm A", "Incorrect data exported");
}

@Test
Expand Down
Loading