Skip to content

Commit

Permalink
Fixes FindSpanin
Browse files Browse the repository at this point in the history
* Package sync for requirements
  * Drop parser (not used)
* re-implement regex in cpt.py

[#15]
  • Loading branch information
curtisim0 committed Sep 20, 2024
1 parent 471832a commit 25fff8b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
5 changes: 3 additions & 2 deletions cpt_find_spanins/cpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from Bio import SeqIO
from Bio.Data import CodonTable
import logging
import regex as re

logging.basicConfig()
log = logging.getLogger()
Expand Down Expand Up @@ -147,7 +148,7 @@ def break_up_frame(self, s):
if index % 3 != 0:
continue
n = s[start:index]
for (offset, n, t) in self.start_chop_and_trans(n):
for offset, n, t in self.start_chop_and_trans(n):
if n and len(t) >= self.min_len:
yield start + offset, n, t
start = index
Expand Down Expand Up @@ -294,7 +295,7 @@ def break_up_frame(self, s):
if index % 3 != 0:
continue
n = s[start:index]
for (offset, n, t) in self.start_chop_and_trans(n):
for offset, n, t in self.start_chop_and_trans(n):
if n and len(t) >= self.min_len:
yield start + offset, n, t
start = index
Expand Down
5 changes: 1 addition & 4 deletions cpt_find_spanins/findSpanin.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,12 @@
######### Much of this code is very "blocked", in the sense that one thing happens...then a function happens on the return...then another function...etc...etc...

import argparse
import os
import re # new
import itertools # new
from collections import Counter, OrderedDict
from collections import Counter
from spaninFuncs import (
getDescriptions,
grabLocs,
spaninProximity,
splitStrands,
tuple_fasta,
lineWrapper,
)
Expand Down
7 changes: 5 additions & 2 deletions cpt_find_spanins/findSpanin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@
<import>macros.xml</import>

</macros>
<expand macro="requirements">
</expand>
<requirements>
<requirement type="package" version="3.9">python</requirement>
<requirement type="package" version="1.84">biopython</requirement>
<requirement type="package" version="2024.9.11">regex</requirement>
</requirements>
<command detect_errors="aggressive"><![CDATA[
python '$__tool_directory__/findSpanin.py'
'$putative_isp_fasta_file'
Expand Down
6 changes: 3 additions & 3 deletions cpt_find_spanins/spaninFuncs.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

import re
from Bio import SeqIO
from Bio import Seq
from collections import OrderedDict

# Not written in OOP for a LITTLE bit of trying to keep the complication down in case adjustments are needed by someone else.
# Much of the manipulation is string based; so it should be straightforward as well as moderately quick
Expand Down Expand Up @@ -519,7 +517,9 @@ def check_for_usp():
# try:
try:
lipo += find_lipobox(pair=each_pair, regex=2) # , minimum=8)
except TypeError: # catches if something doesnt have the min/max requirements (something is too small)
except (
TypeError
): # catches if something doesnt have the min/max requirements (something is too small)
continue
# except:
# continue
Expand Down

0 comments on commit 25fff8b

Please sign in to comment.