Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

230 basic linting rule i2 #244

Merged
merged 1 commit into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions alphadia/calibration/models.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import numpy as np

from sklearn.preprocessing import PolynomialFeatures
from sklearn.base import BaseEstimator, RegressorMixin
from sklearn.preprocessing import PolynomialFeatures


class LOESSRegression(BaseEstimator, RegressorMixin):
Expand Down
15 changes: 8 additions & 7 deletions alphadia/calibration/property.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,20 @@
import logging
import pickle

# alphadia imports
from alphadia.plotting.utils import density_scatter
from alphadia.calibration.models import LOESSRegression
import numpy as np

# third party imports
import pandas as pd
import numpy as np
from matplotlib import pyplot as plt

import sklearn.base
from matplotlib import pyplot as plt
from sklearn.linear_model import LinearRegression
from sklearn.preprocessing import PolynomialFeatures
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import PolynomialFeatures

from alphadia.calibration.models import LOESSRegression

# alphadia imports
from alphadia.plotting.utils import density_scatter


class Calibration:
Expand Down
18 changes: 7 additions & 11 deletions alphadia/cli.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,21 @@
#!python

# native imports
# alpha family imports
# third party imports
import argparse
import json
import logging
import os
import re
import sys

import yaml
import os
import re
import json

# alphadia imports
import alphadia
from alphadia.workflow import reporting
from alphadia import utils


# alpha family imports

# third party imports
import argparse

from alphadia.workflow import reporting

logger = logging.getLogger()

Expand Down
1 change: 1 addition & 0 deletions alphadia/consensus/utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import logging
import os

import pandas as pd

logger = logging.getLogger()
Expand Down
24 changes: 13 additions & 11 deletions alphadia/data/alpharaw.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
# native imports
import logging
import math
import os
import logging

# alphadia imports
from alphadia import utils
import numba as nb

from alphadia.data.stats import log_stats
# third party imports
import numpy as np
import pandas as pd
from alpharaw import mzml as alpharawmzml

# TODO fix: "import resolves to its containing file"
from alpharaw import sciex as alpharawsciex

# alpha family imports
from alpharaw import (
thermo as alpharawthermo,
) # TODO fix: "import resolves to its containing file"
from alpharaw import sciex as alpharawsciex
from alpharaw import mzml as alpharawmzml
)

# third party imports
import numpy as np
import numba as nb
import pandas as pd
# alphadia imports
from alphadia import utils
from alphadia.data.stats import log_stats

logger = logging.getLogger()

Expand Down
15 changes: 8 additions & 7 deletions alphadia/data/bruker.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
# native imports
import logging
import math
import os
import logging

# alphadia imports
from alphadia import utils
from alphadia.data.stats import log_stats
import alphatims.bruker
import alphatims.tempmmap as tm

# alpha family imports
import alphatims.utils
import alphatims.bruker
import alphatims.tempmmap as tm
import numba as nb

# third party imports
import numpy as np
import numba as nb
from numba.core import types
from numba.experimental import jitclass

# alphadia imports
from alphadia import utils
from alphadia.data.stats import log_stats

logger = logging.getLogger()


Expand Down
3 changes: 2 additions & 1 deletion alphadia/data/stats.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import numpy as np
import logging

import numpy as np

logger = logging.getLogger()


Expand Down
15 changes: 7 additions & 8 deletions alphadia/fdr.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
# native imports
import os
import logging
import os

# alphadia imports

# alpha family imports
from alphadia import fragcomp
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np

# third party imports
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
import sklearn

# alphadia imports
# alpha family imports
from alphadia import fragcomp

logger = logging.getLogger()

Expand Down
6 changes: 2 additions & 4 deletions alphadia/fdrexperimental.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
# native imports
from abc import ABC, abstractmethod
import warnings
from abc import ABC, abstractmethod
from copy import deepcopy

# alphadia imports

# alpha family imports

# third party imports
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
from sklearn import model_selection
from tqdm import tqdm
from torchmetrics.classification import BinaryAUROC
from tqdm import tqdm


class Classifier(ABC):
Expand Down
13 changes: 7 additions & 6 deletions alphadia/fdrx/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,19 @@
It is flexible with regards to the features, type of classifier and type of identifications (precursors, peptides, proteins).
"""

import sklearn.base
import pandas as pd
import logging

import numpy as np
from alphadia.fragcomp import FragmentCompetition
from alphadia.fdrx.stats import get_pep, add_q_values, keep_best
import pandas as pd
import sklearn.base

from alphadia.fdrx.plotting import (
_plot_fdr_curve,
_plot_roc_curve,
_plot_score_distribution,
)

import logging
from alphadia.fdrx.stats import add_q_values, get_pep, keep_best
from alphadia.fragcomp import FragmentCompetition

logger = logging.getLogger()

Expand Down
2 changes: 1 addition & 1 deletion alphadia/fdrx/plotting.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import numpy as np
import matplotlib.pyplot as plt
import numpy as np
import sklearn.metrics


Expand Down
8 changes: 4 additions & 4 deletions alphadia/features.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# native imports

# alphadia imports
from alphadia import utils
from alphadia.numba import numeric
import numba as nb

# alpha family imports

# third party imports
import numpy as np
import numba as nb

from alphadia import utils
from alphadia.numba import numeric


@nb.njit
Expand Down
7 changes: 4 additions & 3 deletions alphadia/fragcomp.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
from alphadia import utils
from alphatims import utils as timsutils
import logging

import numba as nb
import numpy as np
import pandas as pd
from alphatims import utils as timsutils

import numba as nb
from alphadia import utils

logger = logging.getLogger(__name__)

Expand Down
3 changes: 2 additions & 1 deletion alphadia/grouping.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
# alpha family imports

# third party imports
from typing import Any

import numpy as np
import pandas as pd
from typing import Any
from numpy.typing import NDArray


Expand Down
24 changes: 11 additions & 13 deletions alphadia/libtransform.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,27 @@
# native imports
from pathlib import Path
import logging

import os
import typing
from pathlib import Path

# alphadia imports
from alphadia import utils, validate
# third party imports
import numpy as np
import pandas as pd

# alpha family imports
from alphabase.peptide import fragment
from alphabase.peptide.fragment import get_charged_frag_types
from alphabase.protein import fasta
from alphabase.spectral_library.flat import SpecLibFlat
from alphabase.protein.fasta import protease_dict
from alphabase.spectral_library.base import SpecLibBase
from alphabase.spectral_library.reader import LibraryReaderBase
from alphabase.spectral_library.decoy import decoy_lib_provider
from alphabase.peptide.fragment import get_charged_frag_types
from alphabase.protein.fasta import protease_dict

from peptdeep.protein.fasta import PredictSpecLibFasta
from alphabase.spectral_library.flat import SpecLibFlat
from alphabase.spectral_library.reader import LibraryReaderBase
from peptdeep.pretrained_models import ModelManager
from peptdeep.protein.fasta import PredictSpecLibFasta

# third party imports
import numpy as np
import pandas as pd
# alphadia imports
from alphadia import utils, validate

logger = logging.getLogger()

Expand Down
5 changes: 2 additions & 3 deletions alphadia/numba/config.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
# native imports

# alphadia imports
from alphadia.workflow import reporting

# alpha family imports

# third party imports
import numpy as np

from alphadia.workflow import reporting


class JITConfig:
"""
Expand Down
15 changes: 7 additions & 8 deletions alphadia/numba/fft.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import numpy as np
import numba as nb
import numpy as np
from numba.extending import overload
from rocket_fft import pocketfft
from rocket_fft.overloads import (
ndshape_and_axes,
zeropad_or_crop,
increase_shape,
get_fct,
decrease_shape,
get_fct,
increase_shape,
ndshape_and_axes,
resize,
zeropad_or_crop,
)
from rocket_fft import pocketfft

from numba.extending import overload


class NumbaContextOnly(Exception):
Expand Down
2 changes: 1 addition & 1 deletion alphadia/numba/fragments.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

# third party imports
import numba as nb
from numba.extending import overload_method
import numpy as np
from numba.extending import overload_method


@nb.experimental.jitclass()
Expand Down
2 changes: 1 addition & 1 deletion alphadia/numba/numeric.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
# alpha family imports

# third party imports
import numpy as np
import numba as nb
import numpy as np


@nb.njit(parallel=False, fastmath=True)
Expand Down
Loading
Loading