Skip to content

Commit

Permalink
Fix whitespace before and after operators (PEP8 E221 and E222).
Browse files Browse the repository at this point in the history
Whitespace was left intact in places where it helps readability.
  • Loading branch information
cbrueffer authored and peterjc committed Dec 4, 2012
1 parent 332494c commit 5192d13
Show file tree
Hide file tree
Showing 56 changed files with 136 additions and 136 deletions.
6 changes: 3 additions & 3 deletions Bio/Affy/CelFile.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def read(handle):
section = "HEADER"
elif line[:11]=="[INTENSITY]":
section = "INTENSITY"
record.intensities = numpy.zeros((record.nrows, record.ncols))
record.intensities = numpy.zeros((record.nrows, record.ncols))
record.stdevs = numpy.zeros((record.nrows, record.ncols))
record.npix = numpy.zeros((record.nrows, record.ncols), int)
elif line[0]=="[":
Expand All @@ -58,7 +58,7 @@ def read(handle):
continue
words = line.split()
y, x = map(int, words[:2])
record.intensities[x,y] = float(words[2])
record.intensities[x,y] = float(words[2])
record.stdevs[x,y] = float(words[3])
record.npix[x,y] = int(words[4])
record.npix[x,y] = int(words[4])
return record
2 changes: 1 addition & 1 deletion Bio/Align/AlignInfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def _guess_consensus_alphabet(self, ambiguous):
#Now check its compatible with all the rest of the sequences
for record in self.alignment:
#Get the (un-gapped version of) the sequence's alphabet
alt = Alphabet._get_base_alphabet(record.seq.alphabet)
alt = Alphabet._get_base_alphabet(record.seq.alphabet)
if not isinstance(alt, a.__class__):
raise ValueError("Alignment contains a sequence with \
an incompatible alphabet.")
Expand Down
4 changes: 2 additions & 2 deletions Bio/AlignIO/FastaIO.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ def _extract_alignment_region(alignment_seq_with_flanking, annotation):
if int(annotation['al_start']) <= int(annotation['al_stop']):
start = int(annotation['al_start']) \
- display_start
end = int(annotation['al_stop']) \
end = int(annotation['al_stop']) \
- display_start + 1
else:
#FASTA has flipped this sequence...
start = display_start \
- int(annotation['al_start'])
end = display_start \
end = display_start \
- int(annotation['al_stop']) + 1
end += align_stripped.count("-")
assert 0 <= start and start < end and end <= len(align_stripped), \
Expand Down
6 changes: 3 additions & 3 deletions Bio/Alphabet/Reduced.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class Murphy10(Alphabet.ProteinAlphabet):
size = 10
murphy_10 = Murphy10()

murphy_8_tab = {"L": "L",
murphy_8_tab = {"L": "L",
"V": "L",
"I": "L",
"M": "L",
Expand All @@ -105,7 +105,7 @@ class Murphy8(Alphabet.ProteinAlphabet):
size = 8
murphy_8 = Murphy8()

murphy_4_tab = {"L": "L",
murphy_4_tab = {"L": "L",
"V": "L",
"I": "L",
"M": "L",
Expand Down Expand Up @@ -157,7 +157,7 @@ class HPModel(Alphabet.ProteinAlphabet):
size = 2
hp_model = HPModel()

pc_5_table = {"I": "A", # Aliphatic
pc_5_table = {"I": "A", # Aliphatic
"V": "A",
"L": "A",
"F": "R", # Aromatic
Expand Down
4 changes: 2 additions & 2 deletions Bio/Crystal/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,15 +231,15 @@ def __repr__(self):
keys = self.data.keys()
keys.sort()
for key in keys:
output = output + '%s : %s\n' % (key, self.data[ key ])
output = output + '%s : %s\n' % (key, self.data[ key ])
return output

def __str__(self):
output = ''
keys = self.data.keys()
keys.sort()
for key in keys:
output = output + '%s : %s\n' % (key, self.data[ key ])
output = output + '%s : %s\n' % (key, self.data[ key ])
return output

def tostring(self):
Expand Down
4 changes: 2 additions & 2 deletions Bio/FSSP/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def __repr__(self):
outstring = self.aa+self.ss.lower()
return outstring

__str__ = __repr__
__str__ = __repr__



Expand Down Expand Up @@ -129,7 +129,7 @@ def __init__(self,in_fff_rec):
# print in_fff_rec
self.abs_res_num = int(in_fff_rec[fssp_rec.align.abs_res_num])
self.pdb_res_num = in_fff_rec[fssp_rec.align.pdb_res_num].strip()
self.chain_id = in_fff_rec[fssp_rec.align.chain_id]
self.chain_id = in_fff_rec[fssp_rec.align.chain_id]
if self.chain_id == ' ':
self.chain_id = '0'
self.res_name = in_fff_rec[fssp_rec.align.res_name]
Expand Down
6 changes: 3 additions & 3 deletions Bio/GA/Crossover/GeneralPoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def __init__(self, points, crossover_prob = .1):
"""
self._crossover_prob = crossover_prob

self._sym = points % 2 # odd n, gets a symmetry flag
self._sym = points % 2 # odd n, gets a symmetry flag
self._npoints = (points + self._sym)//2 # (N or N+1)//2

def do_crossover(self, org_1, org_2):
Expand All @@ -62,7 +62,7 @@ def do_crossover(self, org_1, org_2):
if crossover_chance <= self._crossover_prob:

# pre-compute bounds (len(genome))
bound = (len(new_org[0].genome), len(new_org[1].genome))
bound = (len(new_org[0].genome), len(new_org[1].genome))

mbound = min(bound)
# can't have more than 0,x_0...x_n,bound locations
Expand All @@ -82,7 +82,7 @@ def do_crossover(self, org_1, org_2):
y_locs = self._generate_locs( bound[1] )
else:
y_locs = x_locs
xlocs = self._generate_locs( bound[0] )
xlocs = self._generate_locs( bound[0] )

# copy new genome strings over
tmp = self._crossover(0, new_org, (x_locs,y_locs))
Expand Down
2 changes: 1 addition & 1 deletion Bio/GA/Crossover/Uniform.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def __init__(self, crossover_prob = .1, uniform_prob = 0.7):
"""Initialize to do uniform crossover at the specified probability and frequency.
"""
self._crossover_prob = crossover_prob
self._uniform_prob = uniform_prob
self._uniform_prob = uniform_prob
return

def do_crossover(self, org_1, org_2):
Expand Down
2 changes: 1 addition & 1 deletion Bio/GenBank/Record.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ def _keywords_line(self):
"""
output = ""
if len(self.keywords) >= 0:
output += Record.BASE_FORMAT % "KEYWORDS"
output += Record.BASE_FORMAT % "KEYWORDS"
keyword_info = ""
for keyword in self.keywords:
keyword_info += "%s; " % keyword
Expand Down
2 changes: 1 addition & 1 deletion Bio/Geo/Record.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,6 @@ def __str__( self ):
def out_block( text, prefix = '' ):
output = ''
for j in range( 0, len( text ), 80 ):
output = output + '%s%s\n' % ( prefix, text[ j: j + 80 ] )
output = output + '%s%s\n' % ( prefix, text[ j: j + 80 ] )
output = output + '\n'
return output
2 changes: 1 addition & 1 deletion Bio/Graphics/GenomeDiagram/_GraphSet.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def new_graph(self, data, name=None, style='bar', color=colors.lightgreen,
id = self._next_id # get id number
graph = GraphData(id, data, name, style, color, altcolor, center)
graph.linewidth = linewidth
self._graphs[id] = graph # add graph data
self._graphs[id] = graph # add graph data
self._next_id += 1 # increment next id
return graph

Expand Down
4 changes: 2 additions & 2 deletions Bio/HMM/Trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def train(self, training_seqs, stopping_criteria,
# calculate the forward and backward variables
DP = dp_method(self._markov_model, training_seq)
forward_var, seq_prob = DP.forward_algorithm()
backward_var = DP.backward_algorithm()
backward_var = DP.backward_algorithm()

all_probabilities.append(seq_prob)

Expand All @@ -221,7 +221,7 @@ def train(self, training_seqs, stopping_criteria,
self._markov_model.transition_prob = ml_transitions
self._markov_model.emission_prob = ml_emissions

cur_log_likelihood = self.log_likelihood(all_probabilities)
cur_log_likelihood = self.log_likelihood(all_probabilities)

# if we have previously calculated the log likelihood (ie.
# not the first round), see if we can finish
Expand Down
2 changes: 1 addition & 1 deletion Bio/KEGG/Compound/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def __str__(self):
Returns a string representation of this Record.
"""
return self._entry() + \
self._name() + \
self._name() + \
self._formula() + \
self._mass() + \
self._pathway() + \
Expand Down
2 changes: 1 addition & 1 deletion Bio/KEGG/Enzyme/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def __str__(self):
Returns a string representation of this Record.
"""
return self._entry() + \
self._name() + \
self._name() + \
self._classname() + \
self._sysname() + \
self._reaction() + \
Expand Down
4 changes: 2 additions & 2 deletions Bio/KEGG/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ def _wrap_kegg(line, max_width = KEGG_DATA_LENGTH, wrap_rule = _default_wrap):
"""
s = ""
wrapped_line = ""
indent = " " * wrap_rule[0]
indent = " " * wrap_rule[0]
connect = wrap_rule[1]
rules = wrap_rule[2:]
rules = wrap_rule[2:]
while 1:
if len(line) <= max_width:
wrapped_line = wrapped_line + line
Expand Down
2 changes: 1 addition & 1 deletion Bio/NMR/xpktools.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class XpkEntry(object):
def __init__(self,entry,headline):
self.fields={} # Holds all fields from input line in a dictionary
# keys are data labels from the .xpk header
datlist = entry.split()
datlist = entry.split()
headlist = headline.split()

i=0
Expand Down
2 changes: 1 addition & 1 deletion Bio/NaiveBayes.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def calculate(nb, observation, scale=0):
% (len(observation), nb.dimensionality))

# Calculate log P(observation|class) for every class.
n = len(nb.classes)
n = len(nb.classes)
lp_observation_class = numpy.zeros(n) # array of log P(observation|class)
for i in range(n):
# log P(observation|class) = SUM_i log P(observation_i|class)
Expand Down
6 changes: 3 additions & 3 deletions Bio/Pathway/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ def __init__(self, reactants = {}, catalysts = [],
for r, value in reactants.iteritems():
if value == 0:
del self.reactants[r]
self.catalysts = sorted(set(catalysts))
self.data = data
self.catalysts = sorted(set(catalysts))
self.data = data
self.reversible = reversible

def __eq__(self, r):
Expand Down Expand Up @@ -107,7 +107,7 @@ def __repr__(self):
def __str__(self):
"""Returns a string representation of self."""
substrates = ""
products = ""
products = ""
all_species = sorted(self.reactants)
for species in all_species:
stoch = self.reactants[species]
Expand Down
2 changes: 1 addition & 1 deletion Bio/PopGen/FDist/Async.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def monitor(self):
while(True):
sleep(1)
self.async.access_ds.acquire()
keys = self.async.done.keys()[:]
keys = self.async.done.keys()[:]
self.async.access_ds.release()
for done in keys:
self.async.access_ds.acquire()
Expand Down
2 changes: 1 addition & 1 deletion Bio/PopGen/FDist/Controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ def run_cplot(self, ci= 0.95, data_dir='.', version = 1, smooth=0.04):
cplot_name = "cplot"
else:
cplot_name = "cplot2"
os.system('cd ' + data_dir + ' && ' +
os.system('cd ' + data_dir + ' && ' +
self._get_path(cplot_name) + ' < ' + in_name + ' > ' + out_name)
os.remove(data_dir + os.sep + in_name)
os.remove(data_dir + os.sep + out_name)
Expand Down
8 changes: 4 additions & 4 deletions Bio/PopGen/GenePop/Controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -609,13 +609,13 @@ def pop_parser(self):

while "Expected number of ho" not in l:
l = self.stream.readline()
expHo = _gp_float(l[38:])
expHo = _gp_float(l[38:])
l = self.stream.readline()
obsHo = _gp_int(l[38:])
obsHo = _gp_int(l[38:])
l = self.stream.readline()
expHe = _gp_float(l[38:])
expHe = _gp_float(l[38:])
l = self.stream.readline()
obsHe = _gp_int(l[38:])
obsHe = _gp_int(l[38:])
l = self.stream.readline()

while "Sample count" not in l:
Expand Down
2 changes: 1 addition & 1 deletion Bio/PopGen/GenePop/EasyController.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def get_f_stats(self, locus_name):
Returns Fis(CW), Fst, Fit, Qintra, Qinter
"""
loci_iter = self._controller.calc_fst_all(self._fname)[1]
loci_iter = self._controller.calc_fst_all(self._fname)[1]
for name, fis, fst, fit, qintra, qinter in loci_iter:
if name == locus_name:
return fis, fst, fit, qintra, qinter
Expand Down
8 changes: 4 additions & 4 deletions Bio/PopGen/GenePop/FileParser.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ class FileRecord(object):
"""
def __init__(self, fname):
self.comment_line = ""
self.loci_list = []
self.fname = fname
self.comment_line = ""
self.loci_list = []
self.fname = fname
self.start_read()

def __str__(self):
Expand All @@ -74,7 +74,7 @@ def __str__(self):
Marker length will be 3.
"""
marker_len = 3
rep = [self.comment_line + '\n']
rep = [self.comment_line + '\n']
rep.append('\n'.join(self.loci_list) + '\n')
current_pop = self.current_pop
current_ind = self.current_ind
Expand Down
14 changes: 7 additions & 7 deletions Bio/PopGen/GenePop/LargeFileParser.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,13 @@ class Record(object):
"""
def __init__(self, handle):
self.handle = handle
self.marker_len = 0
self.comment_line = ""
self.loci_list = []
self.populations = []
self.data_generator = None
self.stack = []
self.handle = handle
self.marker_len = 0
self.comment_line = ""
self.loci_list = []
self.populations = []
self.data_generator = None
self.stack = []

def data_generator(self):
for handle in [self.stack, self.handle]:
Expand Down
10 changes: 5 additions & 5 deletions Bio/PopGen/GenePop/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,11 @@ class Record(object):
"""
def __init__(self):
self.marker_len = 0
self.comment_line = ""
self.loci_list = []
self.pop_list = []
self.populations = []
self.marker_len = 0
self.comment_line = ""
self.loci_list = []
self.pop_list = []
self.populations = []

def __str__(self):
"""Returns (reconstructs) a GenePop textual representation.
Expand Down
2 changes: 1 addition & 1 deletion Bio/PopGen/SimCoal/Template.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def process_para(in_string, out_file_prefix, para_list, curr_values):
f = open(f_name + '.par', 'w')
#executed_template = template
executed_template = exec_template(template)
clean_template = executed_template.replace('\r\n','\n').replace('\n\n','\n')
clean_template = executed_template.replace('\r\n','\n').replace('\n\n','\n')
f.write(clean_template)
f.close()
return [f_name]
Expand Down
2 changes: 1 addition & 1 deletion Bio/Restriction/PrintFormat.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ def _make_number_only(self, ls, title, nc = [], s1 =''):
return title
ls.sort(lambda x,y : cmp(len(x[1]), len(y[1])))
iterator = iter(ls)
cur_len = 1
cur_len = 1
new_sect = []
for name, sites in iterator:
l = len(sites)
Expand Down
Loading

0 comments on commit 5192d13

Please sign in to comment.