diff --git a/jcvi/annotation/depth.py b/jcvi/annotation/depth.py index 42fa1945..2fbd8971 100755 --- a/jcvi/annotation/depth.py +++ b/jcvi/annotation/depth.py @@ -25,7 +25,7 @@ class BinFile(BaseFile): """ def __init__(self, binfile, dtype=np.uint8): - super(BinFile, self).__init__(binfile) + super().__init__(binfile) assert op.exists( binfile ), "Binary file `{0}` not found. Rerun depth.count().".format(binfile) diff --git a/jcvi/annotation/maker.py b/jcvi/annotation/maker.py index c0e50216..bdb7c139 100644 --- a/jcvi/annotation/maker.py +++ b/jcvi/annotation/maker.py @@ -59,7 +59,7 @@ def __str__(self): class CTLFile(LineFile): def __init__(self, filename): - super(CTLFile, self).__init__(filename) + super().__init__(filename) fp = open(filename) for row in fp: self.append(CTLine(row)) @@ -90,7 +90,7 @@ def write_file(self, filename): class DatastoreIndexFile(BaseFile): def __init__(self, filename): - super(DatastoreIndexFile, self).__init__(filename) + super().__init__(filename) scaffold_status = {} failed = [] diff --git a/jcvi/apps/base.py b/jcvi/apps/base.py index a519f764..cdee0853 100644 --- a/jcvi/apps/base.py +++ b/jcvi/apps/base.py @@ -139,7 +139,7 @@ class OptionParser(ArgumentParser): def __init__(self, doc: Optional[str]): usage = doc.replace("%prog", "%(prog)s") if doc else None - super(OptionParser, self).__init__(usage=usage, epilog=JCVIHELP) + super().__init__(usage=usage, epilog=JCVIHELP) def parse_args(self, args=None): """ diff --git a/jcvi/apps/bowtie.py b/jcvi/apps/bowtie.py index 1fb266fc..bf626b0f 100644 --- a/jcvi/apps/bowtie.py +++ b/jcvi/apps/bowtie.py @@ -40,7 +40,7 @@ class BowtieLogFile(BaseFile): def __init__(self, filename): - super(BowtieLogFile, self).__init__(filename) + super().__init__(filename) fp = open(filename) self.total = int(first_tag(fp)) self.unpaired = int(first_tag(fp)) diff --git a/jcvi/apps/cdhit.py b/jcvi/apps/cdhit.py index 0bbc0940..0a20e228 100644 --- a/jcvi/apps/cdhit.py +++ b/jcvi/apps/cdhit.py @@ -35,7 +35,7 @@ def __init__(self, row): class ClstrFile(LineFile): def __init__(self, filename): - super(ClstrFile, self).__init__(filename) + super().__init__(filename) assert filename.endswith(".clstr") fp = open(filename) diff --git a/jcvi/apps/grid.py b/jcvi/apps/grid.py index 81f4859a..5a3a3b4f 100644 --- a/jcvi/apps/grid.py +++ b/jcvi/apps/grid.py @@ -73,16 +73,16 @@ class Queue(Queue): """ def __init__(self, *args, **kwargs): - super(Queue, self).__init__(*args, **kwargs, ctx=get_context()) + super().__init__(*args, **kwargs, ctx=get_context()) self.size = SharedCounter(0) def put(self, *args, **kwargs): self.size.increment(1) - super(Queue, self).put(*args, **kwargs) + super().put(*args, **kwargs) def get(self, *args, **kwargs): self.size.increment(-1) - return super(Queue, self).get(*args, **kwargs) + return super().get(*args, **kwargs) def qsize(self): """Reliable implementation of multiprocessing.Queue.qsize()""" diff --git a/jcvi/apps/uclust.py b/jcvi/apps/uclust.py index 3620b4d8..1da53f33 100644 --- a/jcvi/apps/uclust.py +++ b/jcvi/apps/uclust.py @@ -66,7 +66,7 @@ class ClustFile(BaseFile): def __init__(self, filename): - super(ClustFile, self).__init__(filename) + super().__init__(filename) def __iter__(self): nstacks = 0 @@ -87,7 +87,7 @@ def __iter__(self): class Clust(list): def __init__(self): - super(Clust, self).__init__(self) + super().__init__(self) def __str__(self): s = [] @@ -98,7 +98,7 @@ def __str__(self): class ClustStore(BaseFile): def __init__(self, consensfile): - super(ClustStore, self).__init__(consensfile) + super().__init__(consensfile) binfile = consensfile + ".bin" idxfile = consensfile + ".idx" self.bin = np.fromfile(binfile, dtype=np.uint16) @@ -180,7 +180,7 @@ class ClustStores(dict): """ def __init__(self, consensfiles): - super(ClustStores, self).__init__(self) + super().__init__(self) for cs in consensfiles: name = op.basename(cs).split(".")[0] self[name] = ClustStore(cs) diff --git a/jcvi/assembly/allmaps.py b/jcvi/assembly/allmaps.py index 9eaa285e..575554ce 100644 --- a/jcvi/assembly/allmaps.py +++ b/jcvi/assembly/allmaps.py @@ -515,7 +515,7 @@ def __init__( remove_outliers=False, function=(lambda x: x.rank), ): - super(Map, self).__init__() + super().__init__() bed = Bed(filename) for b in bed: self.append(Marker(b)) @@ -635,7 +635,7 @@ def export_table(self, r, mapname, total): class Weights(DictFile): def __init__(self, filename, mapnames, cast=int): - super(Weights, self).__init__(filename, cast=cast) + super().__init__(filename, cast=cast) self.maps = [x.split()[0] for x in must_open(filename)] self.update_maps(mapnames) pivot_weight, o, pivot = self.get_pivot(mapnames) diff --git a/jcvi/assembly/allpaths.py b/jcvi/assembly/allpaths.py index 4575a551..e95c3e18 100644 --- a/jcvi/assembly/allpaths.py +++ b/jcvi/assembly/allpaths.py @@ -29,7 +29,7 @@ class PairsFile(BaseFile): def __init__(self, filename): - super(PairsFile, self).__init__(filename) + super().__init__(filename) fp = open(filename, "rb") (binwrite,) = unpack("8s", fp.read(8)) diff --git a/jcvi/assembly/automaton.py b/jcvi/assembly/automaton.py index 3a71130b..08ca0153 100644 --- a/jcvi/assembly/automaton.py +++ b/jcvi/assembly/automaton.py @@ -73,7 +73,7 @@ def guess(self): class MetaFile(LineFile): def __init__(self, filename): - super(MetaFile, self).__init__(filename) + super().__init__(filename) fp = open(filename) for row in fp: genome, tag, fastq = row.split() diff --git a/jcvi/assembly/coverage.py b/jcvi/assembly/coverage.py index 9dfa17bc..da5aab99 100644 --- a/jcvi/assembly/coverage.py +++ b/jcvi/assembly/coverage.py @@ -34,7 +34,7 @@ def __init__(self, bedfile, sizesfile): filename = coveragefile assert filename.endswith(".coverage") - super(Coverage, self).__init__(filename) + super().__init__(filename) def get_plot_data(self, ctg, bins=None): import numpy as np diff --git a/jcvi/assembly/geneticmap.py b/jcvi/assembly/geneticmap.py index d09c96b1..2720c3ae 100644 --- a/jcvi/assembly/geneticmap.py +++ b/jcvi/assembly/geneticmap.py @@ -47,7 +47,7 @@ class BinMap(BaseFile, dict): def __init__(self, filename): - super(BinMap, self).__init__(filename) + super().__init__(filename) fp = open(filename) for header, seq in read_block(fp, "group "): @@ -111,7 +111,7 @@ def bedline(self): class MSTMap(LineFile): def __init__(self, filename): - super(MSTMap, self).__init__(filename) + super().__init__(filename) fp = open(filename) startidx = 1 for row in fp: diff --git a/jcvi/assembly/goldenpath.py b/jcvi/assembly/goldenpath.py index ee71b2c3..5108a5c6 100644 --- a/jcvi/assembly/goldenpath.py +++ b/jcvi/assembly/goldenpath.py @@ -357,7 +357,7 @@ class Certificate(BaseFile): def __init__(self, filename): - super(Certificate, self).__init__(filename) + super().__init__(filename) fp = open(filename) self.lines = [CertificateLine(x) for x in fp.readlines()] diff --git a/jcvi/assembly/hic.py b/jcvi/assembly/hic.py index 9169b40a..f4392b88 100644 --- a/jcvi/assembly/hic.py +++ b/jcvi/assembly/hic.py @@ -84,7 +84,7 @@ class ContigOrdering(LineFile): """ def __init__(self, filename): - super(ContigOrdering, self).__init__(filename) + super().__init__(filename) fp = open(filename) for row in fp: if row[0] == "#": diff --git a/jcvi/assembly/kmer.py b/jcvi/assembly/kmer.py index 9f43c2a4..f50d69ca 100644 --- a/jcvi/assembly/kmer.py +++ b/jcvi/assembly/kmer.py @@ -48,7 +48,7 @@ class KmerSpectrum(BaseFile): def __init__(self, histfile): - super(KmerSpectrum, self).__init__(histfile) + super().__init__(histfile) self.load_data(histfile) def load_data(self, histfile): diff --git a/jcvi/assembly/preprocess.py b/jcvi/assembly/preprocess.py index 849279c6..54b7659f 100644 --- a/jcvi/assembly/preprocess.py +++ b/jcvi/assembly/preprocess.py @@ -26,7 +26,7 @@ class FastQCdata(BaseFile, dict): def __init__(self, filename, human=False): - super(FastQCdata, self).__init__(filename) + super().__init__(filename) if not op.exists(filename): logger.debug("File `%s` not found.", filename) # Sample_RF37-1/RF37-1_GATCAG_L008_R2_fastqc => diff --git a/jcvi/assembly/syntenypath.py b/jcvi/assembly/syntenypath.py index 7d12d24f..82fa9a84 100644 --- a/jcvi/assembly/syntenypath.py +++ b/jcvi/assembly/syntenypath.py @@ -44,7 +44,7 @@ def tag(self): class OVL(LineFile): def __init__(self, filename): - super(OVL, self).__init__(filename) + super().__init__(filename) fp = must_open(filename) contained = set() alledges = defaultdict(list) diff --git a/jcvi/compara/base.py b/jcvi/compara/base.py index eae6ec6b..6cec765a 100644 --- a/jcvi/compara/base.py +++ b/jcvi/compara/base.py @@ -7,7 +7,7 @@ class AnchorFile(BaseFile): def __init__(self, filename, minsize=0): - super(AnchorFile, self).__init__(filename) + super().__init__(filename) self.blocks = list(self.iter_blocks(minsize=minsize)) def iter_blocks(self, minsize=0): diff --git a/jcvi/compara/catalog.py b/jcvi/compara/catalog.py index f98573a0..fe2d4247 100644 --- a/jcvi/compara/catalog.py +++ b/jcvi/compara/catalog.py @@ -39,7 +39,7 @@ class OMGFile(BaseFile): def __init__(self, filename): - super(OMGFile, self).__init__(filename) + super().__init__(filename) fp = open(filename) inblock = False components = [] diff --git a/jcvi/compara/ks.py b/jcvi/compara/ks.py index a26fe93a..2dfcf3e3 100644 --- a/jcvi/compara/ks.py +++ b/jcvi/compara/ks.py @@ -159,7 +159,7 @@ def __str__(self): class Layout(AbstractLayout): def __init__(self, filename, delimiter=",", seed: Optional[int] = None): - super(Layout, self).__init__(filename) + super().__init__(filename) if not op.exists(filename): ksfiles = iglob(".", "*.ks") header = "Ks file|ncomponents|label|color|marker".split("|") @@ -934,7 +934,7 @@ def anchorline(self): class KsFile(LineFile): def __init__(self, filename, strip_names=False): - super(KsFile, self).__init__(filename) + super().__init__(filename) fp = open(filename) for row in fp: diff --git a/jcvi/compara/synteny.py b/jcvi/compara/synteny.py index 31c6a941..b039ba87 100755 --- a/jcvi/compara/synteny.py +++ b/jcvi/compara/synteny.py @@ -28,7 +28,7 @@ class BlockFile(BaseFile): """Parse .blocks file which is the mcscan output with multiple columns as 'tracks'""" def __init__(self, filename, defaultcolor="#fb8072", header=False): - super(BlockFile, self).__init__(filename) + super().__init__(filename) fp = must_open(filename) hd = next(fp).rstrip().split("\t") ncols = len(hd) diff --git a/jcvi/formats/agp.py b/jcvi/formats/agp.py index dd9b8180..58c79362 100644 --- a/jcvi/formats/agp.py +++ b/jcvi/formats/agp.py @@ -286,7 +286,7 @@ def gline(cls, object, gap, unknown=100): class AGP(LineFile): def __init__(self, filename, nogaps=False, validate=True, sorted=True): - super(AGP, self).__init__(filename) + super().__init__(filename) fp = must_open(filename) self.header = [] @@ -653,7 +653,7 @@ def isCloneGap(self): class TPF(LineFile): def __init__(self, filename): - super(TPF, self).__init__(filename) + super().__init__(filename) fp = open(filename) for row in fp: if row[0] == "#": @@ -693,7 +693,7 @@ def __init__(self, id, component_id, component_size, strand): class OO(LineFile): def __init__(self, filename=None, ctgsizes=None): - super(OO, self).__init__(filename) + super().__init__(filename) if filename is None: return diff --git a/jcvi/formats/base.py b/jcvi/formats/base.py index f155fd94..f711b9ea 100644 --- a/jcvi/formats/base.py +++ b/jcvi/formats/base.py @@ -42,7 +42,7 @@ class LineFile(BaseFile, list): """ def __init__(self, filename, comment=None, load=False): - super(LineFile, self).__init__(filename) + super().__init__(filename) if load: fp = must_open(filename) @@ -117,7 +117,7 @@ def num_columns(cls, filename, delimiter=None): class SetFile(BaseFile, set): def __init__(self, filename, column=-1, delimiter=None): - super(SetFile, self).__init__(filename) + super().__init__(filename) fp = open(filename) for row in fp: if not row.strip(): diff --git a/jcvi/formats/bed.py b/jcvi/formats/bed.py index 3b361579..eb6886f5 100755 --- a/jcvi/formats/bed.py +++ b/jcvi/formats/bed.py @@ -143,7 +143,7 @@ def gffline(self, type="match", source="default"): class Bed(LineFile): def __init__(self, filename=None, key=None, sorted=True, juncs=False, include=None): - super(Bed, self).__init__(filename) + super().__init__(filename) # the sorting key provides some flexibility in ordering the features # for example, user might not like the lexico-order of seqid diff --git a/jcvi/formats/blast.py b/jcvi/formats/blast.py index e03b55e5..75de55f6 100644 --- a/jcvi/formats/blast.py +++ b/jcvi/formats/blast.py @@ -35,7 +35,7 @@ class BlastSlow(LineFile): """ def __init__(self, filename, sorted=False): - super(BlastSlow, self).__init__(filename) + super().__init__(filename) fp = must_open(filename) for row in fp: self.append(BlastLine(row)) @@ -75,7 +75,7 @@ class Blast(BaseFile): """ def __init__(self, filename): - super(Blast, self).__init__(filename) + super().__init__(filename) self.fp = must_open(filename) def __iter__(self): @@ -141,7 +141,7 @@ class BlastLineByConversion(BlastLine): def __init__(self, sline, mode="1" * 12): if int(mode, 2) == 4095: - super(BlastLineByConversion, self).__init__(sline) + super().__init__(sline) elif 3072 <= int(mode, 2) < 4095: args = sline.split("\t") atoms = args[:2] @@ -159,7 +159,7 @@ def __init__(self, sline, mode="1" * 12): else: atoms.append("-1") sline = "\t".join(atoms) - super(BlastLineByConversion, self).__init__(sline) + super().__init__(sline) else: m = "mode can only contain 0 or 1 \n" m += "first two fields (query, subject) cannot be empty" diff --git a/jcvi/formats/cdt.py b/jcvi/formats/cdt.py index e5a1173f..077b34f4 100644 --- a/jcvi/formats/cdt.py +++ b/jcvi/formats/cdt.py @@ -23,7 +23,7 @@ class CDT(BaseFile): def __init__(self, filename): - super(CDT, self).__init__(filename) + super().__init__(filename) pf = filename.rsplit(".", 1)[0] self.gtrfile = pf + ".gtr" diff --git a/jcvi/formats/chain.py b/jcvi/formats/chain.py index 732f8c56..4f4f0d96 100644 --- a/jcvi/formats/chain.py +++ b/jcvi/formats/chain.py @@ -52,7 +52,7 @@ def __init__(self, chain, lines): class Chain(BaseFile): def __init__(self, filename): - super(Chain, self).__init__(filename) + super().__init__(filename) self.chains = list(self.iter_chain()) self.ungapped = sum(x.ungapped for x in self.chains) diff --git a/jcvi/formats/contig.py b/jcvi/formats/contig.py index e3d87d1c..48882e0d 100644 --- a/jcvi/formats/contig.py +++ b/jcvi/formats/contig.py @@ -64,7 +64,7 @@ def __str__(self): class ContigFile(BaseFile): def __init__(self, filename): - super(ContigFile, self).__init__(filename) + super().__init__(filename) self.fp = open(filename) def iter_records(self): diff --git a/jcvi/formats/coords.py b/jcvi/formats/coords.py index c0aeca09..03596620 100644 --- a/jcvi/formats/coords.py +++ b/jcvi/formats/coords.py @@ -192,7 +192,7 @@ def __init__(self, filename, sorted=False, header=False): fromdelta([filename]) filename = coordsfile - super(Coords, self).__init__(filename) + super().__init__(filename) fp = open(filename) if header: diff --git a/jcvi/formats/fasta.py b/jcvi/formats/fasta.py index e78b38f7..3846609c 100644 --- a/jcvi/formats/fasta.py +++ b/jcvi/formats/fasta.py @@ -29,7 +29,7 @@ class Fasta(BaseFile, dict): def __init__(self, filename, index=False, key_function=None, lazy=False): - super(Fasta, self).__init__(filename) + super().__init__(filename) self.key_function = key_function if lazy: # do not incur the overhead diff --git a/jcvi/formats/genbank.py b/jcvi/formats/genbank.py index cec25a11..28a85e22 100644 --- a/jcvi/formats/genbank.py +++ b/jcvi/formats/genbank.py @@ -29,7 +29,7 @@ class MultiGenBank(BaseFile): """ def __init__(self, filename, source="JCVI"): - super(MultiGenBank, self).__init__(filename) + super().__init__(filename) assert op.exists(filename) pf = filename.rsplit(".", 1)[0] diff --git a/jcvi/formats/gff.py b/jcvi/formats/gff.py index 88c09e2b..36f8faf5 100644 --- a/jcvi/formats/gff.py +++ b/jcvi/formats/gff.py @@ -325,7 +325,7 @@ def __init__( make_gff_store=False, compute_signature=False, ): - super(Gff, self).__init__(filename) + super().__init__(filename) self.make_gff_store = make_gff_store self.gff3 = True if self.make_gff_store: diff --git a/jcvi/formats/maf.py b/jcvi/formats/maf.py index 4317d5ab..3084a77c 100644 --- a/jcvi/formats/maf.py +++ b/jcvi/formats/maf.py @@ -18,7 +18,7 @@ class Maf(BaseFile, dict): def __init__(self, filename, index=False): - super(Maf, self).__init__(filename) + super().__init__(filename) indexfile = filename + ".idx" if index: diff --git a/jcvi/formats/psl.py b/jcvi/formats/psl.py index 5b0af407..df1774c8 100755 --- a/jcvi/formats/psl.py +++ b/jcvi/formats/psl.py @@ -254,10 +254,7 @@ def bed12line(self): class Psl(LineFile): def __init__(self, filename=None): - super(Psl, self).__init__(filename) - - import re - + super().__init__(filename) self.mCounts = {} # dict to hold match counts if not filename: return diff --git a/jcvi/formats/sam.py b/jcvi/formats/sam.py index a9c59ca0..01b4d904 100644 --- a/jcvi/formats/sam.py +++ b/jcvi/formats/sam.py @@ -93,7 +93,7 @@ def pairline(self): class Sam(LineFile): def __init__(self, filename, callback=None): - super(Sam, self).__init__(filename) + super().__init__(filename) fp = open(filename) for row in fp: if row[0] == "@": @@ -126,7 +126,7 @@ def __init__(self, row): class GenomeCoverageFile(LineFile): def __init__(self, filename): - super(GenomeCoverageFile, self).__init__(filename) + super().__init__(filename) fp = open(filename) for row in fp: self.append(GenomeCoverageLine(row)) diff --git a/jcvi/formats/sizes.py b/jcvi/formats/sizes.py index 92db1001..c2817eaf 100644 --- a/jcvi/formats/sizes.py +++ b/jcvi/formats/sizes.py @@ -44,7 +44,7 @@ def __init__(self, filename, select=None): assert filename.endswith(".sizes") - super(Sizes, self).__init__(filename) + super().__init__(filename) self.fp = open(filename) self.filename = filename diff --git a/jcvi/graphics/align.py b/jcvi/graphics/align.py index 7328b905..a8ab05a7 100644 --- a/jcvi/graphics/align.py +++ b/jcvi/graphics/align.py @@ -74,7 +74,7 @@ def duplicate(self, a, b, gap=0): class PairwiseAlign(BaseAlign): def __init__(self, fig, xywh, xpad=0.15, ypad=0.15): - super(PairwiseAlign, self).__init__(fig, xywh, xpad, ypad) + super().__init__(fig, xywh, xpad, ypad) def draw(self, width=0.03): HorizontalChromosome( @@ -107,7 +107,7 @@ def draw(self, width=0.03): class ReadAlign(BaseAlign): def __init__(self, fig, xywh, xpad=0.05, ypad=0.2, readlen=6, gap=3): - super(ReadAlign, self).__init__(fig, xywh, xpad, ypad) + super().__init__(fig, xywh, xpad, ypad) self.readlen = readlen self.gap = gap self.reads = [] @@ -214,7 +214,7 @@ def duplicate(self, a, b, gap=0): class OpticalMapAlign(BaseAlign): def __init__(self, fig, xywh, xpad=0.05, ypad=0.3): - super(OpticalMapAlign, self).__init__(fig, xywh, xpad, ypad) + super().__init__(fig, xywh, xpad, ypad) om = self.from_silico() self.om1 = OpticalMapTrack(self.sax, om) self.om2 = OpticalMapTrack(self.sax, om, ystart=-3, color="orange") @@ -263,7 +263,7 @@ def duplicate(self, a, b, gap=0): class OpticalMapTrack(BaseGlyph): def __init__(self, ax, sizes, ystart=0, color="darkslategrey", height=1, wiggle=3): - super(OpticalMapTrack, self).__init__(ax) + super().__init__(ax) self.ax = ax self.sizes = sizes[:] self.ystart = ystart diff --git a/jcvi/graphics/base.py b/jcvi/graphics/base.py index c956b3ba..6b40aa45 100644 --- a/jcvi/graphics/base.py +++ b/jcvi/graphics/base.py @@ -129,7 +129,7 @@ class AbstractLayout(LineFile): """ def __init__(self, filename): - super(AbstractLayout, self).__init__(filename) + super().__init__(filename) def assign_array(self, attrib, array): assert len(array) == len(self) @@ -708,7 +708,7 @@ def draw_cmap(ax, cmap_text, vmin, vmax, cmap=None, reverse=False): ax.text(x, ymin - 0.005, "%.1f" % v, ha="center", va="top", size=10) -def write_messages(ax, messages: List[str], ypad: float=0.04): +def write_messages(ax, messages: List[str], ypad: float = 0.04): """ Write text on canvas, usually on the top right corner. """ diff --git a/jcvi/graphics/chromosome.py b/jcvi/graphics/chromosome.py index 10a7ba39..6aa6fada 100644 --- a/jcvi/graphics/chromosome.py +++ b/jcvi/graphics/chromosome.py @@ -60,7 +60,7 @@ def __init__( alternating shades. Use a list of starting locations to segment. """ y1, y2 = sorted((y1, y2)) - super(Chromosome, self).__init__(ax) + super().__init__(ax) pts, r = self.get_pts(x, y1, y2, width) self.append(Polygon(pts, fill=False, lw=lw, ec=ec, zorder=zorder)) if patch: @@ -112,7 +112,7 @@ def __init__( assert style in Chromosome.Styles, f"Unknown style `{style}`" x1, x2 = sorted((x1, x2)) - super(HorizontalChromosome, self).__init__(ax) + super().__init__(ax) pts, r = self.get_pts(x1, x2, y, height, style=style) self.append(Polygon(pts, fill=False, lw=lw, ec=ec, zorder=zorder + 1)) @@ -235,7 +235,7 @@ class GeneticMap(BaseGlyph): def __init__( self, ax, x, y1, y2, markers, unit="cM", tip=0.008, fc="k", flip=False ): - super(GeneticMap, self).__init__(ax) + super().__init__(ax) # tip = length of the ticks y1, y2 = sorted((y1, y2)) ax.plot([x, x], [y1, y2], "-", color=fc, lw=2) @@ -285,7 +285,7 @@ def __init__( extra (float): offset for the unit label fc (str): face color of the glyph """ - super(Gauge, self).__init__(ax) + super().__init__(ax) ax.plot([x, x], [y1, y2], "-", color=fc, lw=2) r = y2 - y1 yy = y2 diff --git a/jcvi/graphics/dotplot.py b/jcvi/graphics/dotplot.py index e761f754..90d6c2d1 100755 --- a/jcvi/graphics/dotplot.py +++ b/jcvi/graphics/dotplot.py @@ -61,7 +61,7 @@ def __init__(self, palettedict=None, palettefile=None): palettedict (Dict, optional): Get the mapping from a dict. Defaults to None. palettefile (str, optional): Get the mapping from a two-column file. Defaults to None. """ - super(Palette, self).__init__() + super().__init__() if palettedict is not None: self.update(palettedict) if palettefile is None: diff --git a/jcvi/graphics/glyph.py b/jcvi/graphics/glyph.py index dfc1accf..d6de01a1 100644 --- a/jcvi/graphics/glyph.py +++ b/jcvi/graphics/glyph.py @@ -288,7 +288,7 @@ def __init__( style (str, optional): Style, either box|arrow. Defaults to "box". """ - super(Glyph, self).__init__(ax) + super().__init__(ax) width = x2 - x1 # Frame around the gradient rectangle p1 = (x1, y - 0.5 * height) @@ -331,7 +331,7 @@ class ExonGlyph(BaseGlyph): """Multiple rectangles linked together.""" def __init__(self, ax, x, y, mrnabed, exonbeds, height=0.03, ratio=1, align="left"): - super(ExonGlyph, self).__init__(ax) + super().__init__(ax) start, end = mrnabed.start, mrnabed.end xa = lambda a: x + (a - start) * ratio xb = lambda a: x - (end - a) * ratio @@ -359,7 +359,7 @@ def __init__( shadow=False, **kwargs ): - super(GeneGlyph, self).__init__(ax) + super().__init__(ax) # Figure out the polygon vertices first orientation = 1 if x1 < x2 else -1 level = 10 diff --git a/jcvi/graphics/karyotype.py b/jcvi/graphics/karyotype.py index ae0e5726..1cbaa273 100644 --- a/jcvi/graphics/karyotype.py +++ b/jcvi/graphics/karyotype.py @@ -71,7 +71,7 @@ class Layout(AbstractLayout): def __init__( self, filename, delimiter=",", generank=False, seed: Optional[int] = None ): - super(Layout, self).__init__(filename) + super().__init__(filename) fp = open(filename) self.edges = [] for row in fp: diff --git a/jcvi/graphics/landscape.py b/jcvi/graphics/landscape.py index 146c1034..bed4567e 100644 --- a/jcvi/graphics/landscape.py +++ b/jcvi/graphics/landscape.py @@ -70,7 +70,7 @@ def subtract(self, o): class BinFile(LineFile): def __init__(self, filename): - super(BinFile, self).__init__(filename) + super().__init__(filename) self.mapping = defaultdict(list) fp = open(filename, encoding="utf-8") @@ -95,7 +95,7 @@ def __init__(self, row, delimiter=","): class ChrInfoFile(BaseFile, OrderedDict): def __init__(self, filename, delimiter=","): - super(ChrInfoFile, self).__init__(filename) + super().__init__(filename) with open(filename, encoding="utf-8") as fp: for row in fp: if row[0] == "#": @@ -116,7 +116,7 @@ def __init__(self, row, delimiter=","): class TitleInfoFile(BaseFile, OrderedDict): def __init__(self, filename, delimiter=","): - super(TitleInfoFile, self).__init__(filename) + super().__init__(filename) with open(filename, encoding="utf-8") as fp: for row in fp: if row[0] == "#": diff --git a/jcvi/graphics/synteny.py b/jcvi/graphics/synteny.py index 7f56e770..179d3560 100644 --- a/jcvi/graphics/synteny.py +++ b/jcvi/graphics/synteny.py @@ -99,7 +99,7 @@ class Layout(AbstractLayout): """ def __init__(self, filename, delimiter=",", seed: Optional[int] = None): - super(Layout, self).__init__(filename) + super().__init__(filename) fp = open(filename, encoding="utf-8") self.edges = [] for row in fp: diff --git a/jcvi/graphics/table.py b/jcvi/graphics/table.py index 4a18b597..73f9fc92 100644 --- a/jcvi/graphics/table.py +++ b/jcvi/graphics/table.py @@ -24,7 +24,7 @@ class CsvTable(list): def __init__(self, csvfile="table.csv"): - super(CsvTable, self).__init__() + super().__init__() with open(csvfile) as csvfile: reader = csv.reader(csvfile, skipinitialspace=True) self.header = [markup(x) for x in next(reader)] diff --git a/jcvi/graphics/tree.py b/jcvi/graphics/tree.py index 0c408fd5..8d96dc77 100644 --- a/jcvi/graphics/tree.py +++ b/jcvi/graphics/tree.py @@ -37,7 +37,7 @@ def __init__(self, row, delimiter=","): class LeafInfoFile(LineFile): def __init__(self, filename, delimiter=","): - super(LeafInfoFile, self).__init__(filename) + super().__init__(filename) self.cache = {} with open(filename) as fp: for row in fp: @@ -59,7 +59,7 @@ def __init__(self, row, delimiter=",", defaultcolor="#7fc97f"): class WGDInfoFile(LineFile): def __init__(self, filename, delimiter=","): - super(WGDInfoFile, self).__init__(filename) + super().__init__(filename) self.cache = defaultdict(list) with open(filename) as fp: for row in fp: diff --git a/jcvi/projects/napus.py b/jcvi/projects/napus.py index 14c7c9a5..8e767e6c 100644 --- a/jcvi/projects/napus.py +++ b/jcvi/projects/napus.py @@ -63,7 +63,7 @@ def __init__(self, row, delimiter=","): class F4ALayout(LineFile): def __init__(self, filename, delimiter=","): - super(F4ALayout, self).__init__(filename) + super().__init__(filename) fp = open(filename) self.edges = [] for row in fp: diff --git a/jcvi/projects/pineapple.py b/jcvi/projects/pineapple.py index 6c06ac5b..b092a47d 100644 --- a/jcvi/projects/pineapple.py +++ b/jcvi/projects/pineapple.py @@ -31,7 +31,7 @@ def __init__(self, line): class RegionsFile(LineFile): def __init__(self, filename): - super(RegionsFile, self).__init__(filename) + super().__init__(filename) fp = open(filename) next(fp) for row in fp: diff --git a/jcvi/utils/aws.py b/jcvi/utils/aws.py index ae3bdae8..0546df50 100644 --- a/jcvi/utils/aws.py +++ b/jcvi/utils/aws.py @@ -39,7 +39,7 @@ class InstanceSkeleton(BaseFile): def __init__(self, filename=datafile("instance.json")): - super(InstanceSkeleton, self).__init__(filename) + super().__init__(filename) self.spec = json.load(open(filename)) @property diff --git a/jcvi/utils/cbook.py b/jcvi/utils/cbook.py index a2712ffb..e11b1591 100644 --- a/jcvi/utils/cbook.py +++ b/jcvi/utils/cbook.py @@ -85,7 +85,7 @@ def wrapper(*args, **kwargs): class Registry(defaultdict): def __init__(self, *args, **kwargs): - super(Registry, self).__init__(list, *args, **kwargs) + super().__init__(list, *args, **kwargs) def iter_tag(self, tag): for key, ts in self.items(): diff --git a/jcvi/variation/delly.py b/jcvi/variation/delly.py index 71f3200d..a8f1b5e0 100644 --- a/jcvi/variation/delly.py +++ b/jcvi/variation/delly.py @@ -44,7 +44,7 @@ def bedline(self): class Delly(BaseFile): def __init__(self, filename): - super(Delly, self).__init__(filename) + super().__init__(filename) def __iter__(self): fp = must_open(self.filename) diff --git a/jcvi/variation/str.py b/jcvi/variation/str.py index b35fc65e..750df228 100644 --- a/jcvi/variation/str.py +++ b/jcvi/variation/str.py @@ -91,7 +91,7 @@ class TREDsRepo(dict): def __init__(self, ref=REF): - super(TREDsRepo, self).__init__() + super().__init__() self.ref = ref df = pd.read_csv(REPO, index_col=0) self.names = [] @@ -269,7 +269,7 @@ def fix_counts(self, subseq): class STRFile(LineFile): def __init__(self, lobstr_home, db="hg38"): filename = op.join(lobstr_home, "{0}/index.info".format(db)) - super(STRFile, self).__init__(filename) + super().__init__(filename) fp = open(filename) for row in fp: self.append(STRLine(row)) @@ -285,7 +285,7 @@ def register(self): class LobSTRvcf(dict): def __init__(self, columnidsfile="STR.ids"): - super(LobSTRvcf, self).__init__() + super().__init__() self.samplekey = None self.evidence = {} # name: (supporting reads, stutter reads) if columnidsfile: