Skip to content

Bio.SeqIO support for reading and writing UCSC nib files - #1951

Merged
mdehoon merged 24 commits into
biopython:masterfrom
mdehoon:seqio_nib
Mar 14, 2019
Merged

mdehoon merged 24 commits into
biopython:masterfrom
mdehoon:seqio_nib

Conversation

@mdehoon

@mdehoon mdehoon commented Mar 6, 2019

Copy link
Copy Markdown
Contributor

This pull request adds support in Bio.SeqIO for reading and writing DNA sequence files in UCSC's nib file format. This is a binary file format; probably reading and writing could be much faster if this were implemented in C, but Python is good enough for now.

  • 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.)

@mdehoon
mdehoon requested a review from peterjc as a code owner March 6, 2019 05:07
@MarkusPiotrowski

Copy link
Copy Markdown
Contributor

@mdehoon Ever thought about installing flake8 and integrating it into your local git? ;-)

https://flake8.pycqa.org/en/latest/user/using-hooks.html

@mdehoon

mdehoon commented Mar 6, 2019

Copy link
Copy Markdown
Contributor Author

The remaining error is surprising - this does not seem related to this pull request, unless I broke test_SeqIO_write.py somehow.

@peterjc

peterjc commented Mar 7, 2019

Copy link
Copy Markdown
Member

Can you add a test *.nib file (for which you may need to tell git to tag it as binary), or explicitly check the binary format on disk?

@peterjc

peterjc commented Mar 7, 2019

Copy link
Copy Markdown
Member

For automating pep8, see #493 for a script which takes into account that we still have per-top-level folder flake8 configurations.

@peterjc

peterjc commented Mar 7, 2019

Copy link
Copy Markdown
Member

The write test is failing because this format seems not to store any annotation at all, not even a sequence ID or name. You will need to special case the SeqIO write test accordingly.

@codecov

codecov Bot commented Mar 7, 2019

Copy link
Copy Markdown

Codecov Report

Merging #1951 into master will decrease coverage by 2.83%.
The diff coverage is 73.91%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1951      +/-   ##
==========================================
- Coverage   85.03%   82.19%   -2.84%     
==========================================
  Files         310      266      -44     
  Lines       49960    44914    -5046     
==========================================
- Hits        42481    36918    -5563     
- Misses       7479     7996     +517
Impacted Files Coverage Δ
Bio/SeqIO/__init__.py 83.42% <100%> (-1.02%) ⬇️
Bio/SeqIO/NibIO.py 73.33% <73.33%> (ø)
Bio/PDB/PDBParser.py 4.51% <0%> (-85.32%) ⬇️
Bio/PDB/__init__.py 8.33% <0%> (-83.34%) ⬇️
Bio/SeqIO/PdbIO.py 12.5% <0%> (-81.95%) ⬇️
Bio/Cluster/__init__.py 1.7% <0%> (-81.22%) ⬇️
Bio/codonalign/codonalignment.py 26.56% <0%> (-60.16%) ⬇️
Bio/codonalign/codonseq.py 43.96% <0%> (-43.57%) ⬇️
Bio/Phylo/_utils.py 21.72% <0%> (-43.45%) ⬇️
Bio/SubsMat/FreqTable.py 56.41% <0%> (-41.03%) ⬇️
... and 91 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 6543091...8ccbd88. Read the comment docs.

@codecov

codecov Bot commented Mar 7, 2019 •

Copy link
Copy Markdown

Codecov Report

Merging #1951 into master will increase coverage by 0.01%.
The diff coverage is 91.57%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1951      +/-   ##
==========================================
+ Coverage   85.03%   85.04%   +0.01%     
==========================================
  Files         310      311       +1     
  Lines       49960    50055      +95     
==========================================
+ Hits        42481    42568      +87     
- Misses       7479     7487       +8
Impacted Files Coverage Δ
Bio/SeqIO/__init__.py 84.53% <100%> (+0.08%) ⬆️
Bio/SeqIO/NibIO.py 91.3% <91.3%> (ø)
Bio/Statistics/__init__.py 100% <0%> (ø) ⬆️

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 6543091...b5e0daf. Read the comment docs.

@peterjc

peterjc commented Mar 7, 2019

Copy link
Copy Markdown
Member

Need to update the legacy style print-and-compare output:

$ python run_tests.py -g test_SeqIO

Comment thread Bio/SeqIO/__init__.py Outdated
"fastq-illumina": QualityIO.FastqIlluminaIterator,
"qual": QualityIO.QualPhredIterator,
"sff": SffIO.SffIterator,
"nib": NibIO.NibIterator,

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 should be a couple of lines higher up (alphabetical), not in the middle of the two SFF entries.

Comment thread Bio/SeqIO/__init__.py Outdated
"phd": PhdIO.PhdWriter,
"qual": QualityIO.QualPhredWriter,
"sff": SffIO.SffWriter,
"nib": NibIO.NibWriter,

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 should be a couple of lines higher up (alphabetical), you could fix the pir entry too at the same time?

@peterjc

peterjc commented Mar 7, 2019

Copy link
Copy Markdown
Member

You also need to add nib to the module docstring listing of supported formats under:

File Formats

And separately, once this is merged, we'll need to add it to the table on https://github.com/biopython/biopython.github.io/blob/master/wiki/SeqIO.md too for the website.

@peterjc

peterjc commented Mar 8, 2019

Copy link
Copy Markdown
Member

So just the tests under Python 2 to fix, otherwise looks good 👍

@mdehoon
mdehoon merged commit 235626d into biopython:master Mar 14, 2019
@mdehoon
mdehoon deleted the seqio_nib branch March 14, 2019 08:41
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