diff --git a/server/rest/cronjob/cronjob_service.py b/server/rest/cronjob/cronjob_service.py index 9cf668dd..38f6b6ff 100644 --- a/server/rest/cronjob/cronjob_service.py +++ b/server/rest/cronjob/cronjob_service.py @@ -236,3 +236,19 @@ def add_blob_link(): if len(response) and 'names' in response[0].keys() and len(response[0]['names']): ass.blobtoolkit_id = response[0]['names'][0] ass.save() + +def create_biosample_coordinates(): + biosamples = BioSample.objects() + existing_coordinates = SampleCoordinates.objects().scalar('sample_accession') + for biosample in biosamples: + if biosample.accession in existing_coordinates: + continue + sample_locations_service.save_coordinates(biosample) + +def create_local_sample_coordinates(): + local_samples = LocalSample.objects() + existing_coordinates = SampleCoordinates.objects().scalar('sample_accession') + for local_sample in local_samples: + if local_sample.local_id in existing_coordinates: + continue + sample_locations_service.save_coordinates(local_sample,id_field='local_id') \ No newline at end of file diff --git a/server/rest/cronjob/cronjobs_controller.py b/server/rest/cronjob/cronjobs_controller.py index 86fa323f..67e20936 100644 --- a/server/rest/cronjob/cronjobs_controller.py +++ b/server/rest/cronjob/cronjobs_controller.py @@ -17,7 +17,9 @@ 'update_sample_locations': cronjob_service.update_sample_locations, 'get_samples_collection_date':cronjob_service.get_samples_collection_date, 'add_blob_link':cronjob_service.add_blob_link, - 'remove_orphan_local_samples':cronjob_service.remove_orphan_local_samples + 'remove_orphan_local_samples':cronjob_service.remove_orphan_local_samples, + 'create_biosample_coordinates':cronjob_service.create_biosample_coordinates, + 'create_local_sample_coordinates':cronjob_service.create_local_sample_coordinates } ## persist cronjob status class CronJobApi(Resource):