From fcbb510713e34b932c216082ebc04d3d4d1e0118 Mon Sep 17 00:00:00 2001 From: Sijie Date: Mon, 9 Sep 2024 17:37:22 -0700 Subject: [PATCH] add features_handle_ref && protein_handle_ref before upload --- test/data/metagenomes/toy/features_handle_ref | 1 + test/data/metagenomes/toy/metagenome.json | 2 -- test/data/metagenomes/toy/protein_handle_ref | 1 + test/problematic_tests/save_genome_test.py | 23 +++++++++++++++++++ 4 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 test/data/metagenomes/toy/features_handle_ref create mode 100644 test/data/metagenomes/toy/protein_handle_ref diff --git a/test/data/metagenomes/toy/features_handle_ref b/test/data/metagenomes/toy/features_handle_ref new file mode 100644 index 00000000..f67a087d --- /dev/null +++ b/test/data/metagenomes/toy/features_handle_ref @@ -0,0 +1 @@ +test features_handle_ref \ No newline at end of file diff --git a/test/data/metagenomes/toy/metagenome.json b/test/data/metagenomes/toy/metagenome.json index 57e42815..95c23ef8 100644 --- a/test/data/metagenomes/toy/metagenome.json +++ b/test/data/metagenomes/toy/metagenome.json @@ -15,7 +15,6 @@ "non_coding_features": 0, "protein_encoding_gene": 20 }, - "features_handle_ref": "KBH_736245", "gc_content": 0.64469, "genetic_code": 1, "genome_type": "Metagenome", @@ -36,7 +35,6 @@ } ], "original_source_file_name": null, - "protein_handle_ref": "KBH_736243", "publications": [], "scientific_name": "Arabidopsis thaliana", "source": "GFF", diff --git a/test/data/metagenomes/toy/protein_handle_ref b/test/data/metagenomes/toy/protein_handle_ref new file mode 100644 index 00000000..4e4a8e1f --- /dev/null +++ b/test/data/metagenomes/toy/protein_handle_ref @@ -0,0 +1 @@ +test protein_handle_ref \ No newline at end of file diff --git a/test/problematic_tests/save_genome_test.py b/test/problematic_tests/save_genome_test.py index 5380738c..70eff5c1 100644 --- a/test/problematic_tests/save_genome_test.py +++ b/test/problematic_tests/save_genome_test.py @@ -149,6 +149,29 @@ def prepare_data(cls): cls.test_metagenome_data = json.load(open('data/metagenomes/toy/metagenome.json')) cls.test_metagenome_data['assembly_ref'] = assembly_refs[1]["upa"] + # Move files to the share folder + fhr_path = os.path.join(cls.scratch,'features_handle_ref') + phr_path = os.path.join(cls.scratch,'protein_handle_ref') + + shutil.copy('data/metagenomes/toy/features_handle_ref', fhr_path) + shutil.copy('data/metagenomes/toy/protein_handle_ref', phr_path) + + # Upload files to the blobstore + handle_service_outputs = cls.dfu.file_to_shock_mass( + [ + {'file_path': fhr_path, 'make_handle': 1, 'pack': 'gzip'}, + {'file_path': phr_path, 'make_handle': 1, 'pack': 'gzip'} + ] + ) + + # Update metagenome + cls.test_metagenome_data["features_handle_ref"] = handle_service_outputs[0]["handle"]["hid"] + cls.test_metagenome_data["protein_handle_ref"]= handle_service_outputs[1]["handle"]["hid"] + + # Delete shock_ids + cls.nodes_to_delete.append(handle_service_outputs[0]["shock_id"]) + cls.nodes_to_delete.append(handle_service_outputs[1]["shock_id"]) + def getWsClient(self): return self.__class__.wsClient