Skip to content

Commit

Permalink
linting input
Browse files Browse the repository at this point in the history
  • Loading branch information
Mittmich committed Oct 7, 2023
1 parent 8968c15 commit 6787fb8
Show file tree
Hide file tree
Showing 12 changed files with 110 additions and 850 deletions.
4 changes: 2 additions & 2 deletions spoc/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def _load_pixel_metadata(path: str):
"""Load metadata"""
metadata_path = Path(path) / "metadata.json"
if metadata_path.exists():
with open(metadata_path, "r", encoding='UTF-8') as f:
with open(metadata_path, "r", encoding="UTF-8") as f:
metadata = json.load(f)
else:
raise ValueError(f"Metadata file not found at {metadata_path}")
Expand Down Expand Up @@ -192,5 +192,5 @@ def write_pixels(self, path: str, pixels: Pixels) -> None:
pixels.data.to_parquet(write_path, row_group_size=1024 * 1024)
# write metadata
current_metadata[write_path.name] = pixels.get_global_parameters().dict()
with open(metadata_path, "w", encoding='UTF-8') as f:
with open(metadata_path, "w", encoding="UTF-8") as f:
json.dump(current_metadata, f)
2 changes: 1 addition & 1 deletion spoc/pixels.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def from_uri(uri, mode="path"):
Mode can be one of pandas|dask|path, which corresponds to the type of the pixel source.
"""
# import here to avoid circular imports
#pylint: disable=import-outside-toplevel
# pylint: disable=import-outside-toplevel
from spoc.io import FileManager

# Define uri parameters
Expand Down
2 changes: 0 additions & 2 deletions spoc/snipping/__init__.py

This file was deleted.

23 changes: 0 additions & 23 deletions spoc/snipping/snipper.py

This file was deleted.

240 changes: 0 additions & 240 deletions spoc/snipping/snipping_strategies.py

This file was deleted.

15 changes: 10 additions & 5 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
"""Tests for CLI of spoc"""
# pylint: disable=redefined-outer-name

import shutil
import os
import pytest
import pandas as pd
from pandas.testing import assert_frame_equal
import numpy as np
import shutil
import os
from click.testing import CliRunner

from spoc import cli, dataframe_models
Expand All @@ -23,6 +24,7 @@ def _create_tmp_dir():

@pytest.fixture
def good_annotated_porec_file():
"""Fixture for a good porec file with annotations"""
# setup
_create_tmp_dir()
yield "tests/test_files/good_porec.lab.parquet"
Expand All @@ -32,11 +34,13 @@ def good_annotated_porec_file():

@pytest.fixture
def label_library_path():
"""Fixture for a label library file"""
return "tests/test_files/ll1.pickle"


@pytest.fixture
def good_triplet_files():
"""Fixture for two triplet contact files used to merge contacts"""
# setup
_create_tmp_dir()
yield [
Expand All @@ -49,6 +53,7 @@ def good_triplet_files():

@pytest.fixture
def good_triplet_file_for_pixels():
"""Fixture for a good triplet file used to instantiate pixels"""
# setup
_create_tmp_dir()
yield "tests/test_files/good_contacts3.triplets.parquet"
Expand All @@ -58,6 +63,7 @@ def good_triplet_file_for_pixels():

@pytest.fixture
def good_porec_file():
"""Fixture for a good fragment file"""
# setup
_create_tmp_dir()
yield "tests/test_files/good_porec.parquet"
Expand All @@ -67,6 +73,7 @@ def good_porec_file():

@pytest.fixture
def expected_pixels():
"""Fixture for expected pixels from binning contacts"""
return pd.DataFrame(
{
"chrom_1": ["chr1"] * 3,
Expand Down Expand Up @@ -144,9 +151,7 @@ def test_bin_contacts(good_triplet_file_for_pixels, expected_pixels):
"""happy path for binning contacts without sister sorting"""
runner = CliRunner()
output_path = "tmp/test_output5.parquet"
result = runner.invoke(
cli.bin_contacts, [good_triplet_file_for_pixels, output_path]
)
runner.invoke(cli.bin_contacts, [good_triplet_file_for_pixels, output_path])
# check content of file
pixels = pd.read_parquet(output_path)
np.array_equal(pixels.values, expected_pixels.values)
Loading

0 comments on commit 6787fb8

Please sign in to comment.