- Timestamp:
- 03/31/21 03:06:34 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
framspy/FramsticksLib.py
r1116 r1119 143 143 n = len(genotype_list) 144 144 square_matrix = np.zeros((n, n)) 145 genos = [] # prepare an array of Geno objects so we don't need to convert raw strings to Geno objects all the time145 genos = [] # prepare an array of Geno objects so that we don't need to convert raw strings to Geno objects all the time in loops 146 146 for g in genotype_list: 147 147 genos.append(frams.Geno.newFromString(g)) 148 frams_evaluateDistance = frams.SimilMeasure.evaluateDistance # cache function reference for better performance in loops 148 149 for i in range(n): 149 150 for j in range(n): # maybe calculate only one triangle if you really need a 2x speedup 150 square_matrix[i][j] = frams .SimilMeasure.evaluateDistance(genos[i], genos[j])._double()151 square_matrix[i][j] = frams_evaluateDistance(genos[i], genos[j])._double() 151 152 152 153 for i in range(n):
Note: See TracChangeset
for help on using the changeset viewer.