-
Notifications
You must be signed in to change notification settings - Fork 21
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
base: develop
Are you sure you want to change the base?
Conversation
Signed-off-by: Vinayakjeet Singh Karki <[email protected]>
Tests are failing, but currently only the two caused by #231, so the testing is sufficient to proceed to a full review. |
There was a problem hiding this 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"): |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function needs docstring
#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 thegenerated_by
attribute.Changes
is_composite
Function: Determines whether an SBOL Component is a composite by checking for DNA type and assembly plan linkage.has_dna_type
andhas_assembly_plan
as helper functions to modularize the checks required for theis_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
has_dna_type
function utilizes thetyto
library to map component types to known DNA terms, ensuring that the component is of DNA type.has_assembly_plan
function searches for thegenerated_by
attribute in the component and verifies that any linked activities are marked with bothhttp://sbols.org/v3#assemblyPlan
andsbol:design
types, adhering to SEP 054 specifications.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:
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