diff --git a/.github/workflows/test-mars.yml b/.github/workflows/test-mars.yml index 19015dd..150d3d7 100644 --- a/.github/workflows/test-mars.yml +++ b/.github/workflows/test-mars.yml @@ -2,10 +2,10 @@ name: Test MARS on: push: paths: - - "mars-cli/**" + - "mars_lib/**" pull_request: paths: - - "mars-cli/**" + - "mars_lib/**" branches: - main workflow_dispatch: @@ -17,11 +17,11 @@ jobs: os: [ubuntu-latest, windows-latest] python-version: ["3.9", "3.13"] runs-on: ${{ matrix.os }} - env: - working-directory: ./mars-cli steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 + with: + submodules: 'recursive' - name: Set up Python uses: actions/setup-python@v5 with: diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..2fd802d --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "MARS"] + path = MARS + url = https://github.com/elixir-europe/MARS.git diff --git a/MARS b/MARS new file mode 160000 index 0000000..ed97522 --- /dev/null +++ b/MARS @@ -0,0 +1 @@ +Subproject commit ed975227017f592650d9fa700a35f33bd672fcda diff --git a/tests/test_biosample_external_references.py b/tests/test_biosample_external_references.py index ab325d8..6dc6b79 100644 --- a/tests/test_biosample_external_references.py +++ b/tests/test_biosample_external_references.py @@ -36,7 +36,7 @@ def test_load_json_file(): def test_handle_input_dict(): - input = "../test-data/ISA-BH2023-ALL/isa-bh2023-all.json" + input = "MARS/test-data/ISA-BH2023-ALL/isa-bh2023-all.json" assert handle_input_dict(input) not_a_json = "./tests/fixtures/bad_json.json" diff --git a/tests/test_ftp_upload.py b/tests/test_ftp_upload.py index a5d1672..227b158 100644 --- a/tests/test_ftp_upload.py +++ b/tests/test_ftp_upload.py @@ -23,7 +23,7 @@ def test_upload_success(): uploader = FTPUploader("webin2.ebi.ac.uk", creds["username"], creds["password"]) uploader.upload( [ - Path("../test-data/ENA_TEST2.R1.fastq.gz"), + Path("MARS/test-data/ENA_TEST2.R1.fastq.gz"), Path("./tests/fixtures/not_a_json_file.txt"), ] ) diff --git a/tests/test_isa_json.py b/tests/test_isa_json.py index a50517b..b358c63 100644 --- a/tests/test_isa_json.py +++ b/tests/test_isa_json.py @@ -27,13 +27,13 @@ def test_load_isa_json(): # Should test the validation process of the ISA JSON file where root level = investigation. valid_isa_json01 = load_isa_json( - "../test-data/ISA-BH2023-ALL/isa-bh2023-all.json", True + "MARS/test-data/ISA-BH2023-ALL/isa-bh2023-all.json", True ) assert len(valid_isa_json01.investigation.studies) == 1 assert valid_isa_json01.investigation.studies[0].identifier == "BH2023" # Should test the validation process of the ISA JSON file where root has 'investigation' as key. - valid_isa_json02 = load_isa_json("../test-data/biosamples-input-isa.json", False) + valid_isa_json02 = load_isa_json("MARS/test-data/biosamples-input-isa.json", False) assert len(valid_isa_json02.investigation.studies) == 1 assert valid_isa_json02.investigation.studies[0].title == "Arabidopsis thaliana" @@ -43,7 +43,7 @@ def test_load_isa_json(): def test_reduce_isa_json_for_target_repo(): good_isa_json = load_isa_json( - "../test-data/ISA-BH2023-ALL/isa-bh2023-all.json", True + "MARS/test-data/ISA-BH2023-ALL/isa-bh2023-all.json", True ) filtered_isa_json = reduce_isa_json_for_target_repo( @@ -60,7 +60,7 @@ def test_reduce_isa_json_for_target_repo(): def test_reduce_isa_json_for_biosamples(): good_isa_json = load_isa_json( - "../test-data/ISA-BH2023-ALL/isa-bh2023-all.json", True + "MARS/test-data/ISA-BH2023-ALL/isa-bh2023-all.json", True ) filtered_isa_json = reduce_isa_json_for_target_repo( @@ -180,7 +180,7 @@ def test_person_phone_nr_validator(): def test_update_study_materials_no_accession_categories(): # This file has no characteristics for accessions - json_path = "../test-data/biosamples-original-isa-no-accesion-char.json" + json_path = "MARS/test-data/biosamples-original-isa-no-accesion-char.json" with open(json_path) as json_file: json_data = json.load(json_file) @@ -214,7 +214,7 @@ def test_update_study_materials_no_accession_categories(): def test_update_study_materials_with_accession_categories(): # This file has no characteristics for accessions - json_path = "../test-data/biosamples-original-isa.json" + json_path = "MARS/test-data/biosamples-original-isa.json" with open(json_path) as json_file: json_data = json.load(json_file) @@ -308,45 +308,45 @@ def test_filename_validation(): def test_map_data_files_to_repositories(): isa_json = load_isa_json( - file_path="../test-data/ISA-BH2024-ALL/isa-bh2024-all.json", + file_path="MARS/test-data/ISA-BH2024-ALL/isa-bh2024-all.json", investigation_is_root=True, ) exact_match_files = [ - "../test-data/ISA-BH2024-ALL/cnv-seq-data-0.fastq", - "../test-data/ISA-BH2024-ALL/cnv-seq-data-1.fastq", - "../test-data/ISA-BH2024-ALL/cnv-seq-data-2.fastq", - "../test-data/ISA-BH2024-ALL/cnv-seq-data-3.fastq", - "../test-data/ISA-BH2024-ALL/metpro-analysis.txt", - "../test-data/ISA-BH2024-ALL/ms-data-metpro--1.mzml", - "../test-data/ISA-BH2024-ALL/ms-data-metpro--2.mzml", - "../test-data/ISA-BH2024-ALL/ms-data-metpro--3.mzml", - "../test-data/ISA-BH2024-ALL/ms-data-metpro--4.mzml", - "../test-data/ISA-BH2024-ALL/rna-seq-data-0.fastq", - "../test-data/ISA-BH2024-ALL/rna-seq-data-1.fastq", - "../test-data/ISA-BH2024-ALL/rna-seq-data-2.fastq", - "../test-data/ISA-BH2024-ALL/rna-seq-data-3.fastq", + "MARS/test-data/ISA-BH2024-ALL/cnv-seq-data-0.fastq", + "MARS/test-data/ISA-BH2024-ALL/cnv-seq-data-1.fastq", + "MARS/test-data/ISA-BH2024-ALL/cnv-seq-data-2.fastq", + "MARS/test-data/ISA-BH2024-ALL/cnv-seq-data-3.fastq", + "MARS/test-data/ISA-BH2024-ALL/metpro-analysis.txt", + "MARS/test-data/ISA-BH2024-ALL/ms-data-metpro--1.mzml", + "MARS/test-data/ISA-BH2024-ALL/ms-data-metpro--2.mzml", + "MARS/test-data/ISA-BH2024-ALL/ms-data-metpro--3.mzml", + "MARS/test-data/ISA-BH2024-ALL/ms-data-metpro--4.mzml", + "MARS/test-data/ISA-BH2024-ALL/rna-seq-data-0.fastq", + "MARS/test-data/ISA-BH2024-ALL/rna-seq-data-1.fastq", + "MARS/test-data/ISA-BH2024-ALL/rna-seq-data-2.fastq", + "MARS/test-data/ISA-BH2024-ALL/rna-seq-data-3.fastq", ] check_map = dict( { "metabolights": [ - "../test-data/ISA-BH2024-ALL/metpro-analysis.txt", - "../test-data/ISA-BH2024-ALL/ms-data-metpro--1.mzml", - "../test-data/ISA-BH2024-ALL/ms-data-metpro--2.mzml", - "../test-data/ISA-BH2024-ALL/ms-data-metpro--3.mzml", - "../test-data/ISA-BH2024-ALL/ms-data-metpro--4.mzml", + "MARS/test-data/ISA-BH2024-ALL/metpro-analysis.txt", + "MARS/test-data/ISA-BH2024-ALL/ms-data-metpro--1.mzml", + "MARS/test-data/ISA-BH2024-ALL/ms-data-metpro--2.mzml", + "MARS/test-data/ISA-BH2024-ALL/ms-data-metpro--3.mzml", + "MARS/test-data/ISA-BH2024-ALL/ms-data-metpro--4.mzml", ], "arrayexpress": [ - "../test-data/ISA-BH2024-ALL/rna-seq-data-0.fastq", - "../test-data/ISA-BH2024-ALL/rna-seq-data-1.fastq", - "../test-data/ISA-BH2024-ALL/rna-seq-data-2.fastq", - "../test-data/ISA-BH2024-ALL/rna-seq-data-3.fastq", + "MARS/test-data/ISA-BH2024-ALL/rna-seq-data-0.fastq", + "MARS/test-data/ISA-BH2024-ALL/rna-seq-data-1.fastq", + "MARS/test-data/ISA-BH2024-ALL/rna-seq-data-2.fastq", + "MARS/test-data/ISA-BH2024-ALL/rna-seq-data-3.fastq", ], "eva": [ - "../test-data/ISA-BH2024-ALL/cnv-seq-data-0.fastq", - "../test-data/ISA-BH2024-ALL/cnv-seq-data-1.fastq", - "../test-data/ISA-BH2024-ALL/cnv-seq-data-2.fastq", - "../test-data/ISA-BH2024-ALL/cnv-seq-data-3.fastq", + "MARS/test-data/ISA-BH2024-ALL/cnv-seq-data-0.fastq", + "MARS/test-data/ISA-BH2024-ALL/cnv-seq-data-1.fastq", + "MARS/test-data/ISA-BH2024-ALL/cnv-seq-data-2.fastq", + "MARS/test-data/ISA-BH2024-ALL/cnv-seq-data-3.fastq", ], } ) @@ -361,7 +361,7 @@ def test_map_data_files_to_repositories(): map_data_files_to_repositories(not_enough_files, isa_json) too_many_files = exact_match_files.copy() - one_too_many = "../test-data/ISA-BH2024-ALL/one-too-many.fastq" + one_too_many = "MARS/test-data/ISA-BH2024-ALL/one-too-many.fastq" too_many_files.append(one_too_many) result_maps = map_data_files_to_repositories(too_many_files, isa_json)