{"id":7662,"library":"refgenconf","title":"RefGenConf","description":"RefGenConf provides a standardized configuration object for reference genome assemblies. It enables robust and centralized management of paths to reference genome assets, ensuring consistency for bioinformatics tools. The current version is 0.13.1, and the project maintains an active development and release cadence.","status":"active","version":"0.13.1","language":"en","source_language":"en","source_url":"https://github.com/refgenie/refgenconf","tags":["genomics","bioinformatics","configuration","reference genomes","data management"],"install":[{"cmd":"pip install refgenconf","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Utility functions and data structures.","package":"ubiquerg","optional":false},{"reason":"YAML-based configuration management.","package":"yacman","optional":false},{"reason":"For project-level configuration, though not a direct runtime dependency for basic RefGenConf usage, it's part of the broader ecosystem.","package":"peppy","optional":true}],"imports":[{"symbol":"RefGenConf","correct":"from refgenconf import RefGenConf"}],"quickstart":{"code":"import refgenconf\nimport os\nimport yaml\n\n# --- Quickstart Setup: Create a dummy config file for demonstration ---\n# In a real scenario, this would typically be '~/.refgenie/refgenie.yaml'\n# initialized via 'refgenie init' command.\nconfig_path = \"temp_refgenie_config.yaml\"\ndummy_config_data = {\n    \"refgenie\": {\n        \"genome_assembly\": {\n            \"assets\": {\n                \"fasta\": {\"path\": \"/path/to/fasta.fa\", \"description\": \"Genome fasta file\"},\n                \"chrom_sizes\": {\"path\": \"/path/to/chrom.sizes\", \"description\": \"Chromosome sizes file\"}\n            }\n        }\n    }\n}\nwith open(config_path, \"w\") as f:\n    yaml.dump(dummy_config_data, f)\n# ---------------------------------------------------------------------\n\n# Initialize RefGenConf with the config file path\nrgc = refgenconf.RefGenConf(config_path)\n\n# Access a genome assembly's assets\ngenome = \"genome_assembly\"\nasset_key = \"fasta\"\n\nif rgc.has_genome(genome) and rgc.has_asset(genome, asset_key):\n    asset_path = rgc.seek(genome, asset_key)\n    print(f\"Path to {asset_key} for {genome}: {asset_path}\")\n    # Example: Access metadata\n    metadata = rgc.get_asset_data(genome, asset_key)\n    print(f\"Metadata for {asset_key}: {metadata}\")\nelse:\n    print(f\"Genome '{genome}' or asset '{asset_key}' not found in config.\")\n\n# Clean up the dummy config file\nos.remove(config_path)","lang":"python","description":"This example demonstrates how to initialize RefGenConf with a configuration file and retrieve paths to specific assets. It includes setup for a temporary config file for immediate execution. In practice, users typically rely on a `refgenie.yaml` file managed by the `refgenie` command-line tool."},"warnings":[{"fix":"Use `refgenie upgrade` (if applicable with your `refgenie` version) or manually update your `refgenie.yaml` to conform to the latest schema. Refer to the official RefGenConf/Refgenie documentation for schema changes.","message":"RefGenConf versions prior to 0.10.0 used a different configuration file schema. Upgrading from older versions (e.g., 0.9.x to 0.10.x or newer) often requires migrating your `refgenie.yaml` file.","severity":"breaking","affected_versions":"<0.10.0"},{"fix":"Ensure `refgenie` is initialized by running `refgenie init` in your terminal. If using a custom path, explicitly provide it during `RefGenConf` initialization (e.g., `RefGenConf(filepath='/path/to/my_refgenie.yaml')`).","message":"RefGenConf typically relies on a `refgenie.yaml` configuration file, usually located at `~/.refgenie/refgenie.yaml`. If this file is missing or malformed, initialization will fail, or assets will not be found.","severity":"gotcha","affected_versions":"All"},{"fix":"Use `refgenie list` in your terminal or inspect your `refgenie.yaml` file to verify the exact names of genomes and assets. Ensure your code uses these names precisely.","message":"Asset names and genome assembly identifiers are case-sensitive and must exactly match the entries in the `refgenie.yaml` configuration. Incorrect casing or typos will result in `KeyError` or 'Asset not found' errors.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Initialize `refgenie` by running `refgenie init` in your terminal. If you intend to use a different file, pass its path explicitly to `RefGenConf(filepath='your/custom/path.yaml')`.","cause":"The default RefGenConf configuration file was not found at its expected location.","error":"FileNotFoundError: [Errno 2] No such file or directory: '~/.refgenie/refgenie.yaml'"},{"fix":"Run `refgenie upgrade` to attempt an automatic migration. If that doesn't work, review the RefGenConf documentation for the correct schema or regenerate the configuration by re-initializing `refgenie` and adding assets.","cause":"The `refgenie.yaml` file does not conform to the expected schema, possibly due to manual edits or an outdated format.","error":"refgenconf.exceptions.RefgenconfError: Malformed configuration file"},{"fix":"Check your `refgenie.yaml` file or use `refgenie list` to confirm the exact names of registered genomes and assets. Ensure your Python code uses these names precisely as they appear in the configuration.","cause":"You are trying to access a genome assembly or an asset that is not defined in your `refgenie.yaml` file, or the name is misspelled/incorrectly cased.","error":"KeyError: 'some_genome_or_asset_name'"}]}