@@ -108,10 +108,11 @@ static int getEndTimepoint( final Spot selectedRoot, final Model model, final Se
108108 * @param lineageMotif the {@link BranchSpotTree} representing the given lineage motif
109109 * @param branchRef a reference to the branch graph
110110 * @param similarityMeasure the {@link SimilarityMeasure} to use for calculating the similarity
111+ * @param scaleFactor a scaling factor (i.e. in time) to apply to the similarity measure
111112 * @return a {@link RefDoubleMap} of {@link Spot}s and their respective similarity to the given lineage motif
112113 */
113114 static RefDoubleMap < Spot > getMotifSimilarityBySpotIteration ( final BranchSpotTree lineageMotif ,
114- final SimilarityMeasure similarityMeasure , final BranchSpot branchRef )
115+ final SimilarityMeasure similarityMeasure , final BranchSpot branchRef , final double scaleFactor )
115116 {
116117 Model model = lineageMotif .getModel ();
117118 final int motifLength = lineageMotif .getDuration ();
@@ -129,7 +130,7 @@ static RefDoubleMap< Spot > getMotifSimilarityBySpotIteration( final BranchSpotT
129130 int endTimepoint = startTimepoint + motifLength ;
130131 BranchSpot branchSpot = model .getBranchGraph ().getBranchVertex ( spot , branchRef );
131132 BranchSpotTree candidateMotif = new BranchSpotTree ( branchSpot , startTimepoint , endTimepoint , model );
132- double distance = similarityMeasure .compute ( lineageMotif , candidateMotif , 1d );
133+ double distance = similarityMeasure .compute ( lineageMotif , candidateMotif , scaleFactor );
133134 candidates .put ( spot , distance );
134135 }
135136 } );
@@ -143,10 +144,11 @@ static RefDoubleMap< Spot > getMotifSimilarityBySpotIteration( final BranchSpotT
143144 *
144145 * @param lineageMotif the {@link BranchSpotTree} representing the given lineage module
145146 * @param similarityMeasure the {@link SimilarityMeasure} to use for calculating the similarity
147+ * @param scaleFactor a scaling factor (i.e. in time) to apply to the similarity measure
146148 * @return a {@link RefDoubleMap} of {@link Spot}s and their respective similarity to the given lineage module
147149 */
148150 static RefDoubleMap < Spot > getMotifSimilarityByBranchSpotIteration ( final BranchSpotTree lineageMotif ,
149- final SimilarityMeasure similarityMeasure )
151+ final SimilarityMeasure similarityMeasure , final double scaleFactor )
150152 {
151153 final int motifLength = lineageMotif .getDuration ();
152154 int moduleStartTimepoint = lineageMotif .getStartTimepoint ();
@@ -162,7 +164,7 @@ static RefDoubleMap< Spot > getMotifSimilarityByBranchSpotIteration( final Branc
162164 {
163165 int endTimepoint = startTimepoint + motifLength ;
164166 BranchSpotTree candidateMotif = new BranchSpotTree ( branchSpot , startTimepoint , endTimepoint , model );
165- double distance = similarityMeasure .compute ( lineageMotif , candidateMotif , 1d );
167+ double distance = similarityMeasure .compute ( lineageMotif , candidateMotif , scaleFactor );
166168 Iterator < Spot > spotIterator = model .getBranchGraph ().vertexBranchIterator ( branchSpot );
167169 // we need to iterate over the spots in the branch to get the correct spot for the candidate
168170 boolean foundMatchingSpot = false ;
@@ -193,22 +195,23 @@ static RefDoubleMap< Spot > getMotifSimilarityByBranchSpotIteration( final Branc
193195 * @param lineageMotif the {@link BranchSpotTree} representing the lineage motif to compare
194196 * @param maxNumberOfMotifs the maximum number of similar motifs to retrieve
195197 * @param similarityMeasure the {@link SimilarityMeasure} used to compute the similarity between motifs
198+ * @param scaleFactor a scaling factor (i.e. in time) to apply to the similarity measure
196199 * @param spotRef a reference {@link Spot} used for accessing the graph's objects
197200 * @param branchRef a reference {@link BranchSpot} associated with the branch graph
198201 * @param isSpotIteration a boolean indicating whether to use spot iteration or branch spot iteration for similarity calculation.
199202 * Spot iteration may take significantly longer than branch spot iteration, but it is more accurate.
200203 * @return a {@link List} of {@link BranchSpotTree} objects representing the most similar lineage motifs, including their similarity scores.
201204 */
202205 public static List < Pair < BranchSpotTree , Double > > getMostSimilarMotifs ( final BranchSpotTree lineageMotif ,
203- int maxNumberOfMotifs , final SimilarityMeasure similarityMeasure , final Spot spotRef , final BranchSpot branchRef ,
204- boolean isSpotIteration )
206+ int maxNumberOfMotifs , final SimilarityMeasure similarityMeasure , final double scaleFactor , final Spot spotRef ,
207+ final BranchSpot branchRef , boolean isSpotIteration )
205208 {
206209 int motifLength = lineageMotif .getDuration ();
207210 RefDoubleMap < Spot > candidates ;
208211 if ( isSpotIteration )
209- candidates = getMotifSimilarityBySpotIteration ( lineageMotif , similarityMeasure , branchRef );
212+ candidates = getMotifSimilarityBySpotIteration ( lineageMotif , similarityMeasure , branchRef , 1d );
210213 else
211- candidates = getMotifSimilarityByBranchSpotIteration ( lineageMotif , similarityMeasure );
214+ candidates = getMotifSimilarityByBranchSpotIteration ( lineageMotif , similarityMeasure , 1d );
212215
213216 Model model = lineageMotif .getModel ();
214217 RefPool < Spot > refPool = model .getGraph ().vertices ().getRefPool ();
0 commit comments