Skip to content

Commit

Permalink
Merge branch 'release/1.3.0' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
keiranmraine committed Nov 16, 2021
2 parents aecf8e8 + bb9b315 commit 578ea02
Show file tree
Hide file tree
Showing 11 changed files with 214 additions and 128 deletions.
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# CHANGES

## 1.3.0

- dual-guide: added library header item to deal with reversed read order when comparing against sgRNA.
- dual-guide: handled data multiplication issue in CRAM outputs, quicker.

## 1.2.1

Handle change to how bgzip data is reported by magic decode.
Expand Down
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ ENV VIRTUAL_ENV=$OPT/venv
RUN python3.9 -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"

RUN pip install --no-cache-dir --upgrade pip==21.3.1 && pip install --no-cache-dir Cython==0.29.24

COPY pycroquet/ pycroquet/
COPY README.md setup.py requirements.txt requirements-dev.txt ./
RUN pip install --no-cache-dir -r requirements-dev.txt
Expand Down
14 changes: 12 additions & 2 deletions pycroquet/classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ class LibraryHeader:
config: dict
info_items: dict = None
is_single: bool = False
reverse_read_order: bool = False


@dataclass
Expand All @@ -96,6 +97,12 @@ class Guide:
other: dict[str, str] = field(default_factory=dict)
unique: bool = True
count: int = 0
_composite_sgrna_seq = None

def composite_sgrna_seq(self) -> str:
if self._composite_sgrna_seq is None:
self._composite_sgrna_seq = "|".join(self.sgrna_seqs)
return self._composite_sgrna_seq


@dataclass
Expand Down Expand Up @@ -137,12 +144,15 @@ def sgrna_ids_by_seq(self, target_seq):
self._sgrna_ids_by_seq = sgrna_ids_by_seq
return self._sgrna_ids_by_seq[target_seq]

def guide_by_sgrna_set(self, seq_l, seq_r):
def guide_by_sgrna_set(self, seq_l, seq_r) -> List[int]:
match = f"{seq_l}|{seq_r}"
if self._guide_by_sgrna_set is None:
data = {}
for i, g in enumerate(self.guides):
data["|".join(g.sgrna_seqs)] = i
composite_guide = g.composite_sgrna_seq()
if composite_guide not in data:
data[composite_guide] = []
data[composite_guide].append(i)
self._guide_by_sgrna_set = data
return self._guide_by_sgrna_set.get(match)

Expand Down
Loading

0 comments on commit 578ea02

Please sign in to comment.