-
Notifications
You must be signed in to change notification settings - Fork 171
deprecation prep #1399
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
base: main
Are you sure you want to change the base?
deprecation prep #1399
Changes from all commits
736da67
1b1732a
08468b7
34aa0f7
66decac
8f163f3
d2be9de
74256a0
dee7bdc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -154,8 +154,16 @@ def __getitem__(self, index): | |
| if isinstance(rows, list): | ||
| rows = self.getIndex(rows) or rows | ||
| elif isinstance(rows, int): | ||
| return Sequence(self._msa[rows, cols].tobytes(), | ||
| self._labels[rows]) | ||
| if PY3K: | ||
| try: | ||
| return Sequence(self._msa[rows, cols].tostring().decode(), | ||
| self._labels[rows]) | ||
| except: | ||
| return Sequence(self._msa[rows, cols].tobytes().decode(), | ||
| self._labels[rows]) | ||
| else: | ||
| return Sequence(self._msa[rows, cols].tostring(), | ||
| self._labels[rows]) | ||
| elif isinstance(rows, str): | ||
| try: | ||
| rows = self._mapping[rows] | ||
|
|
@@ -164,8 +172,12 @@ def __getitem__(self, index): | |
| .format(index)) | ||
| else: | ||
| if isinstance(rows, int): | ||
| return Sequence(self._msa[rows, cols].tobytes(), | ||
| self._labels[rows]) | ||
| try: | ||
| return Sequence(self._msa[rows, cols].tostring(), | ||
| self._labels[rows]) | ||
| except: | ||
| return Sequence(self._msa[rows, cols].tobytes(), | ||
| self._labels[rows]) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same issue with these lines. Maybe use
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We have the following block in the Sequence object, on which we could maybe base these:
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've now tried this |
||
|
|
||
| if cols is None: | ||
| msa = self._msa[rows] | ||
|
|
@@ -546,7 +558,16 @@ def refineMSA(msa, index=None, label=None, rowocc=None, seqid=None, colocc=None, | |
| from prody.utilities import GAP_PENALTY, GAP_EXT_PENALTY, ALIGNMENT_METHOD | ||
|
|
||
| chseq = chain.getSequence() | ||
| algn = alignBioPairwise(pystr(arr[index].tobytes().upper()), pystr(chseq), | ||
|
|
||
| if PY3K: | ||
| try: | ||
| arr2 = arr[index].tostring().decode() | ||
| except: | ||
| arr2 = arr[index].tobytes().decode() | ||
| else: | ||
| arr2 = arr[index].tostring() | ||
|
|
||
| algn = alignBioPairwise(pystr(arr2.upper()), pystr(chseq), | ||
| "local", | ||
| MATCH_SCORE, MISMATCH_SCORE, | ||
| GAP_PENALTY, GAP_EXT_PENALTY, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These fixes might be too ad-hoc. There should be a better way to determine which function to use. In addition, it is better the catch the specific error than a general "except"