Skip to content

Commit

Permalink
Replace remaining python2-style print commands by python3-style print…
Browse files Browse the repository at this point in the history
… function (biopython#3533)

* updated print function

* one more
  • Loading branch information
mdehoon authored and JoaoRodrigues committed Jun 3, 2021
1 parent 448cfb9 commit c770cdd
Show file tree
Hide file tree
Showing 14 changed files with 51 additions and 51 deletions.
2 changes: 1 addition & 1 deletion Bio/Align/AlignInfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ def information_content(
e_freq_table,
random_expected,
)
# print freq_dict,
# print(freq_dict, end="")
column_score = self._get_column_info_content(
freq_dict, e_freq_table, log_base, random_expected
)
Expand Down
2 changes: 1 addition & 1 deletion Bio/AlignIO/EmbossIO.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def __next__(self):
index = 0
else:
# just a start value, this is just alignment annotation (?)
# print "Skipping: " + line.rstrip()
# print("Skipping: " + line.rstrip())
pass
elif line.strip() == "":
# Just a spacer?
Expand Down
6 changes: 3 additions & 3 deletions Bio/AlignIO/Interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ def __iter__(self):
with open("many.phy","r") as myFile:
for alignment in PhylipIterator(myFile):
print "New alignment:"
print("New alignment:")
for record in alignment:
print record.id
print record.seq
print(record.id)
print(record.seq)
"""
return iter(self.__next__, None)
Expand Down
2 changes: 1 addition & 1 deletion Bio/AlignIO/PhylipIO.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ def __next__(self):
self._header = line
break

# print "New block..."
# print("New block...")
for i in range(number_of_seqs):
s = line.strip().replace(" ", "")
if "." in s:
Expand Down
2 changes: 1 addition & 1 deletion Bio/Blast/NCBIWWW.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ def _parse_qblast_ref_page(handle):
msg = s[i:].split("<", 1)[0].split("\n", 1)[0].strip()
raise ValueError("Error message from NCBI: %s" % msg)
# We didn't recognise the error layout :(
# print s
# print(s)
raise ValueError(
"No RID and no RTOE found in the 'please wait' page, "
"there was probably an error in your request but we "
Expand Down
4 changes: 2 additions & 2 deletions Bio/Data/CodonTable.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ def list_ambiguous_codons(codons, ambiguous_nucleotide_values):
if codon not in candidates and codon not in codons:
candidates.append(codon)
answer = codons[:] # copy
# print "Have %i new candidates" % len(candidates)
# print("Have %i new candidates" % len(candidates))
for ambig_codon in candidates:
wanted = True
# e.g. 'TRR' -> 'TAA', 'TAG', 'TGA', 'TGG'
Expand All @@ -325,7 +325,7 @@ def list_ambiguous_codons(codons, ambiguous_nucleotide_values):
if codon not in codons:
# This ambiguous codon can code for a non-stop, exclude it!
wanted = False
# print "Rejecting %s" % ambig_codon
# print("Rejecting %s" % ambig_codon)
continue
if wanted:
answer.append(ambig_codon)
Expand Down
10 changes: 5 additions & 5 deletions Bio/Graphics/GenomeDiagram/_CircularDrawer.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ def draw_track(self, track):

def draw_feature_set(self, set):
"""Return list of feature elements and list of labels for them."""
# print 'draw feature set'
# print('draw feature set')
feature_elements = [] # Holds diagram elements belonging to the features
label_elements = [] # Holds diagram elements belonging to feature labels

Expand Down Expand Up @@ -420,8 +420,8 @@ def get_feature_sigil(self, feature, locstart, locend, **kwargs):
# No label required
labelgroup = None
# if locstart > locend:
# print locstart, locend, feature.strand, sigil, feature.name
# print locstart, locend, feature.name
# print(locstart, locend, feature.strand, sigil, feature.name)
# print(locstart, locend, feature.name)
return sigil, labelgroup

def draw_cross_link(self, cross_link):
Expand Down Expand Up @@ -522,7 +522,7 @@ def draw_graph_set(self, set):
- set GraphSet object
"""
# print 'draw graph set'
# print('draw graph set')
elements = [] # Holds graph elements

# Distribution dictionary for how to draw the graph
Expand Down Expand Up @@ -1176,7 +1176,7 @@ def _draw_arc_line(
a = (
(start_angle + x * (angle_diff)) * pi / 180
) # to radians for sin/cos
# print x0+r*cos(a), y0+r*sin(a)
# print(x0+r*cos(a), y0+r*sin(a))
path.lineTo(x0 + r * cos(a), y0 + r * sin(a))
x += dx
a = end_angle * pi / 180
Expand Down
2 changes: 1 addition & 1 deletion Bio/Graphics/GenomeDiagram/_Graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def range(self):
"""
positions = sorted(self.data) # i.e. dict keys
# Return first and last positions in graph
# print len(self.data)
# print(len(self.data))
return (positions[0], positions[-1])

def mean(self):
Expand Down
36 changes: 18 additions & 18 deletions Bio/Graphics/GenomeDiagram/_LinearDrawer.py
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,7 @@ def draw_feature_set(self, set):
Returns a tuple (list of elements describing features, list of
labels for elements).
"""
# print 'draw feature set'
# print("draw feature set")
feature_elements = [] # Holds diagram elements belonging to the features
label_elements = [] # Holds diagram elements belonging to feature labels

Expand Down Expand Up @@ -721,17 +721,17 @@ def draw_feature_location(self, feature, locstart, locend):
# Get start and end positions for feature/subfeatures
start_fragment, start_offset = self.canvas_location(locstart)
end_fragment, end_offset = self.canvas_location(locend)
# print "start_fragment, start_offset", start_fragment, start_offset
# print "end_fragment, end_offset", end_fragment, end_offset
# print "start, end", locstart, locend
# print("start_fragment, start_offset", start_fragment, start_offset)
# print("end_fragment, end_offset", end_fragment, end_offset)
# print("start, end", locstart, locend)

# Note that there is a strange situation where a feature may be in
# several parts, and one or more of those parts may end up being
# drawn on a non-existent fragment. So we check that the start and
# end fragments do actually exist in terms of the drawing
allowed_fragments = list(self.fragment_limits.keys())
if start_fragment in allowed_fragments and end_fragment in allowed_fragments:
# print feature.name, feature.start, feature.end, start_offset, end_offset
# print(feature.name, feature.start, feature.end, start_offset, end_offset)
if start_fragment == end_fragment: # Feature is found on one fragment
feature_box, label = self.get_feature_sigil(
feature, start_offset, end_offset, start_fragment
Expand All @@ -746,7 +746,7 @@ def draw_feature_location(self, feature, locstart, locend):
# The bit that runs up to the end of the first fragment,
# and any bits that subsequently span whole fragments
while self.fragment_limits[fragment][1] < locend:
# print fragment, self.fragment_limits[fragment][1], locend
# print(fragment, self.fragment_limits[fragment][1], locend)
feature_box, label = self.get_feature_sigil(
feature, start, self.pagewidth, fragment
)
Expand All @@ -758,14 +758,14 @@ def draw_feature_location(self, feature, locstart, locend):
# if label is not None: # There's a label for the feature
# label_elements.append(label)
# The last bit of the feature
# print locend, self.end, fragment
# print self.fragment_bases, self.length
# print(locend, self.end, fragment)
# print(self.fragment_bases, self.length)
feature_box, label = self.get_feature_sigil(
feature, 0, end_offset, fragment
)
feature_boxes.append((feature_box, label))
# if locstart > locend:
# print locstart, locend, feature.strand, feature_boxes, feature.name
# print(locstart, locend, feature.strand, feature_boxes, feature.name)
return feature_boxes

def draw_cross_link(self, cross_link):
Expand Down Expand Up @@ -1169,7 +1169,7 @@ def draw_graph_set(self, set):
Returns tuple (list of graph elements, list of graph labels).
"""
# print 'draw graph set'
# print('draw graph set')
elements = [] # Holds graph elements

# Distribution dictionary for how to draw the graph
Expand All @@ -1191,7 +1191,7 @@ def draw_line_graph(self, graph):
- graph Graph object
"""
# print '\tdraw_line_graph'
# print('\tdraw_line_graph')
line_elements = [] # Holds drawable elements

# Get graph data
Expand Down Expand Up @@ -1284,7 +1284,7 @@ def draw_line_graph(self, graph):

def draw_heat_graph(self, graph):
"""Return a list of drawable elements for the heat graph."""
# print '\tdraw_heat_graph'
# print('\tdraw_heat_graph')
# At each point contained in the graph data, we draw a box that is the
# full height of the track, extending from the midpoint between the
# previous and current data points to the midpoint between the current
Expand Down Expand Up @@ -1312,7 +1312,7 @@ def draw_heat_graph(self, graph):
fragment0, x0 = self.canvas_location(pos0)
fragment1, x1 = self.canvas_location(pos1)
x0, x1 = self.x0 + x0, self.x0 + x1 # account for margin
# print 'x1 before:', x1
# print('x1 before:', x1)

# Calculate the heat color, based on the differential between
# the value and the median value
Expand All @@ -1326,8 +1326,8 @@ def draw_heat_graph(self, graph):
x1 = self.xlim
ttop = top + self.fragment_lines[fragment0][0]
tbtm = btm + self.fragment_lines[fragment0][0]
# print 'equal', pos0, pos1, val
# print pos0, pos1, fragment0, fragment1
# print('equal', pos0, pos1, val)
# print(pos0, pos1, fragment0, fragment1)
heat_elements.append(
draw_box((x0, tbtm), (x1, ttop), color=heat, border=None)
)
Expand All @@ -1337,7 +1337,7 @@ def draw_heat_graph(self, graph):
fragment = fragment0
start_x = x0
while self.fragment_limits[fragment][1] <= pos1:
# print pos0, self.fragment_limits[fragment][1], pos1
# print(pos0, self.fragment_limits[fragment][1], pos1)
ttop = top + self.fragment_lines[fragment][0]
tbtm = btm + self.fragment_lines[fragment][0]
heat_elements.append(
Expand All @@ -1350,7 +1350,7 @@ def draw_heat_graph(self, graph):
ttop = top + self.fragment_lines[fragment][0]
tbtm = btm + self.fragment_lines[fragment][0]
# Add the last part of the bar
# print 'x1 after:', x1, '\n'
# print('x1 after:', x1, '\n')
heat_elements.append(
draw_box((self.x0, tbtm), (x1, ttop), color=heat, border=None)
)
Expand All @@ -1359,7 +1359,7 @@ def draw_heat_graph(self, graph):

def draw_bar_graph(self, graph):
"""Return list of drawable elements for a bar graph."""
# print '\tdraw_bar_graph'
# print('\tdraw_bar_graph')
# At each point contained in the graph data, we draw a vertical bar
# from the track center to the height of the datapoint value (positive
# values go up in one color, negative go down in the alternative
Expand Down
14 changes: 7 additions & 7 deletions Bio/Nexus/Nexus.py
Original file line number Diff line number Diff line change
Expand Up @@ -997,7 +997,7 @@ def _charstatelabels(self, options):

def _statelabels(self, options):
# self.charlabels = options
# print 'Command statelabels is not supported and will be ignored.'
# print("Command statelabels is not supported and will be ignored.")
pass

def _matrix(self, options):
Expand Down Expand Up @@ -1855,9 +1855,9 @@ def constant(self, matrix=None, delete=(), exclude=()):
for taxon in undelete[1:]:
newconstant = []
for site in constant:
# print '%d (paup=%d)' % (site[0],site[0]+1),
# print("%d (paup=%d)" % (site[0],site[0]+1), end="")
seqsite = matrix[taxon][site[0]].upper()
# print seqsite,'checked against',site[1],'\t',
# print(seqsite,"checked against",site[1],"\t", end="")
if (
seqsite == self.missing
or (
Expand Down Expand Up @@ -1887,11 +1887,11 @@ def constant(self, matrix=None, delete=(), exclude=()):
)
if intersect:
newconstant.append((site[0], "".join(intersect)))
# print 'ok'
# print("ok")
# else:
# print 'failed'
# print("failed")
# else:
# print 'failed'
# print("failed")
constant = newconstant
cpos = [s[0] for s in constant]
return cpos
Expand Down Expand Up @@ -1996,7 +1996,7 @@ def add_sequence(self, name, sequence):

if name in self.taxlabels:
unique_name = _unique_label(self.taxlabels, name)
# print "WARNING: Sequence name %s is already present. Sequence was added as %s." % (name,unique_name)
# print("WARNING: Sequence name %s is already present. Sequence was added as %s." % (name,unique_name))
else:
unique_name = name

Expand Down
10 changes: 5 additions & 5 deletions Bio/SearchIO/_legacy/NCBIStandalone.py
Original file line number Diff line number Diff line change
Expand Up @@ -1778,11 +1778,11 @@ def __next__(self):

if query and "BLAST" not in lines[0]:
# Cheat and re-insert the header
# print "-"*50
# print "".join(self._header)
# print "-"*50
# print "".join(lines)
# print "-"*50
# print("-"*50)
# print("".join(self._header))
# print("-"*50)
# print("".join(lines))
# print("-"*50)
lines = self._header + lines

if not lines:
Expand Down
2 changes: 1 addition & 1 deletion Bio/motifs/jaspar/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,7 @@ def _fetch_internal_id_list(
if where_clauses:
sql = "".join([sql, " where ", " and ".join(where_clauses)])

# print "sql = %s" % sql
# print("sql = %s" % sql)

cur.execute(sql)
rows = cur.fetchall()
Expand Down
8 changes: 4 additions & 4 deletions BioSQL/Loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -650,8 +650,8 @@ def _load_bioentry_table(self, record):
%s,
%s,
%s)"""
# print self.dbid, taxon_id, record.name, accession, identifier, \
# division, description, version
# print(self.dbid, taxon_id, record.name, accession, identifier, \
# division, description, version)
self.adaptor.execute(
sql,
(
Expand Down Expand Up @@ -795,8 +795,8 @@ def _load_annotations(self, record, bioentry_id):
self.adaptor.execute(mono_sql, (bioentry_id, term_id, str(value)))
else:
pass
# print "Ignoring annotation '%s' entry of type '%s'" \
# % (key, type(value))
# print("Ignoring annotation '%s' entry of type '%s'" \
# % (key, type(value)))

def _load_reference(self, reference, rank, bioentry_id):
"""Record SeqRecord's annotated references in the database (PRIVATE).
Expand Down
2 changes: 1 addition & 1 deletion Tests/test_codonalign.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def setUp(self):

def test_IO(self):
self.assertEqual(len(self.alns), 6)
# print temp_dir
# print(temp_dir)
for n, i in enumerate(self.alns):
aln = i.toMultipleSeqAlignment()
AlignIO.write(aln, temp_dir + "/aln" + str(n) + ".clw", "clustal")
Expand Down

0 comments on commit c770cdd

Please sign in to comment.