Skip to content

Commit

Permalink
Circular import fix attempt by merging files
Browse files Browse the repository at this point in the history
  • Loading branch information
CodingBash committed Jun 14, 2024
1 parent 5bd2d1c commit f09969b
Show file tree
Hide file tree
Showing 12 changed files with 105 additions and 102 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ ENV PATH="${VENV}/bin:$PATH"

# Install from PyPI
RUN pip install --upgrade pip
RUN pip install crispr-ambiguous-mapping==0.0.151
RUN pip install crispr-ambiguous-mapping==0.0.152
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
from .editing_models import *
from .mapping_models import *
from .types import *
from .mapping_models import *
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from dataclasses import dataclass
from typing import Counter as CounterType
from typing import Tuple, Optional, DefaultDict, Dict
from .types import GeneralAlleleCountSeriesDict
from .mapping_models import GeneralAlleleCountSeriesDict
import pandas as pd

@dataclass
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,83 @@

from .error_models import GuideCountError
from .quality_control_models import QualityControlResult
from .types import GeneralMappingInferenceDict

from typing import Union, List, Mapping, Tuple, Optional, Any, DefaultDict, Dict
from typing import Counter as CounterType
import pandas as pd


# Sequence Count Result Objects
ProtospacerCounter = CounterType[str]
ProtospacerSurrogateCounter = CounterType[Tuple[str, str]]
ProtospacerBarcodeCounter = CounterType[Tuple[str, str]]
ProtospacerSurrogateBarcodeCounter = CounterType[Tuple[str, str, str]]

ProtospacerDictUMICounter = DefaultDict[str, CounterType[str]]
ProtospacerSurrogateDictUMICounter = DefaultDict[Tuple[str, str], CounterType[str]]
ProtospacerBarcodeDictUMICounter = DefaultDict[Tuple[str, str], CounterType[str]]
ProtospacerSurrogateBarcodeDictUMICounter = DefaultDict[Tuple[str, str, str], CounterType[str]]

GeneralGuideCountType = Union[ProtospacerCounter,
ProtospacerSurrogateCounter,
ProtospacerBarcodeCounter,
ProtospacerSurrogateBarcodeCounter,
ProtospacerDictUMICounter,
ProtospacerSurrogateDictUMICounter,
ProtospacerBarcodeDictUMICounter,
ProtospacerSurrogateBarcodeDictUMICounter]

# Mapping Count Dict Object

ProtospacerSurrogateBarcodeMatchCountDict = DefaultDict[Tuple[str, str, str], Union[int, float]]
ProtospacerSurrogateMatchCountDict = DefaultDict[Tuple[str, str], Union[int, float]]
ProtospacerBarcodeMatchCountDict = DefaultDict[Tuple[str, str], Union[int, float]]
ProtospacerMatchCountDict = DefaultDict[str, Union[int, float]]
GeneralMatchCountDict = Union[ProtospacerSurrogateBarcodeMatchCountDict,
ProtospacerSurrogateMatchCountDict,
ProtospacerBarcodeMatchCountDict,
ProtospacerMatchCountDict]

ProtospacerSurrogateBarcodeMismatchCountDict = DefaultDict[Tuple[Tuple[str, str, str], Tuple[str, str, str]], Union[int, float]]
ProtospacerSurrogateMismatchCountDict = DefaultDict[Tuple[Tuple[str, str], Tuple[str, str]], Union[int, float]]
ProtospacerBarcodeMismatchCountDict = DefaultDict[Tuple[Tuple[str, str], Tuple[str, str]], Union[int, float]]
ProtospacerMismatchCountDict = DefaultDict[Tuple[str, str], Union[int, float]]

GeneralMismatchCountDict = Union[ProtospacerSurrogateBarcodeMismatchCountDict,
ProtospacerSurrogateMismatchCountDict,
ProtospacerBarcodeMismatchCountDict,
ProtospacerMismatchCountDict]

# Allele nested dict Object (Key of first dict is inferred, key of second dict is observed, value of second dict is count)
ProtospacerSurrogateBarcodeAlleleDict = DefaultDict[Tuple[str, str, str], DefaultDict[Tuple[str, str, str], Union[int, float]]]
ProtospacerSurrogateAlleleDict = DefaultDict[Tuple[str, str], DefaultDict[Tuple[str, str], Union[int, float]]]
ProtospacerBarcodeAlleleDict = DefaultDict[Tuple[str, str], DefaultDict[Tuple[str, str], Union[int, float]]]
ProtospacerAlleleDict = DefaultDict[str, DefaultDict[str, Union[int, float]]]

GeneralAlleleDict = Union[ProtospacerSurrogateBarcodeAlleleDict,
ProtospacerSurrogateAlleleDict,
ProtospacerBarcodeAlleleDict,
ProtospacerAlleleDict]




# Allele Count Series Dict
ProtospacerSurrogateBarcodeAlleleCountSeriesDict = DefaultDict[Tuple[str, str, str], pd.Series]
ProtospacerSurrogateAlleleCountSeriesDict = DefaultDict[Tuple[str, str], pd.Series]
ProtospacerBarcodeAlleleCountSeriesDict = DefaultDict[Tuple[str, str], pd.Series]
ProtospacerAlleleCountSeriesDict = DefaultDict[str, pd.Series]

GeneralAlleleCountSeriesDict = Union[ProtospacerSurrogateBarcodeAlleleCountSeriesDict,
ProtospacerSurrogateAlleleCountSeriesDict,
ProtospacerBarcodeAlleleCountSeriesDict,
ProtospacerAlleleCountSeriesDict]







@dataclass
class SingleInferenceMatchResultValue:
Expand Down Expand Up @@ -52,6 +128,18 @@ class InferenceResult:
inferred_value: CompleteInferenceMatchResult


# Inference Result Object
ProtospacerSurrogateBarcodeMappingInferenceDict = DefaultDict[Tuple[str,str,str], Dict[InferenceResult]]
ProtospacerSurrogateMappingInferenceDict = DefaultDict[Tuple[str,str], Dict[InferenceResult]]
ProtospacerBarcodeMappingInferenceDict = DefaultDict[Tuple[str,str], Dict[InferenceResult]]
ProtospacerMappingInferenceDict = DefaultDict[str, Dict[InferenceResult]]

GeneralMappingInferenceDict = Union[ProtospacerSurrogateBarcodeMappingInferenceDict,
ProtospacerSurrogateMappingInferenceDict,
ProtospacerBarcodeMappingInferenceDict,
ProtospacerMappingInferenceDict]


@dataclass
class MatchSetWhitelistReporterCounterSeriesResults:
ambiguous_ignored_umi_noncollapsed_counterseries : Optional[pd.Series] = None
Expand Down Expand Up @@ -142,3 +230,11 @@ class WhitelistReporterCountsResult:
observed_guide_reporter_umi_counts_inferred: GeneralMappingInferenceDict
quality_control_result: QualityControlResult
count_input: CountInput



#
# Types
#


91 changes: 0 additions & 91 deletions crispr-ambiguous-mapping/crispr_ambiguous_mapping/models/types.py

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from typeguard import typechecked
from typing import Union, Optional, List, Tuple, DefaultDict
from typing import Counter as CounterType
from ..models.types import ProtospacerCounter, ProtospacerDictUMICounter, ProtospacerBarcodeCounter, ProtospacerBarcodeDictUMICounter, ProtospacerSurrogateCounter, ProtospacerSurrogateDictUMICounter, ProtospacerSurrogateBarcodeCounter, ProtospacerSurrogateBarcodeDictUMICounter
from ..models.mapping_models import ProtospacerCounter, ProtospacerDictUMICounter, ProtospacerBarcodeCounter, ProtospacerBarcodeDictUMICounter, ProtospacerSurrogateCounter, ProtospacerSurrogateDictUMICounter, ProtospacerSurrogateBarcodeCounter, ProtospacerSurrogateBarcodeDictUMICounter
from collections import Counter
from typing import Callable
from functools import partial
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from typeguard import typechecked
from typing import Union, List, Mapping, Tuple, Optional, Any, DefaultDict
from typing import Counter as CounterType
from ..models.types import GeneralMappingInferenceDict, GeneralMatchCountDict, GeneralMismatchCountDict

from ..models.mapping_models import GeneralMappingInferenceDict, GeneralMatchCountDict, GeneralMismatchCountDict

from collections import Counter
from collections import defaultdict
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from typing import Optional, DefaultDict, Union, Tuple, List
import pandas as pd
from typing import Counter as CounterType
from ..models.types import GeneralMappingInferenceDict, GeneralAlleleDict, GeneralAlleleCountSeriesDict
from ..models.mapping_models import GeneralMappingInferenceDict, GeneralAlleleDict, GeneralAlleleCountSeriesDict
from ..models.mapping_models import CompleteInferenceMatchResult, MatchSetSingleInferenceMatchResult, InferenceResult
from ..models.editing_models import (MatchSetWhitelistReporterObservedSequenceCounterSeriesResults,
MatchSetWhitelistReporterObservedSequenceMutationProfiles,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from . import crispr_guide_inference
from .crispr_count_processing import get_counterseries_all_results
from ..quality_control.crispr_mapping_quality_control import perform_counts_quality_control
from ..models.types import GeneralGuideCountType, GeneralMappingInferenceDict
from ..models.mapping_models import GeneralGuideCountType, GeneralMappingInferenceDict
from ..models.mapping_models import WhitelistReporterCountsResult, InferenceResult, CountInput


Expand Down
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion crispr-ambiguous-mapping/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "crispr-ambiguous-mapping"
version = "0.0.151"
version = "0.0.152"
description = ""
authors = ["Basheer Becerra <[email protected]>"]
readme = "README.md"
Expand Down

0 comments on commit f09969b

Please sign in to comment.