Skip to content

Commit

Permalink
Updated to version 1.5.2 with additional download of sequences when d…
Browse files Browse the repository at this point in the history
…ownloading components from SynBioHub.
  • Loading branch information
nroehner committed Oct 22, 2021
1 parent 4daa7d9 commit 7911f44
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 5 deletions.
2 changes: 1 addition & 1 deletion features_to_circuits/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# See https://www.python.org/dev/peps/pep-0440/ for info on version numbering
__version__ = '1.5.1'
__version__ = '1.5.2'

from features_to_circuits.features_to_circuits import *
2 changes: 1 addition & 1 deletion sequences_to_features/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# See https://www.python.org/dev/peps/pep-0440/ for info on version numbering
__version__ = '1.5.1'
__version__ = '1.5.2'

from sequences_to_features.sequences_to_features import *
30 changes: 29 additions & 1 deletion sequences_to_features/sequences_to_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,8 @@ class FeatureLibrary():
def __init__(self, docs, require_sequence=True):
self.features = []
self.docs = docs
self.__updated_indices = set()

self.__updated_indices = set()
self.__feature_map = {}
self.__feature_dict = {}
self.__name_to_idents = {}
Expand Down Expand Up @@ -1513,6 +1513,28 @@ def curate(feature_library, target_library, output_library, output_files, extend

target_library.docs[i].write(output_files[i])

def download_sequences(doc, synbiohub):
for comp_definition in doc.componentDefinitions:
for seq_URI in comp_definition.sequences:
download_sequence = False

try:
doc.getSequence(seq_URI)
except RuntimeError:
download_sequence = True
except NotFoundError as exc:
if is_sbol_not_found(exc):
download_sequence = True

if download_sequence:
try:
synbiohub.pull(seq_URI, doc)
except NotFoundError as exc:
if is_sbol_not_found(exc):
logger.warning('Unable to download sequence %s, seq_URI)')
else:
raise

def main(args=None):
if args is None:
args = sys.argv[1:]
Expand Down Expand Up @@ -1666,6 +1688,8 @@ def main(args=None):
try:
synbiohub.pull(feature_URL, feature_doc)

download_sequences(feature_doc, synbiohub)

feature_docs.append(feature_doc)
except NotFoundError as exc:
if is_sbol_not_found(exc):
Expand All @@ -1688,6 +1712,8 @@ def main(args=None):
try:
synbiohub.pull(target_URL, target_doc)

download_sequences(target_doc, synbiohub)

target_docs.append(target_doc)
except NotFoundError as exc:
target_docs.append(None)
Expand Down Expand Up @@ -1741,6 +1767,8 @@ def main(args=None):
target_doc = sbol2.Document()

synbiohub.pull(target_URL, target_doc)

download_sequences(target_doc, synbiohub)
except NotFoundError as exc:
if is_sbol_not_found(exc):
logger.warning('Unable to find target URL %s at %s', target_URL, sbh_URL)
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@

setup(
name='SYNBICT',
version='1.5.1',
version='1.5.2',
description='Synthetic Biology Curation Tools (SYNBICT)',
long_description='Synthetic Biology Curation Tools (SYNBICT) is a Python tool suite for automation-assisted annotation, curation, and functional inference for genetic designs.',
author='Nicholas Roehner',
author_email='[email protected]',
url='https://github.com/SD2E/SYNBICT',
download_url='https://github.com/SD2E/SYNBICT/archive/refs/tags/v1.4.tar.gz',
download_url='https://github.com/SD2E/SYNBICT/archive/refs/tags/v1.5.2.tar.gz',
packages=find_packages(),
install_requires=install_requires,
classifiers=[
Expand Down

0 comments on commit 7911f44

Please sign in to comment.