Skip to content

Cope with missing training set in MEME - #1958

Open
jclachance wants to merge 8 commits into
biopython:masterfrom
jclachance:master
Open

jclachance wants to merge 8 commits into
biopython:masterfrom
jclachance:master

Conversation

@jclachance

@jclachance jclachance commented Mar 14, 2019 •

Copy link
Copy Markdown

This pull request addresses issue #1871

  • 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.rst file and understand that AppVeyor and
    TravisCI will be used to confirm the Biopython unit tests and flake8 style
    checks pass with these changes.

  • I have added my name to the alphabetical contributors listings in the files
    NEWS.rst and CONTRIB.rst as part of this pull request, am listed
    already, or do not wish to be listed. (This acknowledgement is optional.)

Update the MEME motifs output parser to make it compatible with MEME version 5.0.4 (Release date: Wed Jan 23 14:05:40 2019 -0800).
@jclachance
jclachance requested a review from mdehoon as a code owner March 14, 2019 22:34
@peterjc peterjc changed the title Fixing Issue#1871 Cope with missing training set in MEME Mar 14, 2019
Comment thread Bio/motifs/meme.py Outdated


def __read_version(record, handle):
#This function still works

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't seem like a useful comment line to add.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also in terms of the automatically enforced coding style (using flake8), this should be hash then space:

Bio/motifs/meme.py:131:5: E265 block comment should start with '# '

But please just remove the comment line completely.

Comment thread Bio/motifs/meme.py Outdated
raise ValueError("Unexpected end of stream: Expected to find line starting with 'DATAFILE'")
if not line.startswith('DATAFILE'):
raise ValueError("Line does not start with 'DATAFILE':\n%s" % line)
if not line.startswith('PRIMARY SEQUENCES'):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The automated tests haven't finished yet, but by eye this looks like it will now break on old files which have DATAFILE here?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does indeed break on the old MEME files in our tests. This change needs to handle both old and new smoothly.

Comment thread Bio/motifs/meme.py Outdated
record.control_seq = line


Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style issue - you need to remove the trailing white space here. This will fail our automated flake8 checks, have a look at this if you're not familiar with this tool:

https://github.com/biopython/biopython/blob/master/CONTRIBUTING.rst

@peterjc

peterjc commented Mar 14, 2019

Copy link
Copy Markdown
Member

The automated style test failed:

$ flake8 Bio/
Bio/motifs/meme.py:16:1: D205 1 blank line required between summary line and description
Bio/motifs/meme.py:16:1: D413 Missing blank line after last section
Bio/motifs/meme.py:63:1: D205 1 blank line required between summary line and description
Bio/motifs/meme.py:92:1: D205 1 blank line required between summary line and description
Bio/motifs/meme.py:131:5: E265 block comment should start with '# '
Bio/motifs/meme.py:165:1: W293 blank line contains whitespace
Bio/motifs/meme.py:176:1: W293 blank line contains whitespace

Part of this is you've removed some important blank lines in the docstrings, have a look at PEP257 if the flake8 messages are unclear:

https://www.python.org/dev/peps/pep-0257/

I'm expecting the automated code tests to fail too, as you've changed the doctests which refered to a real example file (relative to the Tests/ folder),

https://github.com/biopython/biopython/blob/master/Tests/motifs/meme.out

There's a chapter on the test framework in our tutorial for more background:

http://biopython.org/DIST/docs/tutorial/Tutorial.html

@jclachance

jclachance commented Mar 14, 2019 via email

Copy link
Copy Markdown
Author

@peterjc

peterjc commented Mar 14, 2019

Copy link
Copy Markdown
Member

Great - and if you have suggestions for how we can make explaining this easier for future first time contributors, that' be welcome too.

@peterjc

peterjc commented Mar 16, 2019

Copy link
Copy Markdown
Member

Minor problem:

$ flake8 Bio/
Bio/motifs/meme.py:32:52: E231 missing whitespace after ','
Bio/motifs/meme.py:33:52: E231 missing whitespace after ','

Bigger problem, you've added an external dependency - which we try hard to avoid:

ImportError: No module named packaging

For this all you need to do is an integer comparison of the major version number. However, would it not have been simpler to make the parser cope with either data block dynamically (without the version check)?

CC @mdehoon

@peterjc

peterjc commented Mar 18, 2019

Copy link
Copy Markdown
Member
$ flake8 Tests/
Tests/zz_test_motifs_jcl.py:12:1: E302 expected 2 blank lines, found 1
Tests/zz_test_motifs_jcl.py:14:1: W191 indentation contains tabs
Tests/zz_test_motifs_jcl.py:14:2: E117 over-indented
Tests/zz_test_motifs_jcl.py:15:1: W191 indentation contains tabs
Tests/zz_test_motifs_jcl.py:15:3: E117 over-indented
Tests/zz_test_motifs_jcl.py:16:1: W191 indentation contains tabs
...

I suspect you checked in that file by mistake? If you do want to include it, please rename it to start "test_*.py" otherwise the test suite will not automatically include it.

@peterjc

peterjc commented Mar 25, 2019

Copy link
Copy Markdown
Member

There is an easily fixed merge conflict in the news file now, which I could deal with - but what did you want to do with Tests/zz_test_motifs_jcl.py?

@peterjc

peterjc commented Nov 11, 2022 •

Copy link
Copy Markdown
Member

Are the names in the right places in the NEWS file? Seem to be some jumping between releases

@peterjc peterjc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was file Tests/zz_test_motifs_jcl.py meant to be checked in? It is failing the black style test which caught my eye, but it does not follow the naming pattern to be run as a test either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants