Skip to content

pdbx get_sequence return dict of seq#611

Merged
padix-key merged 10 commits intobiotite-dev:masterfrom
tjmier:get_sequence_by_chainid
Jun 28, 2024
Merged

pdbx get_sequence return dict of seq#611
padix-key merged 10 commits intobiotite-dev:masterfrom
tjmier:get_sequence_by_chainid

Conversation

@tjmier
Copy link
Copy Markdown
Contributor

@tjmier tjmier commented Jun 24, 2024

Accidentally deleted my last pull request on this topic.

Purpose:
Modified biotite.structure.io.pdbx.get_sequence to return a dictionary of sequences instead of a list. This change provides a more intuitive way to access sequences by their chain identifiers.

Details:
Old Behavior: Returned a list of sequences.
New Behavior: Returns a dictionary where keys are derived from entity_poly.pdbx_strand_id (often equivalent to chain_id and atom_site.auth_asym_id in most cases). Dictionary values are the corresponding sequences.

Example Usage:

seq_dict = get_sequences(my_cif)
chain_A_seq = seq_dict["A"]

Rationale:
The change in return type improves the usability of the function by allowing direct access to sequences using chain identifiers, which is a common use case.

Impact:
This change is non-backwards compatible. Code that relies on the previous list-based return type will need to be updated.
Tests and examples have been updated to reflect this change in return type.

@padix-key
Copy link
Copy Markdown
Member

For reference: This is the continuation of #600

@padix-key padix-key self-requested a review June 25, 2024 07:38
@padix-key
Copy link
Copy Markdown
Member

Looks good to me. I will keep this PR open until patch version 0.41.2 was released (due to #605), which should arrive in the upcoming days.

@padix-key padix-key merged commit 2331695 into biotite-dev:master Jun 28, 2024
@tjmier
Copy link
Copy Markdown
Contributor Author

tjmier commented Jul 2, 2024

Excellent! Thank you for your patience. I learned a lot despite this being such a small change.

@tjmier tjmier deleted the get_sequence_by_chainid branch July 2, 2024 20:18
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.

2 participants