Skip to content

Commit

Permalink
Fix in_memory and return i bug
Browse files Browse the repository at this point in the history
  • Loading branch information
eachanjohnson committed Mar 23, 2024
1 parent 01155a1 commit 6f0d845
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions crispio/map.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,6 @@ def __len__(self):
def _from_search(guide_seq: str,
genome: str,
pam_search: str = "NGG") -> Iterable[Tuple[int, Dict[str, GuideMatch]]]:

if (guide_seq not in genome and
reverse_complement(guide_seq) not in genome):
raise ValueError(f'{guide_seq} not in genome')

pam_len = len(pam_search)

Expand Down Expand Up @@ -174,8 +170,6 @@ def _from_search(guide_seq: str,

yield gm

return i

@classmethod
def from_search(cls,
guide_seq: str,
Expand Down Expand Up @@ -225,6 +219,9 @@ def from_search(cls,
"""

if guide_seq not in genome and reverse_complement(guide_seq) not in genome:
raise ValueError(f'{guide_seq} not in genome')

matches = cls._from_search(guide_seq, genome, pam_search)

if in_memory:
Expand Down Expand Up @@ -376,8 +373,7 @@ def _from_mapping(guide_seq: Iterable[FastaSequence],
guide_matches = GuideMatchCollection.from_search(guide_seq=guide_sequence.sequence,
guide_name=guide_sequence.name,
pam_search=pam_search,
genome=genome,
in_memory=True) ## forces the ValueError to be raised now
genome=genome)
except ValueError:
not_found[guide_sequence.name] = guide_sequence.sequence
else:
Expand Down

0 comments on commit 6f0d845

Please sign in to comment.