Skip to content

Commit b02668e

Browse files
Midnighterphantomas1234
authored andcommitted
style: correct new flake8 errors (#229)
1 parent f664d71 commit b02668e

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

cameo/core/strain_design.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,9 +188,9 @@ def plot(self, grid=None, width=None, height=None, title=None, *args, **kwargs):
188188
counts = DataFrame(columns=['count'])
189189
for design in self._designs:
190190
for target in design:
191-
if target.id not in counts.index:
192-
counts.loc[target.id, 'count'] = 0
193-
counts.loc[target.id, 'count'] += 1
191+
if target.id not in counts.index:
192+
counts.loc[target.id, 'count'] = 0
193+
counts.loc[target.id, 'count'] += 1
194194
counts['frequency'] = counts['count'].apply(lambda c: c / len(self._designs))
195195

196196
plotter.frequency(counts, title=title, width=width, height=height, **kwargs)

cameo/strain_design/heuristic/evolutionary/variators.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,9 @@ def set_mutation(random, individual, args):
112112
mutation_rate = float(args.get('mutation_rate', .1))
113113
for value in individual:
114114
if random.random() < mutation_rate and len(indices) > 0:
115-
index = random.sample(indices, 1)[0]
116-
indices.remove(index)
117-
new_individual.append(index)
115+
index = random.sample(indices, 1)[0]
116+
indices.remove(index)
117+
new_individual.append(index)
118118
else:
119119
new_individual.append(value)
120120

@@ -234,9 +234,9 @@ def multiple_chromosome_set_indel(random, individual, args):
234234
indel_rate = args.get('%s_indel_rate' % key, .1)
235235
if random.random() < indel_rate:
236236
if random.random() > 0.5 and len(new_individual[key]) < max_size and len(indices) > 0:
237-
index = random.sample(indices, 1)[0]
238-
indices.remove(index)
239-
new_individual[key].append(index)
237+
index = random.sample(indices, 1)[0]
238+
indices.remove(index)
239+
new_individual[key].append(index)
240240
else:
241241
if len(individual[key]) > 1:
242242
new_individual[key] = random.sample(new_individual[key], len(new_individual[key]) - 1)

cameo/strain_design/heuristic/evolutionary_based.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,15 +134,15 @@ def run(self, target=None, biomass=None, substrate=None, max_knockouts=5, variab
134134
objective_function = biomass_product_coupled_min_yield(biomass, target, substrate)
135135
else:
136136
objective_function = biomass_product_coupled_yield(biomass, target, substrate)
137-
if self.manipulation_type is "genes":
137+
if self.manipulation_type == "genes":
138138
optimization_algorithm = GeneKnockoutOptimization(
139139
model=self._model,
140140
heuristic_method=self._algorithm,
141141
essential_genes=self._essential_genes,
142142
plot=self.plot,
143143
objective_function=objective_function,
144144
use_nullspace_simplification=use_nullspace_simplification)
145-
elif self.manipulation_type is "reactions":
145+
elif self.manipulation_type == "reactions":
146146
optimization_algorithm = ReactionKnockoutOptimization(
147147
model=self._model,
148148
heuristic_method=self._algorithm,

cameo/visualization/plotting/with_plotly.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ def frequency(self, dataframe, width=None, height=None, palette=None, title="Fre
342342

343343
@property
344344
def _display(self):
345-
if self.get_option('mode') is "offline":
345+
if self.get_option('mode') == "offline":
346346
from plotly.offline import iplot
347347
self._oflline()
348348
else:

0 commit comments

Comments
 (0)