Skip to content

Commit 8ec4b4b

Browse files
committed
Merge branch 'dev'
2 parents 880e671 + 14e02f6 commit 8ec4b4b

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

src/main/java/org/broadinstitute/macarthurlab/matchbox/match/MatchServiceImpl.java

+18-5
Original file line numberDiff line numberDiff line change
@@ -79,19 +79,28 @@ public List<MatchmakerResult> match(Patient queryPatient, List<Patient> patients
7979
score.put("_phenotypeScore", phenotypeScore);
8080
logger.info("{}:{} base scaled-genoScore: {} phenoScore: {}", queryPatient.getId(), nodePatient.getId(), genotypeScore, phenotypeScore);
8181

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()){
8388
if (genotypeSimilarityScore.hasCommonGene() || phenotypeScore >= MatchServiceImpl.PHENOTYPE_MATCH_THRESHOLD){
8489
candidateNodePatientsToReturn.put(nodePatient, score);
8590
}
8691
}
8792
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+
*/
8996
if (genotypeSimilarityScore.hasCommonGene()){
9097
candidateNodePatientsToReturn.put(nodePatient, score);
9198
}
9299
}
93100

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+
*/
95104
if (genotypeSimilarityScore.hasCommonGene()
96105
&& (genotypeSimilarityScore.hasAtleastOneGeneInCommonWithSameType()
97106
|| genotypeSimilarityScore.hasAtleastOneGeneInCommonWithSameZygosity()
@@ -107,7 +116,9 @@ public List<MatchmakerResult> match(Patient queryPatient, List<Patient> patients
107116
patients.size()),
108117
localNodePatient));
109118
}
110-
//sort by score
119+
/**
120+
* sort by score
121+
*/
111122
results.sort(Comparator.comparingDouble(object -> {
112123
MatchmakerResult matchmakerResult = (MatchmakerResult) object;
113124
return matchmakerResult.getScore().get("patient");
@@ -137,7 +148,9 @@ private Map<String,Double> calculateMatchScore(final Map<String,Double> resultC
137148
merged.put("_phenotypeScore", phenotypeScore);
138149

139150
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+
*/
141154
if (baseGenotypeScore == 1d){
142155
merged.put("_genotypeScore", baseGenotypeScore);
143156
merged.put("patient", 1d);

0 commit comments

Comments
 (0)