black v23.9.1

Had to tweak four conflicts with D202
This commit is contained in:
Peter Cock
2023-10-04 17:05:30 +01:00
parent 97230db93c
commit 0938871295
81 changed files with 36 additions and 128 deletions

View File

@ -378,7 +378,7 @@ class SummaryInfo:
# fill in the ic_vector member: holds IC for each column
# reset ic_vector to empty list at each call
self.ic_vector = []
for (i, k) in enumerate(info_content):
for i, k in enumerate(info_content):
self.ic_vector.append(info_content[i + start])
return total_info

View File

@ -1191,7 +1191,6 @@ class _ExtraIndex:
class _ExtraIndices(list):
formatter = struct.Struct("=HHQ52x")
def __init__(self, names, declaration):
@ -1244,7 +1243,6 @@ class _ZoomLevel:
class _ZoomLevels(list):
bbiResIncrement = 4
bbiMaxZoomLevels = 10
size = _ZoomLevel.formatter.size * bbiMaxZoomLevels
@ -1352,7 +1350,6 @@ class _Region:
class _RegionSummary(_Summary):
__slots__ = _Region.__slots__ + _Summary.__slots__
formatter = struct.Struct("=IIIIffff")
@ -1678,7 +1675,6 @@ class _RedBlackTreeNode:
class _RTreeFormatter:
signature = 0x2468ACE0
def __init__(self, byteorder="="):
@ -2019,11 +2015,9 @@ class _RTreeFormatter:
class _BPlusTreeFormatter:
signature = 0x78CA8C91
def __init__(self, byteorder="="):
# Supplemental Table 8: Chromosome B+ tree header
# magic 4 bytes, unsigned
# blockSize 4 bytes, unsigned

View File

@ -543,9 +543,7 @@ class AlignmentIterator(interfaces.AlignmentIterator):
coordinates[1, 0] = qs
operations = bytearray(n)
i = 0
for (operation, query_step, target_step) in zip(
ops, words[10::3], words[11::3]
):
for operation, query_step, target_step in zip(ops, words[10::3], words[11::3]):
query_step = int(query_step)
target_step = int(target_step)
if operation == "M": # Match

View File

@ -184,7 +184,7 @@ def MafIterator(handle, seq_count=None):
ref = records[0].seq
new = []
for (letter, ref_letter) in zip(sequence, ref):
for letter, ref_letter in zip(sequence, ref):
new.append(ref_letter if letter == "." else letter)
sequence = "".join(new)

View File

@ -469,7 +469,6 @@ class StockholmIterator(AlignmentIterator):
self.seq_col_annotation = gr
if ids and seqs:
if (
self.records_per_alignment is not None
and self.records_per_alignment != len(ids)

View File

@ -165,7 +165,6 @@ def __read(handle):
record = None
for line in handle:
key, value = line[:2], line[5:].rstrip()
if key == "ID":
record = Record()

View File

@ -350,7 +350,7 @@ class Chromosome(_ChromosomeComponent):
"start",
),
]:
for (y1, y2, color, back_color, name) in labels:
for y1, y2, color, back_color, name in labels:
cur_drawing.add(
Line(x1, y1, x2, y2, strokeColor=color, strokeWidth=0.25)
)
@ -494,7 +494,6 @@ class ChromosomeSegment(_ChromosomeComponent):
This may be overlapped by any sub-feature labels on other segments!
"""
if self.label is not None:
label_x = 0.5 * (self.start_x_position + self.end_x_position) + (
self.chr_percent + 0.05
) * (self.end_x_position - self.start_x_position)

View File

@ -203,7 +203,7 @@ def draw_polygon(
strokecolor, color = _stroke_and_fill_colors(color, border)
xy_list = []
for (x, y) in list_of_points:
for x, y in list_of_points:
xy_list.append(x)
xy_list.append(y)

View File

@ -193,6 +193,5 @@ class Feature:
################################################################################
if __name__ == "__main__":
# Test code
gdf = Feature()

View File

@ -93,7 +93,7 @@ class GraphData:
def set_data(self, data):
"""Add data as a list of (position, value) tuples."""
for (pos, val) in data: # Fill data dictionary
for pos, val in data: # Fill data dictionary
self.data[pos] = val
def get_data(self):

View File

@ -231,7 +231,7 @@ class KGMLCanvas:
else:
self.drawing.setLineWidth(1)
p.moveTo(x, y)
for (x, y) in graphics.coords:
for x, y in graphics.coords:
p.lineTo(x, y)
self.drawing.drawPath(p)
self.drawing.setLineWidth(1) # Return to default

View File

@ -607,7 +607,7 @@ class Graphics:
"fgcolor": fghex,
"bgcolor": bghex,
}
for (n, attr) in [
for n, attr in [
("x", "_x"),
("y", "_y"),
("width", "_width"),
@ -850,7 +850,7 @@ class Relation:
"entry2": str(self._entry2),
"type": self.type,
}
for (name, value) in self.subtypes:
for name, value in self.subtypes:
subtype = ET.Element("subtype")
subtype.attrib = {"name": name, "value": str(value)}
relation.append(subtype)

View File

@ -200,7 +200,6 @@ def kegg_get(dbentries, option=None):
#
# <option> = aaseq | ntseq | mol | kcf | image
if option in ["aaseq", "ntseq", "mol", "kcf", "image", "kgml", "json"]:
resp = _q("get", dbentries, option)
elif option:
raise ValueError("Invalid option arg for kegg get request.")
@ -265,7 +264,6 @@ def kegg_conv(target_db, source_db, option=None):
and source_db in ["drug", "compound", "glycan"]
)
):
if option:
resp = _q("conv", target_db, source_db, option)
else:

View File

@ -95,7 +95,6 @@ class Peaklist:
def __init__(self, infn):
"""Initialize the class."""
with open(infn) as infile:
# Read in the header lines
self.firstline = infile.readline().split("\012")[0]
self.axislabels = infile.readline().split("\012")[0]

View File

@ -441,8 +441,8 @@ class Tree(Nodes.Chain):
and tree2.node(n).data.support >= threshold
]
conflict = []
for (st1, sup1) in t1:
for (st2, sup2) in t2:
for st1, sup1 in t1:
for st2, sup2 in t2:
if not st1.issubset(st2) and not st2.issubset(
st1
): # don't hiccup on upstream nodes
@ -586,7 +586,7 @@ class Tree(Nodes.Chain):
terminals.remove(newsplit)
# distribute taxon labels randomly
random.shuffle(taxon_list)
for (node, name) in zip(terminals, taxon_list):
for node, name in zip(terminals, taxon_list):
self.node(node).data.taxon = name
def display(self):

View File

@ -226,7 +226,7 @@ class HSExposureCA(_AbstractHSExposure):
fp.write("obj=[\n")
fp.write("BEGIN, LINES,\n")
fp.write(f"COLOR, {1.0:.2f}, {1.0:.2f}, {1.0:.2f},\n")
for (ca, cb) in self.ca_cb_list:
for ca, cb in self.ca_cb_list:
x, y, z = ca.get_array()
fp.write(f"VERTEX, {x:.2f}, {y:.2f}, {z:.2f},\n")
x, y, z = cb.get_array()

View File

@ -72,7 +72,7 @@ class MMCIF2Dict(dict):
# quote character of the currently open quote, or None if no quote open
quote_open_char = None
start_i = 0
for (i, c) in enumerate(line):
for i, c in enumerate(line):
if c in self.whitespace_chars:
if in_token and not quote_open_char:
in_token = False

View File

@ -135,7 +135,6 @@ class MMCIFParser:
return self.header
def _build_structure(self, structure_id):
# two special chars as placeholders in the mmCIF format
# for item values that cannot be explicitly assigned
# see: pdbx/mmcif syntax web page
@ -203,7 +202,6 @@ class MMCIFParser:
current_model_id = -1
current_serial_id = -1
for i in range(0, len(atom_id_list)):
# set the line_counter for 'ATOM' lines only and not
# as a global line counter found in the PDBParser()
structure_builder.set_line_counter(i)
@ -399,7 +397,6 @@ class FastMMCIFParser:
# Private methods
def _build_structure(self, structure_id, filehandle):
# two special chars as placeholders in the mmCIF format
# for item values that cannot be explicitly assigned
# see: pdbx/mmcif syntax web page
@ -502,7 +499,6 @@ class FastMMCIFParser:
current_model_id = -1
current_serial_id = -1
for i in range(0, len(atom_id_list)):
# set the line_counter for 'ATOM' lines only and not
# as a global line counter found in the PDBParser()
structure_builder.set_line_counter(i)

View File

@ -58,7 +58,7 @@ class NeighborSearch:
# pairs.
# o pair_list - a list of (entity, entity) tuples
parent_pair_list = []
for (e1, e2) in pair_list:
for e1, e2 in pair_list:
p1 = e1.get_parent()
p2 = e2.get_parent()
if p1 == p2:

View File

@ -668,7 +668,6 @@ class PDBList:
if __name__ == "__main__":
doc = """PDBList.py
(c) Kristian Rother 2003, Wiktoria Karwicka & Jacek Smietanski 2016
Contributed to Biopython

View File

@ -450,6 +450,8 @@ def read_PIC(
def dihedra_check(ric: IC_Residue) -> None:
"""Look for required dihedra in residue, generate defaults if set."""
# This method has some internal functions
# rnext should be set
def ake_recurse(akList: List) -> List:
"""Bulid combinatorics of AtomKey lists."""

View File

@ -206,7 +206,6 @@ class ShrakeRupley:
asa_array = np.zeros((n_atoms, 1), dtype=np.int64)
ptset = set(range(self.n_points))
for i in range(n_atoms):
r_i = radii[i]
# Move sphere to atom

View File

@ -341,7 +341,7 @@ class PrintFormat:
resultKeys = sorted(str(x) for x, y in ls)
map = title or ""
enzymemap = {}
for (enzyme, cut) in ls:
for enzyme, cut in ls:
for c in cut:
if c in enzymemap:
enzymemap[c].append(str(enzyme))

View File

@ -258,7 +258,6 @@ class Scop:
n = sunidDict[record.sunid]
if record.parent != "": # Not root node
if record.parent not in sunidDict:
raise ValueError("Incomplete data?")

View File

@ -175,7 +175,6 @@ def _compute_gapopen_num(hsp):
def _augment_blast_hsp(hsp, attr):
"""Calculate the given HSP attribute, for writing (PRIVATE)."""
if not hasattr(hsp, attr) and not attr.endswith("_pct"):
# aln_span is number of identical matches + mismatches + gaps
if attr == "aln_span":
hsp.aln_span = hsp.ident_num + hsp.mismatch_num + hsp.gap_num

View File

@ -290,7 +290,6 @@ class BlastXmlParser:
# </Iteration> marks the end of a single query
# which means we can process it
if event == "end" and qresult_elem.tag == "Iteration":
# we'll use the following schema
# <!ELEMENT Iteration (
# Iteration_iter-num,
@ -417,7 +416,6 @@ class BlastXmlParser:
root_hit_elem = []
for hit_elem in root_hit_elem:
# BLAST sometimes mangles the sequence IDs and descriptions, so we need
# to extract the actual values.
raw_hit_id = hit_elem.findtext("Hit_id")

View File

@ -674,7 +674,6 @@ class BlatPslWriter:
for hit in qresult:
for hsp in hit.hsps:
query_is_protein = getattr(hsp, "query_is_protein", False)
blocksize_multiplier = 3 if query_is_protein else 1

View File

@ -188,7 +188,6 @@ def _split_fragment(frag):
abs_pos = 0
# split according to hit, then query
while simil:
try:
shifts = re.search(_RE_SHIFTS, simil).group(1)
s_start = simil.find(shifts)

View File

@ -401,7 +401,6 @@ class ExonerateTextParser(_BaseExonerateParser):
# compute start and end coords for each block
for seq_type in ("query", "hit"):
# ner blocks and intron blocks require different adjustments
if not has_ner:
opp_type = "hit" if seq_type == "query" else "query"
@ -449,7 +448,6 @@ class ExonerateTextParser(_BaseExonerateParser):
# flag for vulgar line, if present, we can parse coordinates from it
vulgar_comp = None
while True:
match = re.search(_RE_ALN_ROW, self.line.strip())
# if we have a match, set flags and values
if match and not in_aln_row:

View File

@ -325,7 +325,6 @@ class FastaM10Parser:
line = self.line
while True:
# one line before the hit table
if line.startswith("The best scores are:"):
qres_state = state_QRES_HITTAB

View File

@ -301,7 +301,6 @@ class Hmmer3DomtabHmmhitWriter:
qresult_acc = "-"
for hit in qresult:
# try to get hit accession
try:
hit_acc = hit.accession

View File

@ -100,7 +100,6 @@ class Hmmer3TextParser:
self._read_until(lambda line: line.startswith("Query:"))
while self.line:
regx = re.search(_QRE_ID_LEN, self.line)
while not regx:
@ -251,7 +250,6 @@ class Hmmer3TextParser:
or self.line.startswith(" Alignments for each domain:")
or self.line.startswith(">>")
):
hit_attr = hit_attrs.pop(0)
hit = Hit(hsp_list)
for attr, value in hit_attr.items():
@ -348,7 +346,6 @@ class Hmmer3TextParser:
# parse all the alignment blocks in the hsp
while True:
regx = None
# check for hit or query line

View File

@ -561,7 +561,6 @@ class SeqXmlWriter(SequenceWriter):
# The local species definition is only written if it differs from the global species definition
if local_org != self.species or local_ncbi_taxid != self.ncbiTaxId:
attr = {"name": local_org, "ncbiTaxID": str(local_ncbi_taxid)}
self.xml_generator.startElement("species", AttributesImpl(attr))
self.xml_generator.endElement("species")
@ -569,7 +568,6 @@ class SeqXmlWriter(SequenceWriter):
def _write_description(self, record):
"""Write the description if given (PRIVATE)."""
if record.description:
if not isinstance(record.description, str):
raise TypeError("Description should be of type string")
@ -612,9 +610,7 @@ class SeqXmlWriter(SequenceWriter):
def _write_dbxrefs(self, record):
"""Write all database cross references (PRIVATE)."""
if record.dbxrefs is not None:
for dbxref in record.dbxrefs:
if not isinstance(dbxref, str):
raise TypeError("dbxrefs should be of type list of string")
if dbxref.find(":") < 1:
@ -631,17 +627,13 @@ class SeqXmlWriter(SequenceWriter):
def _write_properties(self, record):
"""Write all annotations that are key value pairs with values of a primitive type or list of primitive types (PRIVATE)."""
for key, value in record.annotations.items():
if key not in ("organism", "ncbi_taxid", "source"):
if value is None:
attr = {"name": key}
self.xml_generator.startElement("property", AttributesImpl(attr))
self.xml_generator.endElement("property")
elif isinstance(value, list):
for v in value:
if v is None:
attr = {"name": key}
@ -653,7 +645,6 @@ class SeqXmlWriter(SequenceWriter):
self.xml_generator.endElement("property")
elif isinstance(value, (int, float, str)):
attr = {"name": key, "value": str(value)}
self.xml_generator.startElement("property", AttributesImpl(attr))
self.xml_generator.endElement("property")

View File

@ -318,7 +318,7 @@ class SnapGeneIterator(SequenceIterator):
raise ValueError("The file does not start with a SnapGene cookie packet")
_parse_cookie_packet(length, data, record)
for (packet_type, length, data) in packets:
for packet_type, length, data in packets:
handler = _packet_handlers.get(packet_type)
if handler is not None:
handler(length, data, record)

View File

@ -112,7 +112,7 @@ class _RestrictedDict(Dict[str, Sequence[Any]]):
def update(self, new_dict):
# Force this to go via our strict __setitem__ method
for (key, value) in new_dict.items():
for key, value in new_dict.items():
self[key] = value

View File

@ -160,7 +160,6 @@ class CodonAdaptationIndex:
def _count_codons(self, fasta_file):
with open(fasta_file) as handle:
# make the codon dictionary local
self.codon_count = CodonsDict.copy()

View File

@ -117,7 +117,7 @@ class ds:
if -1 in tagpos:
del tagpos[-1]
ps = sorted(tagpos) # the keys
for (p1, p2) in zip(ps, ps[1:] + [len(line) + 1]):
for p1, p2 in zip(ps, ps[1:] + [len(line) + 1]):
setattr(
self,
tagpos[p1].lower(),
@ -376,7 +376,6 @@ def parse(source):
# encountered at the end of file, to any previous read or contig.
# The sort() method deals with that later.
while True:
# each read must have a rd and qa
try:
while True:

View File

@ -34,7 +34,6 @@ def read(handle):
line = line.strip()
if line:
if line.startswith(">"):
if motif_nbr != 0:
motif = motifs.Motif(alphabet="GATC", counts=nucleotide_counts)
motif.name = motif_name

View File

@ -30,7 +30,6 @@ if len(sys.argv) != 2:
parser = GenBank.FeatureParser(debug_level=2)
with open(sys.argv[1]) as handle:
iterator = GenBank.Iterator(handle, parser)
while True:

View File

@ -123,9 +123,7 @@ else:
residue_list = Selection.unfold_entities(m, "R")
for r in residue_list:
if k in r.xtra:
exposure = r.xtra[k]
if args.exp == "DSSPR":

View File

@ -200,7 +200,6 @@ def main(argv):
class TestRunner(unittest.TextTestRunner):
if __name__ == "__main__":
file = sys.argv[0]
else:

View File

@ -24,7 +24,6 @@ test_write_read_align_with_seq_count = test_write_read_alignment_formats + [
class TestAlignIO_exceptions(unittest.TestCase):
t_formats = list(AlignIO._FormatToWriter) + list(SeqIO._FormatToWriter)
def test_phylip_reject_duplicate(self):

View File

@ -20,7 +20,7 @@ class AlignInfoTests(unittest.TestCase):
def assertAlmostEqualList(self, list1, list2, **kwargs):
self.assertEqual(len(list1), len(list2))
for (v1, v2) in zip(list1, list2):
for v1, v2 in zip(list1, list2):
self.assertAlmostEqual(v1, v2, **kwargs)
def test_nucleotides(self):

View File

@ -26,7 +26,6 @@ except ImportError:
class TestAlign_dna_rna(unittest.TestCase):
# The PSL file dna_rna.psl was generated using this command:
# blat -mask=lower hg38.2bit rna.fa dna_rna.unsorted.psl
# pslSort dirs dna_rna.psl . dna_rna.unsorted.psl
@ -1326,7 +1325,6 @@ NR_111921 199 ATTAAAAAA 208
class TestAlign_dna(unittest.TestCase):
queries = {
record.id: str(record.seq)
for record in SeqIO.parse("Blat/fasta_34.fa", "fasta")

View File

@ -17,7 +17,6 @@ except ImportError:
class TestCluster(unittest.TestCase):
module = "Bio.Cluster"
def test_matrix_parse(self):

View File

@ -342,7 +342,6 @@ class TestURLConstruction(unittest.TestCase):
for alt_value in [alt_values[param], None]:
# Try both altering global variable and also passing parameter directly
for set_global in [False, True]:
variables = dict(vars_base)
with patch_urlopen() as patched:
@ -376,7 +375,6 @@ class TestURLConstruction(unittest.TestCase):
}
for etool in [Entrez.efetch, Entrez.epost]: # Make both GET and POST requests
with patch_urlopen() as patched:
etool(**variables)
assert Entrez._has_api_key(get_patched_request(patched, self))

View File

@ -8132,7 +8132,7 @@ class LineOneTests(unittest.TestCase):
None,
),
]
for (line, topo, mol_type, div, warning_list) in tests:
for line, topo, mol_type, div, warning_list in tests:
with warnings.catch_warnings(record=True) as caught:
warnings.simplefilter("always")
scanner = GenBank.Scanner.GenBankScanner()
@ -8206,7 +8206,7 @@ class LineOneTests(unittest.TestCase):
("ID DI500001 STANDARD; PRT; 111 AA.", None, None, None),
("ID DI644510 standard; PRT; 1852 AA.", None, None, None),
]
for (line, topo, mol_type, div) in tests:
for line, topo, mol_type, div in tests:
scanner = GenBank.Scanner.EmblScanner()
consumer = GenBank._FeatureConsumer(1, GenBank.FeatureValueCleaner)
scanner._feed_first_line(consumer, line)
@ -8230,7 +8230,7 @@ class LineOneTests(unittest.TestCase):
("ID HLA00001 standard; DNA; HUM; 3503 BP.", None, "DNA", "HUM"),
("ID HLA00001; SV 1; standard; DNA; HUM; 3503 BP.", None, "DNA", "HUM"),
]
for (line, topo, mol_type, div) in tests:
for line, topo, mol_type, div in tests:
scanner = GenBank.Scanner._ImgtScanner()
consumer = GenBank._FeatureConsumer(1, GenBank.FeatureValueCleaner)
scanner._feed_first_line(consumer, line)

View File

@ -24,7 +24,6 @@ SITECLASSES = {0: None, 1: 2, 2: 3, 3: 3, 7: 10, 8: 11, 22: 3}
class ModTest(unittest.TestCase):
align_dir = os.path.join("PAML", "Alignments")
tree_dir = os.path.join("PAML", "Trees")
ctl_dir = os.path.join("PAML", "Control_files")

View File

@ -14,7 +14,6 @@ import glob
class ModTest(unittest.TestCase):
align_dir = os.path.join("PAML", "Alignments")
tree_dir = os.path.join("PAML", "Trees")
ctl_dir = os.path.join("PAML", "Control_files")

View File

@ -61,7 +61,6 @@ class DSSP_tool_test(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.dssp_version = (0, 0, 0)
is_dssp_available = False
# Check if DSSP is installed

View File

@ -64,7 +64,6 @@ class NeighborTest(unittest.TestCase):
class KDTreeTest(unittest.TestCase):
nr_points = 5000 # number of points used in test
bucket_size = 5 # number of points per tree node
radius = 0.05 # radius of search (typically 0.05 or so)

View File

@ -148,6 +148,8 @@ class WriteTest(unittest.TestCase):
def test_mmcifio_select(self):
"""Write a selection of the structure using a Select subclass."""
# This method has an internal class defined
# Selection class to filter all alpha carbons
class CAonly(Select):
"""Accepts only CA residues."""

View File

@ -233,6 +233,8 @@ class WriteTest(unittest.TestCase):
def test_pdbio_select(self):
"""Write a selection of the structure using a Select subclass."""
# This method has an internal class definition
# Selection class to filter all alpha carbons
class CAonly(Select):
"""Accepts only CA residues."""

View File

@ -33,7 +33,6 @@ class CompareStructures(unittest.TestCase):
"""Tests for comparing the same structure parsed by PDB and MMCIF parsers."""
def setUp(self):
# Silence!
warnings.simplefilter("ignore", PDBConstructionWarning)

View File

@ -120,7 +120,6 @@ gi|11464971:4-101 gi|365982352|ref|XM_003667962.1| 30.77 52 27 1 12 54 3181 3336
class BlastTabIndexCases(CheckIndex):
fmt = "blast-tab"
def test_blasttab_2226_tblastn_001(self):

View File

@ -727,7 +727,6 @@ class BlastXmlRawCases(CheckRaw):
class BlastXmlIndexCases(CheckIndex):
fmt = "blast-xml"
def test_blastxml_2212L_blastp_001(self):

View File

@ -12,7 +12,6 @@ from search_tests_common import CheckIndex
class BlatPslIndexCases(CheckIndex):
fmt = "blat-psl"
def test_psl_34_001(self):

View File

@ -21,7 +21,6 @@ def get_file(filename):
class ExonerateSpcCases(unittest.TestCase):
coord = ("start", "end")
coords = ("inter_ranges",)
stype = ("hit_", "query_")
@ -68,7 +67,6 @@ class ExonerateSpcCases(unittest.TestCase):
class ExonerateTextCases(unittest.TestCase):
fmt = "exonerate-text"
def test_exn_22_m_affine_local(self):
@ -2396,7 +2394,6 @@ class ExonerateTextCases(unittest.TestCase):
class ExonerateVulgarCases(unittest.TestCase):
fmt = "exonerate-vulgar"
def test_exn_22_o_vulgar(self):
@ -2586,7 +2583,6 @@ class ExonerateVulgarCases(unittest.TestCase):
class ExonerateCigarCases(unittest.TestCase):
fmt = "exonerate-cigar"
def test_exn_22_o_vulgar_cigar(self):

View File

@ -12,7 +12,6 @@ from search_tests_common import CheckIndex
class ExonerateTextIndexCases(CheckIndex):
fmt = "exonerate-text"
def test_exn_22_m_est2genome(self):

View File

@ -12,7 +12,6 @@ from search_tests_common import CheckIndex
class ExonerateVulgarIndexCases(CheckIndex):
fmt = "exonerate-vulgar"
def test_exn_22_m_est2genome(self):

View File

@ -12,7 +12,6 @@ from search_tests_common import CheckIndex
class FastaM10IndexCases(CheckIndex):
fmt = "fasta-m10"
def test_output_002(self):

View File

@ -13,7 +13,6 @@ from Bio.SearchIO import parse, read
class HmmpfamTests(unittest.TestCase):
fmt = "hmmer2-text"
def test_hmmpfam_21(self):
@ -353,7 +352,6 @@ class HmmpfamTests(unittest.TestCase):
class HmmsearchTests(unittest.TestCase):
fmt = "hmmer2-text"
def test_hmmsearch_20(self):

View File

@ -12,7 +12,6 @@ from search_tests_common import CheckRaw, CheckIndex
class Hmmer2TextRawCases(CheckRaw):
fmt = "hmmer2-text"
def test_hmmer2text_22_single_hmmsearch(self):
@ -478,7 +477,6 @@ TFIIB: domain 1 of 1, from 253 to 268: score 2.6, E = 6.1
class Hmmer2TextIndexCases(CheckIndex):
fmt = "hmmer2-text"
def test_hmmertext_text_21_hmmpfam_001(self):

View File

@ -12,7 +12,6 @@ from search_tests_common import CheckRaw, CheckIndex
class HmmerDomtabRawCases(CheckRaw):
fmt = "hmmscan3-domtab"
def test_hmmerdomtab_30_multiple_first(self):

View File

@ -12,7 +12,6 @@ from search_tests_common import CheckRaw, CheckIndex
class Hmmer3TabRawCases(CheckRaw):
fmt = "hmmer3-tab"
def test_hmmer3tab_30_multiple_first(self):
@ -51,7 +50,6 @@ Ig_2 PF13895.1 gi|126362951:116-221 - 3.5e-05 23.7
class Hmmer3TabIndexCases(CheckIndex):
fmt = "hmmer3-tab"
def test_hmmer3tab_30_hmmscan_001(self):

View File

@ -11,7 +11,6 @@ from search_tests_common import CheckRaw, CheckIndex
class Hmmer3TextRawCases(CheckRaw):
fmt = "hmmer3-text"
def test_hmmer3text_30_multiple_first(self):
@ -301,7 +300,6 @@ Domain search space (domZ): 1 [number of targets reported over t
class Hmmer3TextIndexCases(CheckIndex):
fmt = "hmmer3-text"
def test_hmmertext_text_30_hmmscan_001(self):

View File

@ -82,7 +82,6 @@ file"""
class TestParserSupport(unittest.TestCase):
def test_TaggingConsumer(self):
h = StringIO()
tc = ParserSupport.TaggingConsumer(handle=h, colwidth=5)
tc.start_section()

View File

@ -39,7 +39,6 @@ class WriteCases(SearchTestBaseClass):
class BlastXmlWriteCases(WriteCases):
fmt = "blast-xml"
out = os.path.join("Blast", "test_write.xml")
@ -56,7 +55,6 @@ class BlastXmlWriteCases(WriteCases):
class BlastTabWriteCases(WriteCases):
fmt = "blast-tab"
out = os.path.join("Blast", "test_write.txt")
@ -141,7 +139,6 @@ class BlastTabWriteCases(WriteCases):
class HmmerTabWriteCases(WriteCases):
fmt = "hmmer3-tab"
out = os.path.join("Hmmer", "test_write.txt")
@ -158,7 +155,6 @@ class HmmerTabWriteCases(WriteCases):
class HmmerDomtabWriteCases(WriteCases):
out = os.path.join("Hmmer", "test_write.txt")
def test_write_single_from_hmmscandomtab(self):
@ -183,7 +179,6 @@ class HmmerDomtabWriteCases(WriteCases):
class BlatPslWriteCases(WriteCases):
fmt = "blat-psl"
out = os.path.join("Blat", "test_write.txt")

View File

@ -111,7 +111,7 @@ class ConvertTestsInsdc(SeqIOConverterTestBaseClass):
("GenBank/cor6_6.gb", "genbank"),
]
for filename, fmt in tests:
for (in_format, out_format) in self.formats:
for in_format, out_format in self.formats:
if in_format != fmt:
continue
self.check_conversion(filename, in_format, out_format)

View File

@ -1069,7 +1069,7 @@ class TestsConverter(SeqIOConverterTestBaseClass, QualityIOTestBaseClass):
("Quality/illumina_faked.fastq", "fastq-illumina"),
]
for filename, fmt in tests:
for (in_format, out_format) in self.formats:
for in_format, out_format in self.formats:
if in_format != fmt:
continue
self.check_conversion(filename, in_format, out_format)
@ -1100,7 +1100,7 @@ class TestsConverter(SeqIOConverterTestBaseClass, QualityIOTestBaseClass):
("Quality/error_double_qual.fastq", "fastq"),
]
for filename, fmt in tests:
for (in_format, out_format) in self.formats:
for in_format, out_format in self.formats:
if in_format != fmt:
continue
if (

View File

@ -27,7 +27,6 @@ class TestSimpleRead(unittest.TestCase):
class TestDetailedRead(unittest.TestCase):
records = {}
def setUp(self):
@ -176,7 +175,6 @@ class TestReadAndWrite(unittest.TestCase):
self._write_parse_and_compare(read1_records)
def _write_parse_and_compare(self, read1_records):
handle = BytesIO()
SeqIO.write(read1_records, handle, "seqxml")
@ -221,6 +219,7 @@ class TestReadCorruptFiles(unittest.TestCase):
# Since one block is likely large enough to cover the first few
# entries in the file, the ValueError may be raised after we call
# SeqIO.parse, before we start iterating over the file.
def f(path):
records = SeqIO.parse(path, "seqxml")
for record in records:

View File

@ -15,7 +15,6 @@ from Bio.SeqFeature import CompoundLocation
class TestSnapGene(unittest.TestCase):
sample_data = {
"sample-d": {
"file": "SnapGene/sample-d.dna",

View File

@ -19,7 +19,6 @@ from Bio.SeqRecord import SeqRecord
class TestXdna(unittest.TestCase):
sample_data = {
"sample-a": {
"file": "Xdna/sample-a.xdna",

View File

@ -337,7 +337,6 @@ if sqlite3:
class IndexDictTests(SeqRecordTestBaseClass, SeqIOTestBaseClass):
tests = [
("Ace/contig1.ace", "ace"),
("Ace/consed_sample.ace", "ace"),

View File

@ -295,7 +295,7 @@ class WriterTests(SeqIOTestBaseClass):
self.assertEqual(1, SeqIO.write(records, handle, fmt))
def test_alignment_formats(self):
for (records, descr, errs) in test_records:
for records, descr, errs in test_records:
for fmt in test_write_read_alignment_formats:
for err_formats, err_type, err_msg in errs:
if fmt in err_formats:

View File

@ -10,11 +10,9 @@ import unittest
class TestUniGene(unittest.TestCase):
def test_parse(self):
# Start of the UniGene file for Equus caballus downloaded from:
# ftp://ftp.ncbi.nih.gov/repository/UniGene/Equus_caballus
with open("UniGene/Eca.1.2425.data") as handle:
records = UniGene.parse(handle)
# First record
@ -863,7 +861,6 @@ class TestUniGene(unittest.TestCase):
)
def test_read(self):
# Start of the UniGene file for Homo sapiens downloaded from:
# ftp://ftp.ncbi.nih.gov/repository/UniGene/Homo_sapiens
with open("UniGene/Hs.2.data") as handle:
@ -1201,7 +1198,6 @@ class TestUniGene(unittest.TestCase):
)
def test_read_value_error(self):
# Test More than one SwissProt record found
with open("UniGene/Eca.1.2425.data") as handle:
self.assertRaises(ValueError, UniGene.read, handle)

View File

@ -56,7 +56,7 @@ class TestBasics(unittest.TestCase):
self.assertEqual(msa[0].id, "mixed")
self.assertEqual(msa[1].id, "lower")
self.assertEqual(msa[2].id, "upper")
for (col, letter) in enumerate(letters):
for col, letter in enumerate(letters):
self.assertEqual(msa[:, col], letter + letter.lower() + letter.upper())
# Check row extractions:
self.assertEqual(msa[0].id, "mixed")
@ -75,7 +75,7 @@ class TestBasics(unittest.TestCase):
self.assertEqual(alignment.sequences[0].id, "mixed")
self.assertEqual(alignment.sequences[1].id, "lower")
self.assertEqual(alignment.sequences[2].id, "upper")
for (col, letter) in enumerate(letters):
for col, letter in enumerate(letters):
self.assertEqual(
alignment[:, col], letter + letter.lower() + letter.upper()
)

View File

@ -279,7 +279,6 @@ Z 0.0
class TestScoringMatrices(unittest.TestCase):
@classmethod
def setUpClass(cls):
from Bio import SeqIO
from Bio.Align import PairwiseAligner

View File

@ -369,7 +369,6 @@ class BgzfTests(unittest.TestCase):
self.assertNotEqual(offset3, h.tell())
with bgzf.open(temp_file, "r") as h: # Text mode!
h.seek(offset) # i.e. End of first BGZF block
self.assertEqual(offset1, h.tell()) # Note *not* seek offset
# Now at start of second BGZF block

View File

@ -1744,7 +1744,6 @@ query 5 GTCCT 0
class TestPairwiseMatchDictionary(unittest.TestCase):
match_dict = {("A", "A"): 1.5, ("A", "T"): 0.5, ("T", "A"): 0.5, ("T", "T"): 1.0}
def test_match_dictionary1(self):

View File

@ -193,7 +193,6 @@ class SamtoolsTestCase(unittest.TestCase):
# TODO: def test_fixmate(self):
def test_sort(self):
cmdline = SamtoolsVersion0xSortCommandline(samtools_exe)
cmdline.set_parameter("input", self.bamfile1)
cmdline.set_parameter("out_prefix", "SamBam/out")