Skip to content

BI-2344 - Incorrect Germplasm Export in Case of Duplicate Germplasm Names#419

Merged
mlm483 merged 3 commits intorelease/1.0from
bug/BI-2344
Oct 30, 2024
Merged

BI-2344 - Incorrect Germplasm Export in Case of Duplicate Germplasm Names#419
mlm483 merged 3 commits intorelease/1.0from
bug/BI-2344

Conversation

@mlm483
Copy link
Contributor

@mlm483 mlm483 commented Oct 28, 2024

Description

Story: https://breedinginsight.atlassian.net/browse/BI-2344

I introduced this regression in BI-2304.

Because germplasm names are not guaranteed to be unique within a program or list, code that used germplasm name as a key for lookups had unexpected behavior in the case of multiple distinct germplasm in a list that shared the same name (different GIDs, same name is allowed).

The solution was to use the "{germplasmName} [{programKey}-{accessionNumber}]" format as the key for lookups instead, which is what is stored in the backing BrAPI service. Finally, the program key and accession number are stripped from the germplasm name when building the output file data (we don't want to display that to the user).

Testing

  1. Upload a germplasm file with duplicate germplasm names. Small example attached.
    germplasmDuplicateNames.xlsx
  2. Download all germplasm for the program.
  3. Ensure export file is ordered by GID and has no duplicate GIDs (though it has duplicate names).

The screenshot below shows an example upload file, erroneous output (release/1.0 branch) and correct output (bug/BI-2344 branch).
Screenshot 2024-10-29 at 12 09 20 PM

Checklist:

  • I have performed a self-review of my own code
  • I have tested my code and ensured it meets the acceptance criteria of the story
  • I have tested that my code works with both the brapi-java-server and BreedBase
  • I have create/modified unit tests to cover this change
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to documentation
  • I have run TAF: <please include a link to TAF run>

full germplasmName includes programKey and GID
@github-actions github-actions bot added the bug Something isn't working label Oct 28, 2024
@mlm483 mlm483 requested review from a team, HMS17 and davedrp and removed request for a team October 29, 2024 16:19
Copy link
Contributor

@HMS17 HMS17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Passed testing with multiple large germplasm lists with duplicates in a program

// 1. the BrAPI list items are full names, and
// 2. germplasmNames alone are not unique within a program, this led to unexpected behavior, see BI-2344.
String uniqueGermplasmName = String.format("%s [%s-%s]", g.getGermplasmName(), program.getKey(), g.getAccessionNumber());
g.setGermplasmName(uniqueGermplasmName); // For later.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you clarify what the "for later" comment means?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated the comment to be more clear. Inside that loop, g is an element of the germplasm collection which is used again on line 111, and needs to have the full germplasmName with programKey and accession number later in the method.

Copy link
Contributor

@davedrp davedrp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lovely

@mlm483 mlm483 merged commit 8854b00 into release/1.0 Oct 30, 2024
@mlm483 mlm483 deleted the bug/BI-2344 branch October 30, 2024 18:21
@mlm483 mlm483 restored the bug/BI-2344 branch October 30, 2024 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants