Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Composite Check Functionality to SBOL Utilities #238

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

vinayakjeet
Copy link

#69

Overview

This PR introduces a new helper function, is_composite, to the SBOL Utilities package, addressing the need for an efficient way to determine if an SBOL Component is a composite. This functionality was proposed to tackle issue #69, focusing on components that are of DNA type and linked to an assembly plan via the generated_by attribute.

Changes

  • is_composite Function: Determines whether an SBOL Component is a composite by checking for DNA type and assembly plan linkage.
  • Supporting Functions: Added has_dna_type and has_assembly_plan as helper functions to modularize the checks required for the is_composite function.

Justification

The need for a composite check function was identified as a part of enhancing the SBOL utilities package to support more nuanced checks for components within SBOL documents. The ability to identify composite components efficiently is crucial for developers working with synthetic biology data, facilitating more sophisticated data analysis and manipulation tasks.

Implementation Details

  • The has_dna_type function utilizes the tyto library to map component types to known DNA terms, ensuring that the component is of DNA type.
  • The has_assembly_plan function searches for the generated_by attribute in the component and verifies that any linked activities are marked with both http://sbols.org/v3#assemblyPlan and sbol:design types, adhering to SEP 054 specifications.
  • The is_composite function integrates these checks, offering a straightforward way to determine if a component meets the criteria for being considered a composite.

Future Work

While this PR addresses the immediate need for composite component identification, future enhancements could include:

  • Expanding the criteria for what constitutes a composite component based on evolving standards.
  • Optimizing performance for large SBOL documents through more efficient data structures or caching mechanisms.

Acknowledgements

Special thanks to contributors and reviewers who have offered insights and feedback throughout the development of this feature, especially those involved in the discussion of issue #69.

closes #69

Signed-off-by: Vinayakjeet Singh Karki <[email protected]>
@jakebeal
Copy link
Contributor

jakebeal commented Apr 7, 2024

Tests are failing, but currently only the two caused by #231, so the testing is sufficient to proceed to a full review.

Copy link
Contributor

@jakebeal jakebeal left a comment

Choose a reason for hiding this comment

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

A few minor adjustments are needed.
More importantly, a test needs to be added that will validate that this function behaves as expected.


def has_assembly_plan(o):
if not hasattr(o, "generated_by"):
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this should be necessary, because every Component has a generated_by attribute, even if it is empty.

for activity_ref in o.generated_by:
activity = activity_ref.lookup()
if activity and 'http://sbols.org/v3#assemblyPlan' in activity.types and 'sbol:design' in activity.types:
Copy link
Contributor

Choose a reason for hiding this comment

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

Please change 'sbol:design' to the SBOL_DESIGN constant.


def is_composite(obj):
def has_dna_type(o):
Copy link
Contributor

Choose a reason for hiding this comment

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

Function needs docstring

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

Successfully merging this pull request may close these issues.

Function to check if a part is a composite
2 participants