Skip to content

[ENH] Add to_fasta method to janitor.biology - #1701

Open
naseem173 wants to merge 3 commits into
pyjanitor-devs:devfrom
naseem173:add-to-fasta-biology
Open

[ENH] Add to_fasta method to janitor.biology#1701
naseem173 wants to merge 3 commits into
pyjanitor-devs:devfrom
naseem173:add-to-fasta-biology

Conversation

@naseem173

Copy link
Copy Markdown

PR Description

Please describe the changes proposed in the pull request:

  • Add a new to_fasta convenience method to janitor.biology that writes the identifier and sequence columns of a DataFrame out to a FASTA file. This is the write-side counterpart to the existing join_fasta (which only reads a FASTA file into a DataFrame column).
  • Add a round-trip test (tests/biology/test_to_fasta.py) that writes sequences out with to_fasta and reads them back in to confirm the written FASTA file matches the source data.
  • Add a CHANGELOG.md entry under [Unreleased].

This PR resolves #646.

PR Checklist

Please ensure that you have done the following:

  1. PR in from a fork off your branch. Do not PR from <your_username>:dev, but rather from <your_username>:<feature-branch_name>.
  1. Add a line to CHANGELOG.md under the latest version header (i.e. the one that is "on deck") describing the contribution.
    • Do use some discretion here; if there are multiple PRs that are related, keep them in a single line.

Automatic checks

There will be automatic checks run on the PR. These include:

  • Building a preview of the docs on Netlify
  • Automatically linting the code
  • Making sure the code is documented
  • Making sure that all tests are passed
  • Making sure that code coverage doesn't go down.

Relevant Reviewers

Please tag maintainers to review.

Adds a to_fasta convenience method to janitor.biology that writes the identifier and sequence columns of a DataFrame out to a FASTA file (the write counterpart to the existing join_fasta). Closes pyjanitor-devs#646.
Add tests for writing sequence data to FASTA format.
Add changelog entry for the new to_fasta method in janitor.biology.
@codecov

codecov Bot commented Aug 29, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 28.57143% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.94%. Comparing base (901f4b3) to head (e031502).
⚠️ Report is 218 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #1701      +/-   ##
==========================================
- Coverage   87.56%   85.94%   -1.62%     
==========================================
  Files          95      125      +30     
  Lines        6819     9968    +3149     
==========================================
+ Hits         5971     8567    +2596     
- Misses        848     1401     +553     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

[ENH] to_fasta as part of janitor.biology

1 participant