From: Diane Trout Date: Tue, 31 Mar 2015 22:35:52 +0000 (-0700) Subject: Add get_accession_name to use collection name to find commonly used spreadsheet acces... X-Git-Url: http://woldlab.caltech.edu/gitweb/?p=htsworkflow.git;a=commitdiff_plain;h=fe1b091216ef9011987352f26839601a7b77f5fb Add get_accession_name to use collection name to find commonly used spreadsheet accesssion column name --- diff --git a/htsworkflow/submission/encoded.py b/htsworkflow/submission/encoded.py index 83f5826..26c07f7 100644 --- a/htsworkflow/submission/encoded.py +++ b/htsworkflow/submission/encoded.py @@ -258,6 +258,23 @@ class ENCODED: return self.prepare_url(ENCODED_SCHEMA_ROOT + object_type + '.json') + '#' + def get_accession_name(self, collection): + """Lookup common object accession name given a collection name. + """ + collection_to_accession_name = { + '/experiments/': 'experiment_accession', + '/biosamples/': 'biosample_accession', + '/libraries/': 'library_accession', + '/replicates/': 'uuid', + } + + accession_name = collection_to_accession_name.get(collection, None) + if accession_name is None: + raise RuntimeError("Update list of collection to accession names for %s", + collection) + + return accession_name + def _is_encoded_object(self, obj): '''Test to see if an object is a JSON-LD object