Skip to content

Replace alphabet.letters => alphabet in calculate_pseudocount - #2341

Closed
Zulko wants to merge 1 commit into
biopython:masterfrom
Zulko:patch-1
Closed

Zulko wants to merge 1 commit into
biopython:masterfrom
Zulko:patch-1

Conversation

@Zulko

@Zulko Zulko commented Nov 16, 2019 •

Copy link
Copy Markdown

It seems that everywhere else in this module the "alphabet" is not more an Alphabet instance, but rather a string like "ATGC". So calculate_pseudocounts should not use alphabet.letters. This fixes a bug breaking calculate_pseudocounts in Biopython 1.75.

This pull request addresses issue #...

  • 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, have run flake8 locally, and
    understand 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.rst and CONTRIB.rst as part of this pull request, am listed
    already, or do not wish to be listed. (This acknowledgement is optional.)

It seems that everywhere else in this module the "alphabet" is not more an Alphabet instance, but rather a string like "ATGC". So calculate_pseudocounts should not use ``alphabet.letters``. This fixes a bug breaking calculate_pseudocounts in Biopython 1.75.
@codecov

codecov Bot commented Nov 16, 2019 •

Copy link
Copy Markdown

Codecov Report

Merging #2341 into master will decrease coverage by 1.36%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2341      +/-   ##
==========================================
- Coverage   84.94%   83.57%   -1.37%     
==========================================
  Files         323      321       -2     
  Lines       52690    52353     -337     
==========================================
- Hits        44756    43753    -1003     
- Misses       7934     8600     +666
Impacted Files Coverage Δ
Bio/motifs/jaspar/__init__.py 44.29% <0%> (-0.92%) ⬇️
Bio/Phylo/CDAOIO.py 4.52% <0%> (-80.62%) ⬇️
Bio/Phylo/CDAO.py 42.85% <0%> (-57.15%) ⬇️
Bio/PopGen/GenePop/EasyController.py 22.68% <0%> (-54.64%) ⬇️
Bio/PopGen/GenePop/Controller.py 10.42% <0%> (-54.06%) ⬇️
Bio/PDB/mmtf/__init__.py 31.57% <0%> (-49.38%) ⬇️
Bio/Wise/__init__.py 50% <0%> (-30.36%) ⬇️
Bio/Phylo/Applications/_Phyml.py 71.42% <0%> (-28.58%) ⬇️
Bio/Wise/psw.py 47.36% <0%> (-22.37%) ⬇️
Bio/Graphics/__init__.py 70.83% <0%> (-12.5%) ⬇️
... and 43 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update af73d7e...23f3ebe. Read the comment docs.

@peterjc

peterjc commented Nov 18, 2019

Copy link
Copy Markdown
Member

With #2342 the flake8 issues on the master should be resolved (due to an updated plugin being stricter). Any minor change to this pull request would trigger a new build - @Zulko would you want to be acknowledged by name? If so you could add yourself to the NEWS.rst and CONTRIB.rst files.

@peterjc

peterjc commented Nov 29, 2019

Copy link
Copy Markdown
Member

I'm going to rebase this to have the tests run with the latest master branch where the flake8 issue was fixed...

@peterjc

peterjc commented Nov 29, 2019

Copy link
Copy Markdown
Member

I don't seem to be able to push - was the "allow modifications from maintainers" check box on the pull request ticked?

Also, I'd really like to see a unit test for this - as simple as calling calculate_pseudocounts

@Zulko

Zulko commented Nov 29, 2019

Copy link
Copy Markdown
Author

I won't have the time to update this branch but I'll post a minimal example test in case it helps.

@Zulko

Zulko commented Nov 29, 2019

Copy link
Copy Markdown
Author

What about this for a test?

from Bio import motifs
from Bio.Seq import Seq

def test_jaspar_pseudocounts():
    motif = motifs.create([
        Seq("ATTG"),
        Seq("ATTT"),
        Seq("ATTA"),
    ])
    
    pseudo_counts = motifs.jaspar.calculate_pseudocounts(motif)
    # pseudo_counts should be {'G': 0.433..., 'A': 0.433..., etc.}
    for nucleotide in "ATGC":
        assert abs(pseudo_counts[nucleotide] - 0.433) < 0.001

test_jaspar_pseudocounts()

@peterjc peterjc mentioned this pull request Dec 6, 2019
3 tasks done
@peterjc

peterjc commented Dec 6, 2019

Copy link
Copy Markdown
Member

Closed in favour of #2384, but thank you!

@mdehoon

mdehoon commented Dec 6, 2019

Copy link
Copy Markdown
Contributor

Closed in favour of #2384, but thank you!

Was it actually closed? It still looks open.

@Zulko Zulko closed this Dec 6, 2019
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