diff --git a/emgapi/management/commands/populate_metagenomics_exchange.py b/emgapi/management/commands/populate_metagenomics_exchange.py index 2e1d0da39..937f8613a 100644 --- a/emgapi/management/commands/populate_metagenomics_exchange.py +++ b/emgapi/management/commands/populate_metagenomics_exchange.py @@ -115,7 +115,7 @@ def process_to_index_and_update_records(self, analyses_to_index_and_update): ) registry_id, metadata_match = self.mgx_api.check_analysis( mgya=annotation_job.accession, - sequence_accession=annotation_job.run, + sequence_accession=sequence_accession, metadata=metadata, ) # The job is not registered diff --git a/emgapi/metagenomics_exchange.py b/emgapi/metagenomics_exchange.py index 79b693571..ca17011aa 100644 --- a/emgapi/metagenomics_exchange.py +++ b/emgapi/metagenomics_exchange.py @@ -109,13 +109,13 @@ def add_analysis(self, mgya: str, sequence_accession: str): response = self.post_request(endpoint="datasets", data=data) return response - def check_analysis(self, mgya: str, sequence_accesion: str, metadata=None): + def check_analysis(self, mgya: str, sequence_accession: str, metadata=None): """Check if a sequence exists in the M. Exchange Parameters: mgya : str The MGnify Analysis accession. - sequence_accesion : str + sequence_accession : str Either the Run accession or the Assembly accession related to the MGYA. Returns: @@ -124,16 +124,16 @@ def check_analysis(self, mgya: str, sequence_accesion: str, metadata=None): """ if not mgya: raise ValueError(f"mgya is mandatory.") - if not sequence_accesion: - raise ValueError(f"sequence_accesion is mandatory.") + if not sequence_accession: + raise ValueError(f"sequence_accession is mandatory.") - logging.info(f"Checking {mgya} - {sequence_accesion}") + logging.info(f"Checking {mgya} - {sequence_accession}") params = { "broker": self.broker, } - endpoint = f"sequences/{sequence_accesion}/datasets" + endpoint = f"sequences/{sequence_accession}/datasets" analysis_registry_id = None metadata_match = True