From 80de97dc40bed5e0bd6c3c9168e44063d1633dd5 Mon Sep 17 00:00:00 2001 From: Matthew Colpus Date: Fri, 15 Mar 2024 14:12:26 +0000 Subject: [PATCH] style: formatting --- gumpy/difference.py | 1 + gumpy/gene.py | 18 +++++++++++------- gumpy/genome.py | 2 +- gumpy/variantfile.py | 5 ++++- tests/unit/test_minor_populations.py | 1 + 5 files changed, 18 insertions(+), 9 deletions(-) diff --git a/gumpy/difference.py b/gumpy/difference.py index 79f584b..a57e40e 100644 --- a/gumpy/difference.py +++ b/gumpy/difference.py @@ -17,6 +17,7 @@ nucleotides to an array of codons. setup_codon_aa_dict() -> dict: Returns a dictionary mapping codon->amino_acid """ + import warnings from abc import ABC # Python library for abstract classes from typing import Dict, List, Tuple diff --git a/gumpy/gene.py b/gumpy/gene.py index 9e8d16a..fc9613f 100644 --- a/gumpy/gene.py +++ b/gumpy/gene.py @@ -1,6 +1,7 @@ """ Gene object """ + import copy import re @@ -13,7 +14,6 @@ # FIXME: problems with rrs, mfpB class Gene(object): - """Gene object that uses underlying numpy arrays""" def __init__( @@ -363,9 +363,11 @@ def minority_populations_GARC( # and mixed for mixed indels and SNPs c = Counter( [ - (nc_idx, "indel") - if type_ in ["ins", "del"] - else (nc_idx, type_) + ( + (nc_idx, "indel") + if type_ in ["ins", "del"] + else (nc_idx, type_) + ) for nc_idx, type_, bases, cov, frs in gene_pos_map[gene_pos] ] ) @@ -519,9 +521,11 @@ def __duplicate(self, index: int): # Check for promoters before the codons first_half = [self.nucleotide_number[i] for i in range(index)] second_half = [ - self.nucleotide_number[i] + 1 - if self.nucleotide_number[i] > 0 - else self.nucleotide_number[i] + ( + self.nucleotide_number[i] + 1 + if self.nucleotide_number[i] > 0 + else self.nucleotide_number[i] + ) for i in range(index, len(self.nucleotide_number)) ] self.nucleotide_number = numpy.array( diff --git a/gumpy/genome.py b/gumpy/genome.py index cf5ba0b..c5a1313 100644 --- a/gumpy/genome.py +++ b/gumpy/genome.py @@ -1,6 +1,7 @@ """ Genome object """ + import copy import gzip import pathlib @@ -16,7 +17,6 @@ class Genome(object): - """Genome object""" def __init__( diff --git a/gumpy/variantfile.py b/gumpy/variantfile.py index 2ed74c0..1be2cbc 100644 --- a/gumpy/variantfile.py +++ b/gumpy/variantfile.py @@ -1,6 +1,7 @@ """ Classes used to parse and store VCF data """ + import copy import pathlib import warnings @@ -523,7 +524,9 @@ def __find_calls(self): variant_type = "ref" if index in record_positions: - raise ValueError("Multiple calls at position " + str(index) + " in VCF file") + raise ValueError( + "Multiple calls at position " + str(index) + " in VCF file" + ) record_positions.add(index) # if the REF, ALT pair are the same length, check if we can decompose diff --git a/tests/unit/test_minor_populations.py b/tests/unit/test_minor_populations.py index 6df3b3f..2cc4487 100644 --- a/tests/unit/test_minor_populations.py +++ b/tests/unit/test_minor_populations.py @@ -1,5 +1,6 @@ """Tests relating to minor populations """ + import pytest import gumpy