From 40ca944f13051315c3346959bcbcec3309a68e13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gordon=20J=2E=20K=C3=B6hn?= Date: Tue, 10 Sep 2024 16:02:50 +0200 Subject: [PATCH] fixing formating black --- src/usefulgnom/serialize/total_coverage.py | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/usefulgnom/serialize/total_coverage.py b/src/usefulgnom/serialize/total_coverage.py index be999ca..ed2860a 100644 --- a/src/usefulgnom/serialize/total_coverage.py +++ b/src/usefulgnom/serialize/total_coverage.py @@ -15,29 +15,27 @@ import gzip -def load_convert_total( - coverage_path : str, - pos : list[str] - ) -> pd.DataFrame: +def load_convert_total(coverage_path: str, pos: list[str]) -> pd.DataFrame: """ Load and convert the total coverage data. """ - with gzip.open(coverage_path, 'rt') as file: - + with gzip.open(coverage_path, "rt") as file: # Use pd.read_csv to read the file - df = pd.read_csv(file, delimiter='\t', usecols=[1, 2], header=None, index_col=None)[1:] + df = pd.read_csv( + file, delimiter="\t", usecols=[1, 2], header=None, index_col=None + )[1:] - df.columns = ['pos', 'coverage'] + df.columns = ["pos", "coverage"] # extract coverage for specified position and nt # record columns for df column = [] for position in pos: - coverage = (df.loc[df['pos'] == position, 'coverage']) + coverage = df.loc[df["pos"] == position, "coverage"] column.append(coverage.iloc[0]) df_out = pd.DataFrame(column) - return df_out \ No newline at end of file + return df_out