diff --git a/seqcol/seqcol.py b/seqcol/seqcol.py index e18ee3f..2b7e3e5 100644 --- a/seqcol/seqcol.py +++ b/seqcol/seqcol.py @@ -1,6 +1,6 @@ import henge import logging -import refget +import yacman from itertools import compress @@ -12,14 +12,34 @@ henge.ITEM_TYPE = "_item_type" -class SeqColHenge(refget.RefGetClient): +class SeqColConf(yacman.YAMLConfigManager): + """ + Simple configuration manager object for SeqColHenge. + """ + def __init__( + self, + entries={}, + filepath=None, + yamldata=None, + writable=False, + wait_max=60, + skip_read_lock=False, + ): + filepath = yacman.select_config( + config_filepath=filepath, + config_env_vars=["SEQCOLAPI_CONFIG"], + config_name="seqcol" + ) + super(SeqColConf, self).__init__(entries, filepath, yamldata, writable) + + +class SeqColHenge(henge.Henge): """ Extension of henge that accommodates collections of sequences. """ def __init__( self, - api_url_base=None, database={}, schemas=None, henges=None, @@ -38,7 +58,6 @@ def __init__( serialized items stored in this henge. """ super(SeqColHenge, self).__init__( - api_url_base=api_url_base, database=database, schemas=schemas or INTERNAL_SCHEMAS, henges=henges, @@ -123,6 +142,7 @@ def retrieve(self, druid, reclimit=None, raw=False): return super(SeqColHenge, self).retrieve(druid, reclimit, raw) except henge.NotFoundException as e: _LOGGER.debug(e) + raise e try: return self.refget(druid) except Exception as e: diff --git a/seqcol/utilities.py b/seqcol/utilities.py index a902722..12f32bf 100644 --- a/seqcol/utilities.py +++ b/seqcol/utilities.py @@ -139,7 +139,7 @@ def fasta_obj_to_seqcol( seq = str(fa_object[k]) seq_length = len(seq) seq_name = fa_object[k].name - seq_digest = digest_function(seq.upper()) + seq_digest = "SQ."+digest_function(seq.upper()) snlp = {"length": seq_length, "name": seq_name} # sorted_name_length_pairs snlp_digest = digest_function(canonical_str(snlp)) CSC["lengths"].append(seq_length)