Repository navigation
Fast search for motifs based on calculate and chunking - #2386
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2386 +/- ##
=========================================
Coverage ? 84.92%
=========================================
Files ? 323
Lines ? 52887
Branches ? 0
=========================================
Hits ? 44914
Misses ? 7973
Partials ? 0
Continue to review full report at Codecov.
|
mdehoon
left a comment
There was a problem hiding this comment.
Looks good to me, thanks! Feel free to commit once the Travis warnings have been resolved.
|
Ummm anything I can do about travis? I am not sure what it's complaining about. Another thought, this new approach with splitting is well suited to run in parallel, would that be a good idea? |
|
You can click on |
|
Quoting travis: As Markus noted, those should all be easy enough to put right. The pull request template is meant to highlight (Related to this, we are working on adopting the black formatting tool and style, which will automate much of this - like the whitespace conventions) |
|
OK, cool, thanks! So I just ran black on this file and commited, is that ok? |
|
OK, now I don't get what the conflict is, sorry. |
|
We've been doing black incrementally, see #2008. It doesn't look to cause too much trouble as part of this pull request, but it would be easier without it. The conflict in NEWS looks down to unlucky placement of the new paragraph clashing with a paragraph added on the master branch. Let me try rebasing this... |
| A generator function, returning found hits in the given sequence | ||
| with the pwm score higher than the threshold. | ||
| """ | ||
| import numpy as np |
There was a problem hiding this comment.
@mdehoon my understanding is Bio.motifs defaults to using C code called via a numpy array, but can fall back on a pure Python no numpy alternative. If so, then the lazy import is OK.
If you regard numpy as a hard requirement of Bio.motifs then we should just have the import numpy once at top level.
There was a problem hiding this comment.
Since numpy is now a requirement of Biopython, we can remove the pure Python implementation, and have the import numpy once at top level.
There was a problem hiding this comment.
Done in the latest commit.
There was a problem hiding this comment.
We need to clarify the numpy situation, logged as #2390.
0a9188c to
44329cc
Compare
|
Rebased as squashed into a single commit which does not include running black (and introducing additional changes not relevant to the work here). The conflict was in both the news entries, and the list of contributors to the upcoming release. I have a query about the numpy import... |
|
Somehow only one of the test environments failed due to numpy, is that normal? |
|
|
||
| import math | ||
| import platform | ||
| import numpy as np |
There was a problem hiding this comment.
Continuing my query about the numpy import, style aside (#2391) can you use this please:
try:
import numpy as np
except ImportError:
from Bio import MissingPythonDependencyError
raise MissingPythonDependencyError(
"Install NumPy if you want to use Bio.motifs.matrix.")This should fix the failures on Travis on the target which deliberately does not have numpy installed. See #2390 for the background to this.
There was a problem hiding this comment.
Done.
Regarding style, I wasn't sure whether there was any specific style choice in Biopython and just went with the universally used convention...
|
This is more fiddly that I expected. The reason for this pain is the old search code would either be C code with NumPy, or a pure Python version without NumPy. As the pull request code stands, this import means effectively all of Unless we switch to just making numpy a hard requirement (#2390), we could try making the import lazy (within the |
peterjc
left a comment
There was a problem hiding this comment.
We've got to decide what to do about this numpy import and the test suite....
|
My personal opinion is that having numpy as a requirement in this day and age is completely normal, realistically no one doing any computational analysis in python can do anything useful without numpy anyway. I am happy to move the import into the search method though. |
|
If you can add your comment to #2390 that would be great, and if you want to try the lazy import for now, fingers crossed it takes care of most of the test issues. |
|
Moved the try-except import to search, hopefully this satisfies Travis. |
|
Sadly the new |
|
Right... |
|
Shall I revert the last commit then? |
|
Yes, as per discussion on #2390 please revert the lazy import commit. |
|
Not sure what's wrong with Travis now... |
|
It's pretty clear from the report. You must remove the blank line 385 (which also contains a white space) from |
|
Yes, quoting the relevant output: We encourage contributors to run |
|
Note that until #2418 is merged, it will still fail due to missing numpy |
|
Right, thanks - sorry, I was being lazy and just edited on GitHub, and so didn't check code style. |
|
I've done that myself too. Once we've applied black to the entire code base (see #2008, likely to be complete in early 2020), we can start to explore automation to update pull requests (e.g. a bot which runs black if required). That would take care of this kind of white space edit anyway 👍 |
|
Rebased to (a) clean up history a tiny bit, and (b) trigger a fresh TravisCI run with numpy installed on all targets. |
|
Thank you for your patience - this will be in today's release, Biopython 1.76 |
|
No problem, and thank you for your helping getting this in! |
Originally checked in as Bio/Motif/Matrix.py the original author Michiel de Hoon and contributors since as tracked by version control have agreed: - Adhemar Zerlotini (@azneto) biopython#1412 (comment) - Andrey Raspopov (@Andrey-Raspopov) biopython#2444 - Brian Osborne (@bosborne) biopython#898 (comment) - Carlos Pena (@carlosp420) biopython#898 (comment) - Christian Brueffer (@cbrueffer) biopython#898 (comment) - Francesco Gastaldello (@Gasta88) biopython#1063 - Ilya Flyamer (@Phlya) biopython#2386 - Matt Ruffalo (@mruffalo) biopython#898 (comment) - Michiel de Hoon (@mdehoon) biopython#898 (comment) - @morrme biopython#1172 (comment) - Nader Morshed (@naderm) biopython#898 (comment) - Peter Cock (@peterjc) biopython#898 (comment) - Sefa Kilic (@sefakilic) biopython#898 (comment) - Sergio Valqui (@svalqui) biopython#1749 - Zaid Ur-Rehman (@zaidurrehman) biopython#867
Originally checked in as Bio/Motif/Matrix.py the original author Michiel de Hoon and contributors since as tracked by version control have agreed: - Adhemar Zerlotini (@azneto) #1412 (comment) - Andrey Raspopov (@Andrey-Raspopov) #2444 - Brian Osborne (@bosborne) #898 (comment) - Carlos Pena (@carlosp420) #898 (comment) - Christian Brueffer (@cbrueffer) #898 (comment) - Francesco Gastaldello (@Gasta88) #1063 - Ilya Flyamer (@Phlya) #2386 - Matt Ruffalo (@mruffalo) #898 (comment) - Michiel de Hoon (@mdehoon) #898 (comment) - @morrme #1172 (comment) - Nader Morshed (@naderm) #898 (comment) - Peter Cock (@peterjc) #898 (comment) - Sefa Kilic (@sefakilic) #898 (comment) - Sergio Valqui (@svalqui) #1749 - Zaid Ur-Rehman (@zaidurrehman) #867
This pull request addresses issue #2360
Despite the changes in internal logic, I preserved the generator nature of this method for back-compatibility. Also I ensure that the order of returned elements is preserved, they are sorted by their absolute coordinate.
I hereby agree to dual licence this and any previous contributions under both
the Biopython License Agreement AND the BSD 3-Clause License.
I have read the
CONTRIBUTING.rstfile, have runflake8locally, andunderstand that AppVeyor and TravisCI will be used to confirm the Biopython unit
tests and style checks pass with these changes.
I have added my name to the alphabetical contributors listings in the files
NEWS.rstandCONTRIB.rstas part of this pull request, am listedalready, or do not wish to be listed. (This acknowledgement is optional.)