Logs show matching phase 2 succeeded, and the InvalidOperationException was thrown during scoring.
Failed to run search with id xxxx Exception: System.InvalidOperationException: Sequence contains no elements
at System.Linq.ThrowHelper.ThrowNoElementsException()
at System.Linq.Enumerable.Max[TSource](IEnumerable1 source, IComparer1 comparer)
at LazyCache.CachingService.<>cDisplayClass22_11.<GetOrAdd>b__1() at System.Lazy1.ViaFactory(LazyThreadSafetyMode mode)
at System.Lazy1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor) at System.Lazy1.CreateValue()
at LazyCache.CachingService.GetValueFromLazy[T](Object item, Boolean& valueHasChangedType)
at LazyCache.CachingService.GetOrAdd[T](String key, Func2 addItemFactory, MemoryCacheEntryOptions policy) at Atlas.MatchingAlgorithm.Services.Search.Scoring.ScoringCache.GetOrAddMatchGrade(Locus locus, String patientHlaName, String donorHlaName, Func2 func) in /home/vsts/work/1/s/Atlas.MatchingAlgorithm/Services/Search/Scoring/ScoringCache.cs:line 38
at Atlas.MatchingAlgorithm.Services.Search.Scoring.Grading.GradingService.CalculateMatchGrade(IHlaScoringMetadata patientMetadata, IHlaScoringMetadata donorMetadata, Locus locus) in /home/vsts/work/1/s/Atlas.MatchingAlgorithm/Services/Search/Scoring/Grading/GradingService.cs:line 139
at Atlas.MatchingAlgorithm.Services.Search.Scoring.Grading.GradingService.GetMatchGradesForDirectOrientation(LocusInfo1 patientMetadata, LocusInfo1 donorMetadata, Locus locus) in /home/vsts/work/1/s/Atlas.MatchingAlgorithm/Services/Search/Scoring/Grading/GradingService.cs:line 112
at Atlas.MatchingAlgorithm.Services.Search.Scoring.Grading.GradingService.GetLocusGradeResults(LocusInfo1 patientMetadata, LocusInfo1 donorMetadata, Locus locus) in /home/vsts/work/1/s/Atlas.MatchingAlgorithm/Services/Search/Scoring/Grading/GradingService.cs:line 101
at Atlas.MatchingAlgorithm.Services.Search.Scoring.Grading.GradingService.<>c__DisplayClass6_0.b0(Locus locus, LocusInfo1 patientMetadataAtLocus) in /home/vsts/work/1/s/Atlas.MatchingAlgorithm/Services/Search/Scoring/Grading/GradingService.cs:line 84 at Atlas.Common.Public.Models.GeneticData.PhenotypeInfo.PhenotypeInfo1.EachLocus(Action2 action) in /home/vsts/work/1/s/Atlas.Common.Public.Models/GeneticData/PhenotypeInfo/PhenotypeInfo.cs:line 243 at Atlas.MatchingAlgorithm.Services.Search.Scoring.Grading.GradingService.GetPhenotypeGradingResults(PhenotypeInfo1 patientMetadata, PhenotypeInfo1 donorMetadata) in /home/vsts/work/1/s/Atlas.MatchingAlgorithm/Services/Search/Scoring/Grading/GradingService.cs:line 82 at Atlas.MatchingAlgorithm.Services.Search.Scoring.DonorScoringService.CalculateDonorScoringInfo(PhenotypeInfo1 donorHla, ScoringCriteria scoringCriteria, PhenotypeInfo1 patientScoringMetadata) in /home/vsts/work/1/s/Atlas.MatchingAlgorithm/Services/Search/Scoring/DonorScoringService.cs:line 135 at Atlas.MatchingAlgorithm.Services.Search.Scoring.DonorScoringService.ScoreDonorHlaAgainstPatientMetadata(PhenotypeInfo1 donorHla, ScoringCriteria scoringCriteria, PhenotypeInfo1 patientScoringMetadata) in /home/vsts/work/1/s/Atlas.MatchingAlgorithm/Services/Search/Scoring/DonorScoringService.cs:line 119 at Atlas.MatchingAlgorithm.Services.Search.Scoring.MatchScoringService.StreamScoringUnranked(StreamingMatchResultsScoringRequest request)+MoveNext() in /home/vsts/work/1/s/Atlas.MatchingAlgorithm/Services/Search/Scoring/MatchScoringService.cs:line 107 at Atlas.MatchingAlgorithm.Services.Search.Scoring.MatchScoringService.StreamScoringUnranked(StreamingMatchResultsScoringRequest request)+MoveNext() in /home/vsts/work/1/s/Atlas.MatchingAlgorithm/Services/Search/Scoring/MatchScoringService.cs:line 105 at Atlas.MatchingAlgorithm.Services.Search.Scoring.MatchScoringService.StreamScoringUnranked(StreamingMatchResultsScoringRequest request)+System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult() at System.Linq.AsyncEnumerable.<ToListAsync>g__Core|424_0[TSource](IAsyncEnumerable1 source, CancellationToken cancellationToken) in /_/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/ToList.cs:line 36
at System.Linq.AsyncEnumerable.g__Core|4240[TSource](IAsyncEnumerable`1 source, CancellationToken cancellationToken) in //Ix.NET/Source/System.Linq.Async/System/Linq/Operators/ToList.cs:line 41
at Atlas.MatchingAlgorithm.Services.Search.Scoring.MatchScoringService.StreamScoring(StreamingMatchResultsScoringRequest request) in /home/vsts/work/1/s/Atlas.MatchingAlgorithm/Services/Search/Scoring/MatchScoringService.cs:line 66
at Atlas.MatchingAlgorithm.Services.Search.SearchService.Search(SearchRequest matchingRequest, Nullable`1 cutOffDate) in /home/vsts/work/1/s/Atlas.MatchingAlgorithm/Services/Search/SearchService.cs:line 82
at Atlas.MatchingAlgorithm.Services.Search.SearchRunner.RunSearch(IdentifiedSearchRequest identifiedSearchRequest, Int32 attemptNumber, DateTimeOffset enqueuedTimeUtc) in /home/vsts/work/1/s/Atlas.MatchingAlgorithm/Services/Search/SearchRunner.cs:line 80
Snapshot debugger showed this cache key in failed method call: "MatchGrade:v3540;lA;d01:04;p01:01"
Running search locally whilst pointed to live-wmda HMD and dbs showed exception being thrown in MultipleAlleleGradingCalculator, ln 50, because the donor metadata of type MultipleAlleleScoringInfo had no single allele infos attached to it, which means no match grades could be calculated, and so the call to allGrades.Max() caused the error "Sequence contains no elements".
The donor typing in question is A*01:04.
The typing is not listed in hla_nom.txt, because the name has now extended to 4 fields. Two alleles map to the name, both of them are null: 01:04:01:01N and 01:04:01:02N
There is no entry for A*01:04 in either the matching or scoring HMD tables, but there is a row in AlleleNames table, which points to the full names, which are represented.
This mean no single allele info is returned to attached to the new ConsolidatedMolecularScoringInfo generated in ln 132 of the same class.
The fix is to add support to the class for the edge case that if all the alleles in the list are null, then build a consolidated scoring info with empty P group and serology list, and list of mapped G groups.
Search request IDs can be found on ASRT ticket.
Investigation
Logs show matching phase 2 succeeded, and the
InvalidOperationException
was thrown during scoring.MultipleAlleleGradingCalculator
, ln 50, because the donor metadata of typeMultipleAlleleScoringInfo
had no single allele infos attached to it, which means no match grades could be calculated, and so the call toallGrades.Max()
caused the error "Sequence contains no elements".A*01:04
.01:04:01:01N
and01:04:01:02N
A*01:04
in either the matching or scoring HMD tables, but there is a row in AlleleNames table, which points to the full names, which are represented.A*01:04
: https://github.com/Anthony-Nolan/Atlas/blob/4d96adc12b7abb59ec13b2bf25d926e49ba5ee6d/Atlas.HlaMetadataDictionary/Services/DataGeneration/MatchedHlaConversion/MatchedHlaToMetaDataConverterBase.cs#L43ConsolidatedMolecularScoringInfo
generated in ln 132 of the same class.