Skip to content

Instantly share code, notes, and snippets.

@mvdbeek
Last active August 25, 2025 07:37
Show Gist options
  • Select an option

  • Save mvdbeek/92deb18ee29545dabbed32d346c7c1a1 to your computer and use it in GitHub Desktop.

Select an option

Save mvdbeek/92deb18ee29545dabbed32d346c7c1a1 to your computer and use it in GitHub Desktop.
ying recover hifiasm noseq collection

Recovering hifiasm job

Situation

Job failed on first run, rerun with "replace dataset collection elements" selected. Discovered output dataset collection elements were added to original collection, while new output dataset collection is not populated. This probably makes the job ineligible for the job cache / job search.

Collections and IDs

New HDCA without elements: b4248c8d761ed2ce Old HDCA with new elements: f65cf3bbc799b185

Fix

Change dataset_collection_id on dataset collection elements of old dataset collection to new one.

galaxy_main=> select * from dataset_collection_element as dce where dce.dataset_collection_id = 10074352;
 id | dataset_collection_id | hda_id | ldda_id | child_collection_id | element_index | element_identifier
----+-----------------------+--------+---------+---------------------+---------------+--------------------
(0 rows)

galaxy_main=> select * from dataset_collection_element as dce where dce.dataset_collection_id = 10010723;
    id    | dataset_collection_id |  hda_id   | ldda_id | child_collection_id | element_index |     element_identifier
----------+-----------------------+-----------+---------+---------------------+---------------+-----------------------------
 75340757 |              10010723 | 158125270 |         |                     |             0 | output.hic.a_ctg.noseq
 75340758 |              10010723 | 158125271 |         |                     |             1 | output.hic.hap1.p_ctg.noseq
 75340759 |              10010723 | 158125272 |         |                     |             2 | output.hic.hap2.p_ctg.noseq
 75340760 |              10010723 | 158125273 |         |                     |             3 | output.hic.p_ctg.noseq
 75340761 |              10010723 | 158125274 |         |                     |             4 | output.hic.p_utg.noseq
 75340762 |              10010723 | 158125275 |         |                     |             5 | output.hic.r_utg.noseq
(6 rows)

Now change stuff:

galaxy_main=> start transaction
;
START TRANSACTION
galaxy_main=*> update dataset_collection_element set dataset_collection_id=10074352 where dataset_collection_id=10010723;
UPDATE 6
galaxy_main=*> update dataset_collection SET populated_state='ok' where id=10074352;
UPDATE 1
galaxy_main=*> update dataset_collection SET element_count=6 where id=10074352;
UPDATE 1
galaxy_main=*> commit;
COMMIT

now shows up in job search:

import json
import requests

url = "https://usegalaxy.org/api/jobs/search"
api_key = os.getenv("GALAXY_API_KEY")
s = requests.Session()
s.headers["x-api-key"] = api_key


request_json = """{
    "history_id": "bbd44e69cb8906b5e4b0d71318d67fc6",
    "tool_id": "toolshed.g2.bx.psu.edu/repos/bgruening/hifiasm/hifiasm/0.25.0+galaxy0",
    "tool_version": "0.25.0+galaxy0",
    "inputs": {
        "mode|mode_selector": "standard",
        "mode|reads": {
            "batch": false,
            "product": false,
            "values": [
                {
                    "id": "1acbf043cb05ced3",
                    "src": "hdca",
                    "map_over_type": null
                }
            ]
        },
        "filter_bits": "37",
        "assembly_options|assembly_selector": "set",
        "assembly_options|cleaning_rounds": "4",
        "assembly_options|adapter_length": "0",
        "assembly_options|pop_contigs": "10000000",
        "assembly_options|pop_unitigs": "100000",
        "assembly_options|remove_tips": "3",
        "assembly_options|max_overlap": "0.8",
        "assembly_options|min_overlap": "0.2",
        "assembly_options|disable_post_join": false,
        "assembly_options|ignore_error_corrected": false,
        "assembly_options|hom_cov": "12",
        "purge_options|purge_selector": "blank",
        "hic_partition|hic_partition_selector": "set",
        "hic_partition|h1": {
            "batch": false,
            "product": false,
            "values": [
                {
                    "id": "f9cad7b01a472135dcfffbe105500651",
                    "src": "hda",
                    "map_over_type": null
                }
            ]
        },
        "hic_partition|h2": {
            "batch": false,
            "product": false,
            "values": [
                {
                    "id": "f9cad7b01a4721353d880d23d3fea0a1",
                    "src": "hda",
                    "map_over_type": null
                }
            ]
        },
        "hic_partition|seed": "",
        "hic_partition|n_weight": "",
        "hic_partition|n_perturb": "",
        "hic_partition|f_perturb": "",
        "hic_partition|l_msjoin": "500000",
        "ont_integration|ont_integration_selector": "blank",
        "advanced_options|advanced_selector": "blank",
        "scaffolding_options|scaffold_selector": "blank",
        "log_out": true,
        "bins_out": true
    }
}"""


r = s.post(url, json=d)
r.json()

[{'model_class': 'Job',
  'id': 'bbd44e69cb8906b54e6a4a7bd8a8a0b1',
  'history_id': 'bbd44e69cb8906b5e4b0d71318d67fc6',
  'tool_id': 'toolshed.g2.bx.psu.edu/repos/bgruening/hifiasm/hifiasm/0.25.0+galaxy0',
  'state': 'ok',
  'exit_code': 0,
  'create_time': '2025-08-15T14:47:56.401554',
  'update_time': '2025-08-21T20:52:06.511452',
  'galaxy_version': '25.0',
  'external_id': None,
  'handler': None,
  'job_runner_name': None,
  'command_line': None,
  'user_email': None,
  'user_id': 'cbb47ba6d7091fac',
  'command_version': '0.25.0-r726',
  'params': {'mode': '{"__current_case__": 0, "mode_selector": "standard", "reads": {"values": [{"id": 4140536, "src": "hdca"}]}}',
   'filter_bits': '"37"',
   'assembly_options': '{"__current_case__": 1, "adapter_length": "0", "assembly_selector": "set", "cleaning_rounds": "4", "disable_post_join": false, "hom_cov": "12", "ignore_error_corrected": false, "max_overlap": "0.8", "min_overlap": "0.2", "pop_contigs": "10000000", "pop_unitigs": "100000", "remove_tips": "3"}',
   'purge_options': '{"__current_case__": 0, "purge_selector": "blank"}',
   'hic_partition': '{"__current_case__": 1, "f_perturb": "", "h1": {"values": [{"id": 157434293, "src": "hda"}]}, "h2": {"values": [{"id": 157434294, "src": "hda"}]}, "hic_partition_selector": "set", "l_msjoin": "500000", "n_perturb": "", "n_weight": "", "seed": ""}',
   'ont_integration': '{"__current_case__": 0, "ont_integration_selector": "blank"}',
   'advanced_options': '{"__current_case__": 0, "advanced_selector": "blank"}',
   'scaffolding_options': '{"__current_case__": 0, "scaffold_selector": "blank"}',
   'log_out': 'true',
   'bins_out': 'true',
   'chromInfo': '"/cvmfs/data.galaxyproject.org/managed/len/ucsc/?.len"',
   'dbkey': '"?"',
   '__input_ext': '"fastqsanger.gz"'},
  'inputs': {'mode|reads': {'id': 'f9cad7b01a472135d5b84b4fb6b02024',
    'src': 'hda',
    'uuid': '7e2e4df2-8076-430f-b586-c37a1868d761'},
   'mode|reads1': {'id': 'f9cad7b01a472135d5b84b4fb6b02024',
    'src': 'hda',
    'uuid': '7e2e4df2-8076-430f-b586-c37a1868d761'},
   'mode|reads2': {'id': 'f9cad7b01a47213570f5f3e0276d4685',
    'src': 'hda',
    'uuid': '572c4743-f8ec-42db-8599-d1e44cccecc0'},
   'mode|reads3': {'id': 'f9cad7b01a472135ab06719319a67da6',
    'src': 'hda',
    'uuid': 'e8449582-17cf-49f8-b4e3-47b96d6d875b'},
   'hic_partition|h2': {'id': 'f9cad7b01a4721353d880d23d3fea0a1',
    'src': 'hda',
    'uuid': '5d590fb8-ecd8-4bf5-8434-b12791f982b6'},
   'hic_partition|h21': {'id': 'f9cad7b01a4721353d880d23d3fea0a1',
    'src': 'hda',
    'uuid': '5d590fb8-ecd8-4bf5-8434-b12791f982b6'},
   'mode|reads4': {'id': 'f9cad7b01a4721354295104c45246ee7',
    'src': 'hda',
    'uuid': '4b76bd06-0599-43d0-8184-38c5f98f82b8'},
   'mode|reads5': {'id': 'f9cad7b01a472135821d0f71295512af',
    'src': 'hda',
    'uuid': 'e139ff9a-6ff4-4bb8-943b-e671964b35d9'},
   'mode|reads6': {'id': 'f9cad7b01a4721356504f55ce902d977',
    'src': 'hda',
    'uuid': '47d82e5c-f915-4579-8b66-c1f74d6c65a2'},
   'mode|reads7': {'id': 'f9cad7b01a4721350c173c4c10f51905',
    'src': 'hda',
    'uuid': '3297578a-6c2e-44b4-8bc0-736966ad2a69'},
   'mode|reads8': {'id': 'f9cad7b01a4721355f0d2f478db47cd4',
    'src': 'hda',
    'uuid': 'a698a01e-e92a-4d1b-b6ce-26ba7f0223a2'},
   'mode|reads9': {'id': 'f9cad7b01a472135c6e8173ebd3ddbba',
    'src': 'hda',
    'uuid': 'd08a5da0-b556-4e65-bcb2-6630435dbe46'},
   'mode|reads10': {'id': 'f9cad7b01a4721350086b32d6f9b68d0',
    'src': 'hda',
    'uuid': '1a371c27-9bbf-483d-b4e1-6898c1cc42fe'},
   'mode|reads11': {'id': 'f9cad7b01a472135656745858bc2b22c',
    'src': 'hda',
    'uuid': 'c62b1d11-45d5-408c-b3bc-7a491247ed8c'},
   'mode|reads12': {'id': 'f9cad7b01a472135e3f94f2f342b8a1f',
    'src': 'hda',
    'uuid': '65fa1293-9d2d-4602-83ae-dd14f85c9e19'},
   'mode|reads13': {'id': 'f9cad7b01a472135d75635b7240c5d8b',
    'src': 'hda',
    'uuid': '82934c65-1aca-4825-8a31-2c4f701c55e2'},
   'mode|reads14': {'id': 'f9cad7b01a472135ee79849c534c718c',
    'src': 'hda',
    'uuid': '7e354309-bf86-46f9-a07f-f6cd778e2221'},
   'mode|reads15': {'id': 'f9cad7b01a4721358149be310f0a61c2',
    'src': 'hda',
    'uuid': '510a268d-5869-48c3-b83b-6a7c9f6b0e22'},
   'mode|reads16': {'id': 'f9cad7b01a4721350d22aa4abdab36e4',
    'src': 'hda',
    'uuid': 'cd7158a6-ed1d-43d7-8101-e55528eeb3a7'},
   'mode|reads17': {'id': 'f9cad7b01a47213502da18194fe2409b',
    'src': 'hda',
    'uuid': '10ef1b9b-fcd2-4fed-8f53-e24aff4d07ee'},
   'mode|reads18': {'id': 'f9cad7b01a472135144fd535613621ef',
    'src': 'hda',
    'uuid': '282856df-15aa-4802-ba01-5d965abbd049'},
   'hic_partition|h1': {'id': 'f9cad7b01a472135dcfffbe105500651',
    'src': 'hda',
    'uuid': 'e026a60c-ba5f-450a-894a-6ffc3d0e6a0f'},
   'hic_partition|h11': {'id': 'f9cad7b01a472135dcfffbe105500651',
    'src': 'hda',
    'uuid': 'e026a60c-ba5f-450a-894a-6ffc3d0e6a0f'}},
  'outputs': {'hic_pcontig_graph': {'id': 'f9cad7b01a4721352ba3401768f39167',
    'src': 'hda',
    'uuid': '3f90395a-cdd9-4145-b86b-3d5f756d6e9e'},
   'hic_acontig_graph': {'id': 'f9cad7b01a472135dde747f00948f322',
    'src': 'hda',
    'uuid': 'ce6b221d-6e81-4622-940f-73a940fd4aad'},
   'hic_balanced_contig_hap1_graph': {'id': 'f9cad7b01a4721351c87b379b645b8ba',
    'src': 'hda',
    'uuid': '30762353-8adc-4c62-b179-75e42d5079e9'},
   'hic_balanced_contig_hap2_graph': {'id': 'f9cad7b01a472135a553b080efa9bad8',
    'src': 'hda',
    'uuid': '68f195bc-f872-452f-af25-ceedded3921d'},
   'hic_raw_initig': {'id': 'f9cad7b01a472135441b7ef3314a4c98',
    'src': 'hda',
    'uuid': 'b573cce8-302d-45d2-9d1a-d3e436f3f0cc'},
   'log_file': {'id': 'f9cad7b01a47213598f51d345976d5b7',
    'src': 'hda',
    'uuid': '224ea3e8-eca2-4e8c-81f5-0c9d4149dba6'},
   '__new_primary_file_noseq_files|output.hic.a_ctg.noseq__': {'id': 'f9cad7b01a4721354eb801756cd95462',
    'src': 'hda',
    'uuid': 'c5803bbd-d7a5-46f4-b3c6-59ddad57f84d'},
   '__new_primary_file_noseq_files|output.hic.hap1.p_ctg.noseq__': {'id': 'f9cad7b01a472135826658cd08b90cf3',
    'src': 'hda',
    'uuid': '3c051a78-bdee-439a-87fe-0b30b394cd1d'},
   '__new_primary_file_noseq_files|output.hic.hap2.p_ctg.noseq__': {'id': 'f9cad7b01a472135c8e4e9c8067ad8e6',
    'src': 'hda',
    'uuid': '9a7abb16-6d5c-4ed7-88d3-4e6a8355d187'},
   '__new_primary_file_noseq_files|output.hic.p_ctg.noseq__': {'id': 'f9cad7b01a472135150792445f6b78a6',
    'src': 'hda',
    'uuid': 'bdb8b3cf-9d47-4ea1-8032-b5c44d7667fc'},
   '__new_primary_file_noseq_files|output.hic.p_utg.noseq__': {'id': 'f9cad7b01a472135468948773eb6443d',
    'src': 'hda',
    'uuid': '97143174-554a-4fb3-ab79-7e946f317b74'},
   '__new_primary_file_noseq_files|output.hic.r_utg.noseq__': {'id': 'f9cad7b01a472135b79c5badabfe0de9',
    'src': 'hda',
    'uuid': '75d600d6-bd1f-4c25-bc48-0a2b3775685f'},
   '__new_primary_file_bin_files|output.ec__': {'id': 'f9cad7b01a472135afa8bfa2508f5f5f',
    'src': 'hda',
    'uuid': '19355375-15ed-4a88-81ca-5ac1a301b5c0'},
   '__new_primary_file_bin_files|output.hic.lk__': {'id': 'f9cad7b01a472135a0b327269e3851fd',
    'src': 'hda',
    'uuid': '698623c4-8e55-4ac4-8412-4d20f13544c7'},
   '__new_primary_file_bin_files|output.hic.tlb__': {'id': 'f9cad7b01a472135f390f15e6f7c69ef',
    'src': 'hda',
    'uuid': '84579f2c-8f80-4703-a313-646a3a3c1ac2'},
   '__new_primary_file_bin_files|output.ovlp.reverse__': {'id': 'f9cad7b01a472135f7caa3620204087d',
    'src': 'hda',
    'uuid': '96dff50b-d8e3-4b5a-9743-e00cb5f2e9f3'},
   '__new_primary_file_bin_files|output.ovlp.source__': {'id': 'f9cad7b01a4721355dc7019a701115bc',
    'src': 'hda',
    'uuid': '628087c3-6e9e-45fc-b21f-4fe9adc26d35'}},
  'copied_from_job_id': None,
  'output_collections': {'noseq_files': {'src': 'hdca',
    'id': 'f65cf3bbc799b185'},
   'bin_files': {'src': 'hdca', 'id': '61cc550ab754accb'}}}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment