@@ -79,19 +79,28 @@ public List<MatchmakerResult> match(Patient queryPatient, List<Patient> patients
79
79
score .put ("_phenotypeScore" , phenotypeScore );
80
80
logger .info ("{}:{} base scaled-genoScore: {} phenoScore: {}" , queryPatient .getId (), nodePatient .getId (), genotypeScore , phenotypeScore );
81
81
82
- if (this .ALLOW_NO_GENE_IN_COMMON_PHENOTYPE_MATCHES ){
82
+ /**
83
+ * Two situations where we return a patient matched ONLY-ON phenotypes
84
+ * 1. If the switch to allow that feature is turned on OR
85
+ * 2. If no genotypes were given. Then we return matches bases on phenotypes
86
+ */
87
+ if (this .ALLOW_NO_GENE_IN_COMMON_PHENOTYPE_MATCHES || queryPatient .getGenomicFeatures ().isEmpty ()){
83
88
if (genotypeSimilarityScore .hasCommonGene () || phenotypeScore >= MatchServiceImpl .PHENOTYPE_MATCH_THRESHOLD ){
84
89
candidateNodePatientsToReturn .put (nodePatient , score );
85
90
}
86
91
}
87
92
else {
88
- //default logic is that we return any query-patient combination with at least one gene in common
93
+ /**
94
+ * default logic is that we return any query-patient combination with at least one gene in common
95
+ */
89
96
if (genotypeSimilarityScore .hasCommonGene ()){
90
97
candidateNodePatientsToReturn .put (nodePatient , score );
91
98
}
92
99
}
93
100
94
- //numPatientsWithGoodGenotypeMatch var is to help figure out population frequencies within matchbox
101
+ /*
102
+ * numPatientsWithGoodGenotypeMatch variable is to help figure out population frequencies within matchbox
103
+ */
95
104
if (genotypeSimilarityScore .hasCommonGene ()
96
105
&& (genotypeSimilarityScore .hasAtleastOneGeneInCommonWithSameType ()
97
106
|| genotypeSimilarityScore .hasAtleastOneGeneInCommonWithSameZygosity ()
@@ -107,7 +116,9 @@ public List<MatchmakerResult> match(Patient queryPatient, List<Patient> patients
107
116
patients .size ()),
108
117
localNodePatient ));
109
118
}
110
- //sort by score
119
+ /**
120
+ * sort by score
121
+ */
111
122
results .sort (Comparator .comparingDouble (object -> {
112
123
MatchmakerResult matchmakerResult = (MatchmakerResult ) object ;
113
124
return matchmakerResult .getScore ().get ("patient" );
@@ -137,7 +148,9 @@ private Map<String,Double> calculateMatchScore(final Map<String,Double> resultC
137
148
merged .put ("_phenotypeScore" , phenotypeScore );
138
149
139
150
double matchboxPopulationProbability = ((double )numPatientsWithGoodGenotypeMatch /(double )matchboxPatientPopSize );
140
- //genotypeScore is 1.0 if it's a perfect match genotypically, no more scoring needed
151
+ /*
152
+ * genotypeScore is 1.0 if it's a perfect match genotypically, no more scoring needed
153
+ */
141
154
if (baseGenotypeScore == 1d ){
142
155
merged .put ("_genotypeScore" , baseGenotypeScore );
143
156
merged .put ("patient" , 1d );
0 commit comments