CLI Tutorial
This tutorial walks you through common refgenie operations, from installation to managing reference genome assets. By the end, you will be able to download, build, and retrieve paths to reference genome resources using the command line.
Prerequisites
Section titled “Prerequisites”- Python 3.9 or higher
- pip package manager
- Internet connection (for downloading remote assets)
Step 1: Installation
Section titled “Step 1: Installation”Download the latest wheel from GitHub releases and install:
pip install refgenie1-*.whlVerify the installation:
refgenie1 --versionStep 2: Initialize Refgenie
Section titled “Step 2: Initialize Refgenie”Before using refgenie, initialize the configuration and database:
refgenie1 initThis creates a configuration directory at ~/.refgenie/ with:
- A SQLite database for tracking assets
- A
genomes/folder for storing downloaded assets - A database configuration file
Step 3: Check Your Configuration
Section titled “Step 3: Check Your Configuration”View the current refgenie configuration:
refgenie1 config getExpected output:
Refgenie configuration┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━┓┃ genome_folder ┃ version ┃ genome_archive_folder ┃ servers ┃┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━┩│ /home/user/.refgenie/genomes │ 1 │ /home/user/.refgenie/archives │ [] │└─────────────────────────────────────┴─────────┴──────────────────────────────────────┴─────────┘
Environment-based configuration
log_level: LogLevel.INFOgenome_folder: /home/user/.refgenie/genomesgenome_archive_folder: /home/user/.refgenie/archivesdatabase_config_path: /home/user/.refgenie/refgenie_db_config.yamlStep 4: Subscribe to a Server
Section titled “Step 4: Subscribe to a Server”To download pre-built assets, subscribe to a remote refgenie server:
refgenie1 subscribe http://refgenomes.databio.orgThis adds the public refgenie server to your configuration. You can subscribe to multiple servers.
To unsubscribe from a server:
refgenie1 unsubscribe -s http://refgenomes.databio.orgStep 5: List Remote Assets
Section titled “Step 5: List Remote Assets”Browse what assets are available on subscribed servers:
refgenie1 listrExpected output:
Refgenie assets. Source: http://refgenomes.databio.org┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━┓┃ Genome digest ┃ Asset group ┃ Asset ┃┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━┩│ 2230c535660fb4774114bfa966a62f823fdb6d21acf138d4 │ fasta │ default ││ 2230c535660fb4774114bfa966a62f823fdb6d21acf138d4 │ bowtie2_index │ default ││ 2230c535660fb4774114bfa966a62f823fdb6d21acf138d4 │ bwa_index │ default ││ ... │ ... │ ... │└──────────────────────────────────────────────────┴─────────────────────────┴─────────┘Step 6: Pull an Asset
Section titled “Step 6: Pull an Asset”Download a pre-built asset from the server:
refgenie1 pull hg38/fastaThis downloads the human reference genome (hg38) FASTA file and related indexes. Refgenie automatically:
- Resolves the
hg38alias to its unique genome digest - Downloads the asset archive
- Extracts and organizes the files
- Registers the asset in the local database
Expected output:
INFO Setting 'hg38' identity with server: http://refgenomes.databio.orgINFO Determined digest for hg38: 2230c535660fb4774114bfa966a62f823fdb6d21acf138d4INFO Set genome alias: hg38hg38/fasta:default ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% • 833.4/833.4 MBStep 7: List Local Assets
Section titled “Step 7: List Local Assets”View assets you have downloaded or built locally:
refgenie1 listExpected output:
Local refgenie assets┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━┓┃ Genome ┃ Asset ┃ Tag ┃┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━┩│ hg38 │ fasta │ default │└──────────────────────────────────────────────────┴───────────────┴──────────┘Step 8: Seek Asset Paths
Section titled “Step 8: Seek Asset Paths”Retrieve the local path to a downloaded asset using seek:
refgenie1 seek hg38/fastaExpected output:
/home/user/.refgenie/genomes/alias/hg38/fasta/defaultThis returns the absolute path to the asset folder, making your scripts portable across different computing environments.
Using Seek Keys
Section titled “Using Seek Keys”Some assets contain multiple files. The fasta asset, for example, includes a FASTA file, an index (.fai), and chromosome sizes. Access specific files with seek keys:
# Get the FASTA file pathrefgenie1 seek hg38/fasta
# Get the FASTA index (.fai) pathrefgenie1 seek hg38/fasta.fai
# Get the chromosome sizes file pathrefgenie1 seek hg38/fasta.chrom_sizesRemote Seek
Section titled “Remote Seek”Get paths to assets on remote servers without downloading them:
refgenie1 seekr hg38/fastaThis is useful for cloud workflows where you want to stream data directly from S3 or other remote storage.
Step 9: Set Genome Aliases
Section titled “Step 9: Set Genome Aliases”Refgenie uses sequence-derived digests to uniquely identify genomes. Aliases like hg38 or mm10 are human-friendly names that map to these digests.
View Existing Aliases
Section titled “View Existing Aliases”refgenie1 alias getSet a New Alias
Section titled “Set a New Alias”If you know the genome digest, you can set an alias manually:
refgenie1 alias set --aliases hg38 --digest 2230c535660fb4774114bfa966a62f823fdb6d21acf138d4You can also set multiple aliases for the same genome:
refgenie1 alias set --aliases GRCh38 human_reference --digest 2230c535660fb4774114bfa966a62f823fdb6d21acf138d4Remove an Alias
Section titled “Remove an Alias”refgenie1 alias remove --aliases my_old_aliasStep 10: Build a Custom Asset
Section titled “Step 10: Build a Custom Asset”For genomes or assets not available on remote servers, you can build them locally. Here is a brief example of building a FASTA asset:
refgenie1 build my_genome/fasta --files fasta=/path/to/my_genome.fa.gz --genome-description "My custom genome"Once you have a FASTA asset, you can build derived assets like indexes:
refgenie1 build my_genome/bowtie2_indexQuick Reference
Section titled “Quick Reference”| Command | Description |
|---|---|
refgenie1 init | Initialize configuration |
refgenie1 config get | View current configuration |
refgenie1 subscribe URL | Add a remote server |
refgenie1 unsubscribe -s URL | Remove a remote server |
refgenie1 listr | List remote assets |
refgenie1 listr -g GENOME | List remote assets for a genome |
refgenie1 pull GENOME/ASSET | Download an asset |
refgenie1 list | List local assets |
refgenie1 seek GENOME/ASSET | Get local asset path |
refgenie1 seekr GENOME/ASSET | Get remote asset path |
refgenie1 alias get | View genome aliases |
refgenie1 alias set -a ALIAS -d DIGEST | Set a genome alias |
refgenie1 build GENOME/ASSET | Build an asset |
Next Steps
Section titled “Next Steps”- Configuration - Advanced configuration options, PostgreSQL setup
- Build - Building custom assets and using Docker
- Data Channels - Adding custom asset types and recipes
- Seek - More on retrieving asset paths
- Pull - More on downloading assets