Repository navigation
Clusterbuster support - #1453
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1453 +/- ##
==========================================
- Coverage 85.09% 84.86% -0.23%
==========================================
Files 315 318 +3
Lines 50633 50885 +252
==========================================
+ Hits 43084 43183 +99
- Misses 7549 7702 +153
Continue to review full report at Codecov.
|
|
There was a weird merge commit at the start of your branch so I rebased this to the master, and also added your names to the |
|
You'd also accidentally checked in a bunch of compiled files, which I have fixed and updated the (Update: Fixed) |
|
Right now this is also (accidentally) removing a test from def test_meme_parser_rna(self):
"""Test if Bio.motifs can parse MEME output files using RNA."""
handle = open("motifs/meme.rna.oops.txt")
....(Update: Fixed) |
peterjc
left a comment
There was a problem hiding this comment.
I haven't finished reviewing this, but noted a few issues.
| - MEME: MEME output file motif | ||
| - MAST: MAST output file motif | ||
| - TRANSFAC: TRANSFAC database file format | ||
| - pfm_four_columns: Generic position-frequency matrix format with four columns. (cisbp, homer, hocomoco, neph, tiffin) |
There was a problem hiding this comment.
Style wise, in Bio.SeqIO etc we've used the convention format-variant with a minus sign not an underscore, and generally one word variants. How about pfm-4column or pfm-4col here or even pfm-cols? Likewise for the row-based pfm format (next line of the documentation).
In any case, looking at the code, both call the same pfm parser, so I would think just exposing a single pfm format ought to be fine and easier for the user.
There was a problem hiding this comment.
@peterjc pfm-cols and pfm-rows are fine for me. I never liked it that JASPAR uses pfm instead of pfm-jaspar. It would be nicer if at least the pfm-jaspar alias is added.
The cols and rows option is important for the parsing of the motifs.
Sometimes it could be autodetectable which one to use, but for a 4x4 motif matrix without ACGT or position annoation, this is impossible.
There was a problem hiding this comment.
Does that mean something is missing in the code to pass the row/col information to the parser?
There was a problem hiding this comment.
I missed there already was already pfm defined for JASPAR style PFM. Is this different from the 4 row / 4 col PFM?
If @mdehoon does not object, adding pfm-jaspar as an alias makes sense.
There was a problem hiding this comment.
The JASPAR style 'pfm' won't parse all of the other generic 4 row/column formats, just those from JASPAR. However, pfm-rows does handle the JASPAR style PFM, making the pfm command redundant and unnecessary really.
I'd suggest removing/deprecating the pfm command from the JASPAR module, as pfm-rows and pfm-cols will be much more flexible. If @mdehoon agrees, I will add a test or two for pfm-rows and pfm-cols as well.
There was a problem hiding this comment.
@j-andrews7 If I am not mistaken pfm-rows could also be used instead of most of the code in _read_jaspar. Only some code should be written to get the correct identifier (should be pfm name) and name (should be pfm gene or name if gene was not found) attributes:
def _read_jaspar(handle):
...
if head_match:
identifier = head_match.group(1)
if head_match.group(3):
name = head_match.group(3)
else:
name = identifier
There was a problem hiding this comment.
| @@ -0,0 +1,76 @@ | |||
| # Copyright 2015 by Gert Hulselmans. All rights reserved. | |||
| # This code is part of the Biopython distribution and governed by its | |||
There was a problem hiding this comment.
Please use the dual license header as in Bio/SeqRecord.py:
# This file is part of the Biopython distribution and governed by your
# choice of the "Biopython License Agreement" or the "BSD 3-Clause License".
# Please see the LICENSE file that should have been included as part of this
# package.| @@ -0,0 +1,97 @@ | |||
| # Copyright 2015 by Gert Hulselmans. All rights reserved. | |||
| # This code is part of the Biopython distribution and governed by its | |||
There was a problem hiding this comment.
Please use the dual license header as in Bio/SeqRecord.py:
# This file is part of the Biopython distribution and governed by your
# choice of the "Biopython License Agreement" or the "BSD 3-Clause License".
# Please see the LICENSE file that should have been included as part of this
# package.|
@j-andrews7 are you OK with how to grab my updated version of the branch, and work from that (rather than your now out of date local copy)? i.e. how to do this with Probably something like this: The safer but more round-about option (a good idea if you are still not confident with git) is to take a fresh clone of the entire repository (leaving your old copy as a backup until this is done). |
|
@peterjc Yeah, checking out is no issue - I actually use the GitHub Desktop client whenever possible because I'm terrible at remembering the commands, and it's pretty dead-simple to use. Sorry for missing so many things. I'll update whenever I get a chance today. I agree with the naming convention, I just tried to touch @ghuls original code as little as possible. |
|
New file I'd like to have existing files That and the copyright statements means three contributors, me (fine), Nader (@naderm, agreed) and Antony Lee (@anntzer via #565, agreed). So we can dual license For the second existing file you added the dual license header to: The copyright header also list Bartek Wilczynski (original file author, @barwil), and I think everyone has agreed to the dual licensing, except @zaidurrehman who I have just asked via #898 (comment) |
|
Update: That looks fine for all the contributors, so |
|
@j-andrews7 clusterbuster.py read method can also be replaced with |
|
Alright, I will change any licenses I haven't already. I'll also switch the aliases around as discussed and make the appropriate changes to @ghuls, I think I will just add support for I should have some time to make those changes later today or tonight. |
|
Okay, I have switch the Overall, I feel it definitely makes things more flexible. I added some tests, but it could probably use more. As far as I can tell, everything is more or less squared away, but it could definitely use another set of eyes. Thanks for your patience. |
|
Shouldn't I think it would be better to not set the motif weight by default for Cluster-Buster. for line in handle:
line = line.strip()
if line:
if line.startswith('>'):
if motif_nbr != 0:
motif = motifs.Motif(alphabet=IUPAC.unambiguous_dna, counts=nucleotide_counts)
motif.name = motif_name
motif.weight = motif_weight
motif.gap = motif_gap
record.append(motif)
motif_name = line[1:].strip()
motif_weight = None
motif_gap = None
nucleotide_counts = {'A': [], 'C': [], 'G': [], 'T': []}
motif_nbr += 1
...
def write(motifs):
"""Return the representation of motifs in Cluster Buster position frequency matrix format."""
lines = []
for m in motifs:
line = '>{0}\n'.format(m.name)
lines.append(line)
if m.weight is not None:
line = '# WEIGHT {0}\n'.format(m.weight)
lines.append(line)
if m.gap is not None:
line = '# GAP {0}\n'.format(m.gap)
lines.append(line) |
|
@ghuls good catch, will change that and add another test or two. The motif weight for ClusterBuster is 1.0 by default per their specifications. Is there any particular reason you don't think it should be written to output if someone is explicitly using |
|
@j-andrews7
|
|
@ghuls yeah, I guess the weight is internally assumed by ClusterBuster itself. I'll make that change as well. |
|
Docs still need to be written, but I probably won't have much time in the next week to do so. Will try to get to it as soon as I can, or someone else can hash it out and explain that most generic row or column-based multiple motif formats should have at least minimal support. |
|
@peterjc is there a guideline somewhere for contributing to the docs? Or instructions for building them? I've looked around but I feel like I'm missing it. Sorry if it's somewhere obvious. |
|
If you mean the main Tutorial, If you mean the API docs from the docstrings, currently we build them for each release using epydoc but I'm working on moving to sphinx-apidoc for that: |
|
|
||
| class Record(list): | ||
| """A Bio.motifs.xms.Record stores the information in a XMS matrix table. | ||
| The record inherits from a list containing the individual motifs. |
There was a problem hiding this comment.
That needs a blank line to separate the one-line summary from the rest of the docstring, see #1170
(We now enforce this via TravisCI/Tox)
There was a problem hiding this comment.
Fixed. I don't know if I'm going to have time to add a section to the docs about this. A line or two saying to look at the API docs for pfm.py might be a good idea, as it should provide at least basic functionality for most common formats.
|
There are still a couple of trivial docstring tweaks needed - as noted earlier we didn't enforce this when you started the pull request, so apologies for the surprise: (I don't mind fixing this myself if you've ticked the pull request option to allow edits from the Biopython maintainers) |
|
Any update on this pull request? |
|
I think it just needs a few spaces added and I haven't had time to add it.
If anybody else wants to, be my guest.
…On Tue, Apr 17, 2018, 8:34 AM Gert Hulselmans ***@***.***> wrote:
Any update on this pull request?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1453 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AJwINMtmC_N0UxAfn64saFudIf3cpwORks5tpe9fgaJpZM4Qcv1n>
.
|
|
Looking over this again with fresh eyes, I can't find an explicit agreement from Bartek Wilczynski (@barwil) to dual license his contributions (which covers a lot of the motifs code and its tests). I will email him again. |
|
I've tried emailing Bartek again, cross reference #898. |
|
@peterjc Any update on this? |
|
It needs updating for a merge conflict plus slightly stricter style checks, hang on... |
|
Rebased with flake8 cleanup & merge conflicts fixed. |
|
An unexpected test failure, I probably messed something up in the merge resolution... Leave this with me. |
All our docstrings should be written in reStructuredText now.
Also makes the long if-else switch much shorter
|
Yes, I'd made a simple merge conflict mistake - was missing a |
SeqIO etc use format-variant with an underscore.
Original authors Bartek Wilczynski (CVS username bartek, on GitHub as @barwil) and Jeff Chang (CVS username jchang, on GitHub as @jefftc) and other contributors since have agreed: - Antony Lee (@anntzer) #898 (comment) - Ariel Aptekmann (@aralap) #1734 - bartek (@barwil) http://mailman.open-bio.org/pipermail/biopython/2018-August/016533.html - Bertrand Néron (@bneron) #898 (comment) - Wibowo Arindrarto (@bow) #898 (comment) - Christian Brueffer (@cbrueffer) #898 (comment) - Gert Hulselmans (@ghuls) #898 (comment) - Jared Andrews (@j-andrews7) #898 (comment) - Jeff Chang (@jefftc) #898 (comment) - Michiel de Hoon (@mdehoon) #898 (comment) - Peter Cock (@peterjc) #898 (comment) - Zaid Ur-Rehman (@zaidurrehman) #867
Original authors Antony Lee and myself, and contributors since as recorded with git have agreed: - Antony Lee (@anntzer) #898 (comment) - Nader Morshed (@naderm) #898 (comment) - Peter Cock (@peterjc) #898 (comment)
|
@mdehoon can we go ahead with this as a rebase-and-merge? I've also done the dual licensing checks. |
|
@peterjc OK |
|
Thank you everyone - I'll just correct the placement of your names into the new release (should have spotted that earlier). |
Pull request #1453 didn't make it to Biopython 1.71, rather 1.74. [ci skip]
This pull request addresses issue #909.
This pull request contains support for additional motif formats originally written by @ghuls with a few updates and additional tests to fix a few small issues. All relevant tests and flake8 conformance pass in my environment, let me know if there are any issues.
I hereby agree to dual licence this and any previous contributions under both
the Biopython License Agreement AND the BSD 3-Clause License.
I am happy to be thanked by name in the
NEWS.rstandCONTRIB.rstfiles.I have read the
CONTRIBUTING.rstfile and understand that AppVeyor andTravisCI will be used to confirm the Biopython unit tests and
flake8stylechecks pass with these changes.