### Installing a Genome with Annotation using genomepy.install_genome (Python) Source: https://github.com/vanheeringen-lab/genomepy/blob/master/README.md This example shows how to install a specific genome, "hg38", along with its annotation data, from a specified provider ("UCSC") into a custom directory. It highlights the process of downloading and post-processing the genome and annotation files. ```Python genomepy.install_genome("hg38", annotation=True, provider="UCSC", genomes_dir="./data/genomes") ``` -------------------------------- ### Installing Genome from a URL Source: https://github.com/vanheeringen-lab/genomepy/blob/master/README.md This command installs a genome directly from a provided URL using `--provider url`. This is useful for installing assemblies not available through standard `genomepy` providers, allowing users to integrate custom or privately hosted genome files. ```bash $ genomepy install -p url https://research.nhgri.nih.gov/hydra/download/assembly/\Hm105_Dovetail_Assembly_1.0.fa.gz ``` -------------------------------- ### Installing a Genome with genomepy Source: https://github.com/vanheeringen-lab/genomepy/blob/master/README.md This command installs a specified genome, `xenTro9`, using `genomepy`. The genome name should be obtained from a prior search function. This is the most basic installation command. ```bash $ genomepy install xenTro9 ``` -------------------------------- ### Installing a Genome with Annotation via genomepy CLI Source: https://github.com/vanheeringen-lab/genomepy/blob/master/README.md This command initiates the download and installation of a specific genome, 'GRCz11', from the 'ensembl' provider. The `--annotation` flag ensures that the corresponding gene annotation data is also downloaded and processed. By default, genomes are installed to `~/.local/share/genomes/`. ```bash genomepy install --annotation GRCz11 --provider ensembl ``` -------------------------------- ### Installing a Genome with Gene Annotation Source: https://github.com/vanheeringen-lab/genomepy/blob/master/README.md This command installs the `xenTro9` genome and simultaneously downloads its associated gene annotation files. The `--annotation` (or `-a`) flag enables the inclusion of annotation data during the installation process. ```bash $ genomepy install xenTro9 --annotation ``` -------------------------------- ### Setting Up Genomepy Development Environment - Bash Source: https://github.com/vanheeringen-lab/genomepy/blob/master/README.md This sequence of commands guides developers through setting up a local environment for the genomepy project. It involves switching to the 'develop' branch, creating and activating a dedicated Conda environment from `environment.yaml`, installing the package in editable mode for live changes, and finally creating a new feature branch for development. ```bash git checkout develop conda env create -f environment.yaml conda activate genomepy pip install -e . git checkout -b your_develop_branch ``` -------------------------------- ### Installing genomepy from Git Source Source: https://github.com/vanheeringen-lab/genomepy/blob/master/README.md This sequence of commands installs genomepy directly from its GitHub repository. It first clones the repository, then creates a new Conda environment based on the provided `environment.yml` file, activates the environment, and finally installs genomepy in editable mode using pip. This method is suitable for development or using the latest unreleased features. ```bash git clone https://github.com/vanheeringen-lab/genomepy.git conda env create -n genomepy -f genomepy/environment.yml conda activate genomepy pip install -e genomepy ``` -------------------------------- ### Installing Genome from URL (Command Line) Source: https://github.com/vanheeringen-lab/genomepy/blob/master/README.md This command-line snippet demonstrates how to manually install a genome and its annotation by providing direct URLs. It's useful when standard provider methods fail or for custom genome sources, allowing users to specify the genome and annotation URLs. ```Bash genomepy install GENOME_URL -p url --url-to-annotation ANNOTATION_URL ``` -------------------------------- ### Installing genomepy via Pip Source: https://github.com/vanheeringen-lab/genomepy/blob/master/README.md This command installs genomepy using pip, Python's package installer. Note that with pip installation, additional dependencies like `pysam` and UCSC utilities (`genePredToBed`, `genePredToGtf`, etc.) may need to be installed separately and added to the system's PATH for full functionality. ```bash pip install genomepy ``` -------------------------------- ### Installing Genomic Data (Python) Source: https://github.com/vanheeringen-lab/genomepy/blob/master/docs/content/api_core.rst This function downloads and installs a specified genome. It offers extensive control over parameters for optimization and will not overwrite existing files by default. ```Python def install_genome(name: str, provider: str = None, **kwargs): # Downloads and installs a genome. pass ``` -------------------------------- ### Installing Project in Editable Mode (Python/Shell) Source: https://github.com/vanheeringen-lab/genomepy/blob/master/docs/README.md Installs the current Python package in 'editable' mode, allowing direct modifications to the source code to be reflected without reinstallation. `--no-deps` prevents re-downloading dependencies, and `--ignore-installed` bypasses already installed versions. ```Shell pip install -e . --no-deps --ignore-installed ``` -------------------------------- ### Installing Local Genome with Local Annotation Source: https://github.com/vanheeringen-lab/genomepy/blob/master/README.md This command installs a genome from a local FASTA file (`/path/to/genome.fa`) and specifies a local path to its gene annotation file (`/path/to/gene.annotation.gtf`) using `--provider local` and `--Local-path-to-annotation`. This enables `genomepy` to manage custom local genome and annotation files. ```bash $ genomepy install -p local /path/to/genome.fa --Local-path-to-annotation /path/to/gene.annotation.gtf ``` -------------------------------- ### Installing genomepy via Bioconda Source: https://github.com/vanheeringen-lab/genomepy/blob/master/README.md This command installs genomepy using the Bioconda channel. It ensures all necessary dependencies are met and installs a version of genomepy greater than or equal to 0.15. Bioconda is a popular channel for bioinformatics software. ```bash conda install -c conda-forge -c bioconda 'genomepy>=0.15' ``` -------------------------------- ### Installing a Genome from a Specific Provider Source: https://github.com/vanheeringen-lab/genomepy/blob/master/README.md This command installs the `xenTro9` genome, explicitly specifying `UCSC` as the provider using the `-p` or `--provider` option. This ensures the genome is downloaded from the intended source, overriding `genomepy`'s default provider selection. ```bash $ genomepy install xenTro9 -p UCSC Downloading genome from http://hgdownload.soe.ucsc.edu/goldenPath/xenTro9/bigZips/xenTro9.fa.gz... Genome download successful, starting post processing... name: xenTro9 local name: xenTro9 fasta: ~/.local/share/genomes/xenTro9/xenTro9.fa ``` -------------------------------- ### Displaying genomepy Command Line Help Source: https://github.com/vanheeringen-lab/genomepy/blob/master/README.md This command displays the main help message for the `genomepy` command-line interface, listing available options and subcommands. It provides a quick overview of `genomepy`'s capabilities, including managing configurations, listing genomes, installing, and searching, along with options for version and help. ```bash genomepy --help Usage: genomepy [OPTIONS] COMMAND [ARGS]... Options: --version Show the version and exit. -h, --help Show this message and exit. Commands: annotation show 1st lines of each annotation clean remove provider data config manage configuration genomes list available genomes install install a genome & run active plugins plugin manage plugins providers list available providers search search for genomes ``` -------------------------------- ### Installing Genome with BGZIP Compression Source: https://github.com/vanheeringen-lab/genomepy/blob/master/README.md This command installs the `hg38` genome and compresses the downloaded data using `bgzip` with the `--bgzip` (or `-b`) option. This helps conserve disk space by storing the genome in a compressed format, which is often indexed for efficient access. ```bash $ genomepy install hg38 --bgzip ``` -------------------------------- ### Listing Locally Installed Genomes (Python) Source: https://github.com/vanheeringen-lab/genomepy/blob/master/docs/content/api_core.rst This function provides a list of all genomes that have been previously downloaded and installed locally using genomepy, helping users review their local genomic data collection. ```Python def list_installed_genomes(): # Returns a list of locally installed genomes. pass ``` -------------------------------- ### Testing PyPI Release Candidate (Shell/Python) Source: https://github.com/vanheeringen-lab/genomepy/blob/master/docs/release_checklist.md This comprehensive snippet builds the Python package, uploads it to the Test PyPI repository, uninstalls any existing `genomepy` version, installs the release candidate from Test PyPI, and then runs various `genomepy` commands to verify its functionality, including version checks, help messages, and different installation scenarios. ```shell python -m build # twine must be up to date (3.3.0 works). System installed twine can interfere. twine upload --repository-url https://test.pypi.org/legacy/ dist/genomepy-${new_version}* pip uninstall genomepy # the \ is to escape the ==, so the variable ${new_version} can be called pip install --extra-index-url https://test.pypi.org/simple/ genomepy\==${new_version} # tests genomepy --version genomepy --help genomepy install --help genomepy clean genomepy search xenopus_tropicalis genomepy annotation hg38 genomepy annotation GRCh38.p14 genomepy install -af -p gencode GRCm39 genomepy install -af -p ensembl TAIR10 genomepy install -af -p ucsc sacCer3 --UCSC-annotation ensGene genomepy install -af -p ncbi ASM2732v1 genomepy install -af -p url -l url_test https://ftp.ncbi.nlm.nih.gov/genomes/all/GCF/000/027/325/GCF_000027325.1_ASM2732v1/GCF_000027325.1_ASM2732v1_genomic.fna.gz --URL-to-annotation https://ftp.ncbi.nlm.nih.gov/genomes/all/GCF/000/027/325/GCF_000027325.1_ASM2732v1/GCF_000027325.1_ASM2732v1_genomic.gff.gz genomepy install -af -p local -l local_test ~/.local/share/genomes/TAIR10/TAIR10.fa --Local-path-to-annotation ~/.local/share/genomes/TAIR10/TAIR10.annotation.gtf ``` -------------------------------- ### Interacting with Installed Genomes (Python) Source: https://github.com/vanheeringen-lab/genomepy/blob/master/docs/content/api_core.rst The `Genome` class provides an interface to browse sequences and metadata of an installed genome. It extends `pyfaidx.Fasta` and offers methods to retrieve specific sequences and save them to files. ```Python class Genome(pyfaidx.Fasta): # Represents an installed genome, providing access to sequences and metadata. def close(self): # Closes the genome file. pass def get_random_sequences(self, n: int): # Retrieves n random sequences from the genome. pass def get_seq(self, chrom: str, start: int, end: int): # Retrieves a specific sequence by chromosome, start, and end coordinates. pass def get_spliced_seq(self, chrom: str, exons: list): # Retrieves a spliced sequence based on exon coordinates. pass def items(self): # Returns an iterable of (chromosome, sequence) pairs. pass def keys(self): # Returns an iterable of chromosome names. pass def track2fasta(self, track_file: str, output_file: str): # Converts a track file (e.g., BED) to a FASTA file of corresponding sequences. pass def values(self): # Returns an iterable of sequences. pass # Attributes gaps: dict plugin: object sizes: dict genomes_dir: str name: str genome_file: str genome_dir: str index_file: str sizes_file: str gaps_file: str annotation_gtf_file: str annotation_bed_file: str readme_file: str ``` -------------------------------- ### Installing Genome to a Custom Directory Source: https://github.com/vanheeringen-lab/genomepy/blob/master/README.md This command installs the `sacCer3` genome from UCSC into a user-specified directory, `/path/to/my/genomes`, using the `-g` or `--genomes_dir` option. This allows users to override the default genome storage location configured in `genomepy`. ```bash $ genomepy install sacCer3 -p UCSC -g /path/to/my/genomes Downloading genome from http://hgdownload.soe.ucsc.edu/goldenPath/sacCer3/bigZips/chromFa.tar.gz... Genome download successful, starting post processing... name: sacCer3 local name: sacCer3 fasta: /path/to/my/genomes/sacCer3/sacCer3.fa ``` -------------------------------- ### Installing Aligner Tools with Conda (Bash) Source: https://github.com/vanheeringen-lab/genomepy/blob/master/README.md This command demonstrates how to install required aligner tools like BWA and STAR using Conda from the Bioconda channel. These tools are prerequisites for genomepy's aligner indexing functionality. ```bash conda install -c bioconda bwa star ``` -------------------------------- ### Starting Git Flow Release (Shell) Source: https://github.com/vanheeringen-lab/genomepy/blob/master/docs/release_checklist.md This command sequence initializes a new release branch using `git flow`, setting the specified `new_version` as the release candidate identifier. ```shell new_version=0.0.0 echo ${new_version} git flow release start ${new_version} ``` -------------------------------- ### Managing Genomepy Configuration (Python) Source: https://github.com/vanheeringen-lab/genomepy/blob/master/docs/content/api_core.rst This function provides tools to find and inspect the genomepy configuration, allowing users to set default paths for installed genomes and other settings. ```Python def manage_config(): # Manages genomepy configuration settings. pass ``` -------------------------------- ### Installing UCSC Genome with Specific Annotation Type Source: https://github.com/vanheeringen-lab/genomepy/blob/master/README.md This command installs the `xenTro9` genome from UCSC and specifies `refGene` as the desired annotation type. This option allows for fine-grained control over the annotation data downloaded from the UCSC provider. ```bash $ genomepy install xenTro9 --UCSC-annotation refGene ``` -------------------------------- ### Extracting Gene Coordinates from Annotation DataFrame (Python) Source: https://github.com/vanheeringen-lab/genomepy/blob/master/README.md Building on the `genomepy.Annotation` object, this code demonstrates how to extract specific genomic coordinates (start, end, and chromosome) for a gene (e.g., "TP63") from the `named_gtf` pandas DataFrame. It uses `.loc` for label-based indexing and `min()`/`max()` to get the full gene span. ```Python start = a.named_gtf.loc["TP63"]["start"].min() end = a.named_gtf.loc["TP63"]["end"].max() chrom = a.named_gtf.loc["TP63"]["seqname"][0] ``` -------------------------------- ### Installing Genome with Regex Filtering Source: https://github.com/vanheeringen-lab/genomepy/blob/master/README.md This command installs the `hg38` genome from UCSC, applying a regular expression `'chr[0-9XY]+$'` to filter sequences. Only sequences matching this pattern (e.g., major chromosomes) will be saved, demonstrating how to selectively include or exclude parts of the genome. ```bash $ genomepy install hg38 -p UCSC -r 'chr[0-9XY]+$' Downloading genome from from http://hgdownload.soe.ucsc.edu/goldenPath/hg38/bigZips/hg38.fa.gz... Genome download successful, starting post processing... name: hg38 local name: hg38 fasta: /data/genomes/hg38/hg38.fa $ grep ">" /data/genomes/hg38/hg38.fa >chr1 >chr10 >chr11 >chr12 >chr13 >chr14 >chr15 >chr16 >chr17 >chr18 >chr19 >chr2 >chr20 >chr21 >chr22 >chr3 >chr4 >chr5 >chr6 >chr7 >chr8 >chr9 >chrX >chrY ``` -------------------------------- ### Updating Core Mamba Environment (Shell) Source: https://github.com/vanheeringen-lab/genomepy/blob/master/docs/README.md Updates or creates the primary Mamba environment based on the dependencies specified in `environment.yml`. This ensures all core project dependencies are correctly installed and up-to-date. ```Shell mamba env update --file environment.yml ``` -------------------------------- ### Installing Genome with Hard Masking Source: https://github.com/vanheeringen-lab/genomepy/blob/master/README.md This command installs the `hg38` genome with hard masking applied, using the `--mask hard` option. Hard masking replaces repetitive sequences with 'N' characters, which can be useful for certain downstream analyses where soft masking (lowercase characters) is not sufficient. ```bash $ genomepy install hg38 --mask hard ``` -------------------------------- ### Accessing Genome Sequences with genomepy.Genome (Python) Source: https://github.com/vanheeringen-lab/genomepy/blob/master/README.md This snippet shows how to load an installed genome into a `genomepy.Genome` object, which builds on `pyfaidx.Fasta`. It then demonstrates how to retrieve a specific genomic sequence segment using chromosome name and start/end coordinates, similar to slicing a string. ```Python g = genomepy.Genome("hg38", genomes_dir="./data/genomes") g[chrom][start:end] ``` -------------------------------- ### Searching for Genomes with genomepy CLI Source: https://github.com/vanheeringen-lab/genomepy/blob/master/README.md This command uses the `genomepy search` utility to find available genome assemblies, in this case, for 'zebrafish'. It outputs a table with genome details like name, provider, accession, tax_id, annotation status, species, and other information, helping users identify the correct genome name for installation. ```bash genomepy search zebrafish ``` -------------------------------- ### Searching Genomes & Annotations with Genomepy (Bash) Source: https://github.com/vanheeringen-lab/genomepy/blob/master/README.md This command searches for available genomes and gene annotations using `genomepy`. It allows searching by species name, taxonomy ID, or assembly accession ID. The output provides details such as name, provider, accession, tax ID, annotation availability (n, r, e, k for UCSC), species, and other info. Users can limit results by provider or get genome sizes. ```bash $ genomepy search xenopus tro name provider accession tax_id annotation species other_info n r e k Xenopus_tropicalis_v9.1 Ensembl GCA_000004195.3 8364 ✓ Xenopus tropicalis 2019-04-Ensembl/2019-12 xenTro1 UCSC na 8364 ✗ ✗ ✗ ✗ Xenopus tropicalis Oct. 2004 (JGI 3.0/xenTro1) xenTro2 UCSC na 8364 ✗ ✓ ✓ ✗ Xenopus tropicalis Aug. 2005 (JGI 4.1/xenTro2) xenTro3 UCSC GCA_000004195.1 8364 ✗ ✓ ✓ ✗ Xenopus tropicalis Nov. 2009 (JGI 4.2/xenTro3) xenTro7 UCSC GCA_000004195.2 8364 ✓ ✓ ✗ ✗ Xenopus tropicalis Sep. 2012 (JGI 7.0/xenTro7) xenTro9 UCSC GCA_000004195.3 8364 ✓ ✓ ✓ ✗ Xenopus tropicalis Jul. 2016 (Xenopus_tropicalis_v9.1/xenTro9) Xtropicalis_v7 NCBI GCF_000004195.2 8364 ✓ Xenopus tropicalis DOE Joint Genome Institute Xenopus_tropicalis_v9.1 NCBI GCF_000004195.3 8364 ✓ Xenopus tropicalis DOE Joint Genome Institute UCB_Xtro_10.0 NCBI GCF_000004195.4 8364 ✓ Xenopus tropicalis University of California, Berkeley ASM1336827v1 NCBI GCA_013368275.1 8364 ✗ Xenopus tropicalis Southern University of Science and Technology ^ Use name for genomepy install ``` -------------------------------- ### Accessing Gene Annotations with genomepy.Annotation (Python) Source: https://github.com/vanheeringen-lab/genomepy/blob/master/README.md This snippet illustrates how to load a previously installed genome's annotation data into a `genomepy.Annotation` object. It then demonstrates accessing the `named_gtf` attribute, which is a pandas DataFrame containing GTF information, and displaying its first three rows. ```Python a = genomepy.Annotation("hg38", genomes_dir="./data/genomes") a.named_gtf.head(3) ``` -------------------------------- ### Building Sphinx Documentation (Shell) Source: https://github.com/vanheeringen-lab/genomepy/blob/master/docs/README.md Executes the Sphinx build process, compiling documentation from the `docs` source directory into the `build` output directory. The `-W` flag promotes warnings to errors, ensuring strict adherence to documentation standards. ```Shell sphinx-build docs build -W ``` -------------------------------- ### Listing Available Genome Providers (Bash) Source: https://github.com/vanheeringen-lab/genomepy/blob/master/README.md This command lists all genome providers supported by genomepy, such as GENCODE, Ensembl, UCSC, NCBI, Local, and URL. This helps users identify potential sources for genome downloads. ```bash $ genomepy providers GENCODE Ensembl UCSC NCBI Local URL ``` -------------------------------- ### Uploading Package to PyPI (Shell) Source: https://github.com/vanheeringen-lab/genomepy/blob/master/docs/release_checklist.md This snippet builds the final distribution package and then uploads it to the official PyPI repository using `twine`, making the new `genomepy` version publicly available. ```shell python -m build twine upload dist/genomepy-${new_version}* ``` -------------------------------- ### Managing Genomepy Plugins (Python) Source: https://github.com/vanheeringen-lab/genomepy/blob/master/docs/content/api_core.rst This function allows users to manage genomepy plugins, which extend functionality for tasks like downloading sequence blacklists or creating aligner indexes. Rerunning `install_genome` after plugin changes will only process new parts. ```Python def manage_plugins(): # Manages genomepy plugins. pass ``` -------------------------------- ### Generating a New genomepy Configuration (Command Line) Source: https://github.com/vanheeringen-lab/genomepy/blob/master/README.md This command-line snippet demonstrates how to generate a new configuration file for genomepy. This is useful for recovering from corrupted configuration files or setting up a new configuration. ```Bash genomepy config generate ``` -------------------------------- ### Managing Genomepy Plugins (Shell) Source: https://github.com/vanheeringen-lab/genomepy/blob/master/docs/content/config.rst These commands are used to interact with Genomepy's plugin system. 'genomepy plugin show' displays available plugin options, while 'genomepy plugin' provides functionality to easily modify the list of active plugins. ```Shell genomepy plugin show ``` ```Shell genomepy plugin ``` -------------------------------- ### Pushing Release to GitHub (Shell) Source: https://github.com/vanheeringen-lab/genomepy/blob/master/docs/release_checklist.md This command pushes all local branches and associated tags to the `origin` remote, ensuring the `develop` and `master` branches, along with the new release tag, are synchronized with GitHub. ```shell git push --follow-tags origin develop master ``` -------------------------------- ### Updating Documentation Mamba Environment (Shell) Source: https://github.com/vanheeringen-lab/genomepy/blob/master/docs/README.md Updates or creates a Mamba environment specifically for documentation-related dependencies, using the `docs/requirements.yaml` file. This isolates documentation build tools from core project dependencies. ```Shell mamba env update --file docs/requirements.yaml ``` -------------------------------- ### Listing Genomes from a Specific Provider (Bash) Source: https://github.com/vanheeringen-lab/genomepy/blob/master/README.md This command lists available genomes specifically from the UCSC provider, along with details like accession, taxonomy ID, annotation status, and species. The `--size` option can be added to show genome sizes, though it slows down the search. ```bash $ genomepy genomes -p UCSC name provider accession tax_id annotation species other_info n r e k ailMel1 UCSC GCF_000004335.2 9646 ✓ ✗ ✓ ✗ Ailuropoda melanoleuca Dec. 2009 (BGI-Shenzhen 1.0/ailMel1) allMis1 UCSC GCA_000281125.1 8496 ✗ ✓ ✗ ✗ Alligator mississippiensis Aug. 2012 (allMis0.2/allMis1) anoCar1 UCSC na 28377 ✗ ✗ ✓ ✗ Anolis carolinensis Feb. 2007 (Broad/anoCar1) ``` -------------------------------- ### Running Genomepy Tests (Shell) Source: https://github.com/vanheeringen-lab/genomepy/blob/master/docs/release_checklist.md This snippet updates the Conda environment and runs all `pytest` tests with verbose output to ensure all functionalities are working correctly before a release. ```shell mamba env update -f environment.yml pytest -vvv ``` -------------------------------- ### Enabling a genomepy Plugin Source: https://github.com/vanheeringen-lab/genomepy/blob/master/README.md This command enables the `blacklist` plugin within `genomepy`, which allows for the download of genome blacklists for supported organisms. Plugins extend `genomepy`'s functionality and can be activated or deactivated as needed. ```bash $ genomepy plugin enable blacklist Enabled plugins: blacklist ``` -------------------------------- ### Listing Available Data Providers (Python) Source: https://github.com/vanheeringen-lab/genomepy/blob/master/docs/content/api_core.rst This function lists all data providers that genomepy can access for genomic data. It helps users discover available sources for their searches. ```Python def list_providers(): # Returns a list of all available data providers. pass ``` -------------------------------- ### Listing All Available Genomes (Python) Source: https://github.com/vanheeringen-lab/genomepy/blob/master/docs/content/api_core.rst This function retrieves a comprehensive list of all genomes available through genomepy's configured providers. Be aware that this list can be very extensive. ```Python def list_available_genomes(): # Returns a list of all genomes available for download. pass ``` -------------------------------- ### Enabling Aligner Plugins in Genomepy (Bash) Source: https://github.com/vanheeringen-lab/genomepy/blob/master/README.md This command enables the BWA and STAR aligner plugins within genomepy, allowing the tool to create indexes for these aligners. The output confirms the successfully enabled plugins. ```bash $ genomepy plugin enable bwa star Enabled plugins: blacklist, bwa, star ``` -------------------------------- ### Running Local Tests with Pytest - Bash Source: https://github.com/vanheeringen-lab/genomepy/blob/master/README.md This command is used to execute the test suite for the genomepy project. The `-vvv` flag enables very verbose output, providing detailed information about each test run, which is useful for debugging and verifying changes during development. ```bash pytest -vvv ``` -------------------------------- ### Finishing Git Flow Release (Shell) Source: https://github.com/vanheeringen-lab/genomepy/blob/master/docs/release_checklist.md This command completes the `git flow` release process, merging the release branch into `master` and `develop` and tagging the release version. ```shell git flow release finish ${new_version} ``` -------------------------------- ### Listing Online Data Providers (Python) Source: https://github.com/vanheeringen-lab/genomepy/blob/master/docs/content/api_core.rst This function specifically lists data providers that are currently accessible online. It's useful for checking active sources for genomic data. ```Python def list_online_providers(): # Returns a list of online data providers. pass ``` -------------------------------- ### Generating Genomepy Configuration File (Bash) Source: https://github.com/vanheeringen-lab/genomepy/blob/master/README.md This command generates the default genomepy configuration file, typically located in `~/.config/genomepy/genomepy.yaml`. This file can then be edited to customize default settings for genomepy. ```bash $ genomepy config generate Created config file ~/.config/genomepy/genomepy.yaml ``` -------------------------------- ### Enabling Bgzip Compression in Genomepy (YAML) Source: https://github.com/vanheeringen-lab/genomepy/blob/master/README.md This YAML snippet configures genomepy to store downloaded FASTA files using bgzip compression, which reduces disk space usage. This setting is applied in the `~/.config/genomepy/genomepy.yaml` file. ```yaml bgzip: True ``` -------------------------------- ### Inspecting Gene Annotations with Genomepy (Bash) Source: https://github.com/vanheeringen-lab/genomepy/blob/master/README.md This command allows users to inspect the available gene annotations for a specific genome, in this case, `xenTro9` from the `UCSC` provider. It displays a preview of different annotation types (ncbiRefSeq, refGene, ensGene) to help users choose the most suitable one based on content, such as the presence of HGNC gene names. ```bash $ genomepy annotation xenTro9 -p ucsc 12:04:41 | INFO | UCSC ncbiRefSeq chr1 genomepy transcript 133270 152620 . - . gene_id "LOC100490505"; transcript_id "XM_012956089.1"; gene_name "LOC100490505"; chr1 genomepy exon 133270 134186 . - . gene_id "LOC100490505"; transcript_id "XM_012956089.1"; exon_number "1"; exon_id "XM_012956089.1.1"; gene_name "LOC100490505"; 12:04:45 | INFO | UCSC refGene chr1 genomepy transcript 193109390 193134311 . + . gene_id "pias2"; transcript_id "NM_001078987"; gene_name "pias2"; chr1 genomepy exon 193109390 193109458 . + . gene_id "pias2"; transcript_id "NM_001078987"; exon_number "1"; exon_id "NM_001078987.1"; gene_name "pias2"; 12:04:49 | INFO | UCSC ensGene chr1 genomepy transcript 133270 152620 . - . gene_id "ENSXETG00000030302.2"; transcript_id "ENSXETT00000061673.2"; gene_name "ENSXETG00000030302.2"; chr1 genomepy exon 133270 134186 . - . gene_id "ENSXETG00000030302.2"; transcript_id "ENSXETT00000061673.2"; exon_number "1"; exon_id "ENSXETT00000061673.2.1"; gene_name "ENSXETG00000030302.2"; ``` -------------------------------- ### Searching for Genomes with genomepy.search (Python) Source: https://github.com/vanheeringen-lab/genomepy/blob/master/README.md This snippet demonstrates how to use the `genomepy.search()` function to find available genomes from various providers. It iterates through the search results, printing details for each matching genome, such as name, provider, assembly ID, and species. ```Python import genomepy for row in genomepy.search("GRCh38"): print(row) ``` -------------------------------- ### Creating GTF Annotation File (Bash) Source: https://github.com/vanheeringen-lab/genomepy/blob/master/tests/data/sanitize/README.txt This snippet demonstrates how to create a sanitized GTF annotation file by extracting the first and last four lines from an existing GTF file. This is useful for creating small test files without processing the entire large annotation. ```bash tail -n 4 GRCz11.annotation.gtf > tests/data/sanitize/sanitize.annotation.gtf head -n 4 GRCz11.annotation.gtf >> tests/data/sanitize/sanitize.annotation.gtf ``` -------------------------------- ### Creating Sanitized FASTA Sequence File (Bash) Source: https://github.com/vanheeringen-lab/genomepy/blob/master/tests/data/sanitize/README.txt This snippet extracts a specific sequence (NC_007112.7) from a larger FASTA file and appends a short DNA sequence (ACTG) to it. This is used to create a small, specific FASTA file for testing purposes. ```bash cat GRCz11.fa | grep "NC_007112.7" > tests/data/sanitize/sanitize.fa echo ACTG >> tests/data/sanitize/sanitize.fa ``` -------------------------------- ### Generating a New genomepy Configuration (Python API) Source: https://github.com/vanheeringen-lab/genomepy/blob/master/README.md This snippet shows how to generate a new configuration file for genomepy using the `genomepy.manage_config()` function with the "generate" argument. This is useful for recovering from corrupted configuration files. ```Python genomepy.manage_config("generate") ``` -------------------------------- ### Managing Genomepy Configuration File (Shell) Source: https://github.com/vanheeringen-lab/genomepy/blob/master/docs/content/config.rst These commands allow users to generate a new default configuration file for Genomepy or to locate the path of the currently active configuration file. The configuration file is used to customize various Genomepy options. ```Shell genomepy config generate ``` ```Shell genomepy config file ``` -------------------------------- ### Generating BED Annotation from GTF (Python) Source: https://github.com/vanheeringen-lab/genomepy/blob/master/tests/data/sanitize/README.txt This snippet uses a GenomePy utility function to convert a GTF annotation file into a BED format file. It requires the input GTF file path and specifies the output BED file path for the conversion. ```python genomepy.annotation.utils.generate_annot("tests/data/sanitize/sanitize.annotation.gtf", "tests/data/sanitize/sanitize.annotation.bed") ``` -------------------------------- ### Configuring Genome Directory in Genomepy (YAML) Source: https://github.com/vanheeringen-lab/genomepy/blob/master/README.md This YAML snippet shows how to change the default genome storage directory to `/data/genomes` within the `~/.config/genomepy/genomepy.yaml` configuration file. This customizes where downloaded genomes are saved. ```yaml genomes_dir: /data/genomes ``` -------------------------------- ### YAML Configuration Key-Value Pair (YAML) Source: https://github.com/vanheeringen-lab/genomepy/blob/master/docs/content/config.rst This snippet illustrates the basic key-value pair format used in Genomepy's YAML configuration file. Each configurable option is defined by a 'key' followed by a colon and its 'value'. Comments are denoted by a '#' symbol. ```YAML key: value ``` -------------------------------- ### Converting to Sequence Dictionary (Python) Source: https://github.com/vanheeringen-lab/genomepy/blob/master/docs/content/api_core.rst The `as_seqdict` function converts various inputs into a sequence dictionary format. It must be explicitly imported from `genomepy.seq` to be used. ```Python from genomepy.seq import as_seqdict def as_seqdict(input_data): # Converts various inputs into a sequence dictionary. pass ``` -------------------------------- ### Calculating Tarball SHA256 Checksum (Shell) Source: https://github.com/vanheeringen-lab/genomepy/blob/master/docs/release_checklist.md This command computes the SHA256 checksum of the `genomepy` release tarball, which is necessary for updating the Bioconda recipe to ensure package integrity. ```shell sha256sum *genomepy-${new_version}.tar.gz ``` -------------------------------- ### Configuring Python Path for Sphinx Autodoc (Python) Source: https://github.com/vanheeringen-lab/genomepy/blob/master/docs/README.md This Python line, typically found in `conf.py`, modifies `sys.path` to include the parent directory of the current file. This is crucial for Sphinx's `autodoc` extension to correctly locate and import modules from the project's root for documentation generation. ```Python sys.path.insert(0, os.path.abspath('..')) ``` -------------------------------- ### Inspecting Gene Annotations (Python) Source: https://github.com/vanheeringen-lab/genomepy/blob/master/docs/content/api_core.rst This function allows users to inspect the quality and details of gene annotations for specific genome assemblies, helping to differentiate between similar genome versions. ```Python def head_annotations(genome_name: str): # Displays the head of gene annotation files for a given genome. pass ``` -------------------------------- ### Searching Genomic Data (Python) Source: https://github.com/vanheeringen-lab/genomepy/blob/master/docs/content/api_core.rst This function allows users to search for specific genomes or gene annotations across one or all configured data providers. It supports advanced filtering by specifying a provider. ```Python def search(query: str, provider: str = None): # Searches for genomic data based on a query. pass ``` -------------------------------- ### Subsetting sacCer3 Genome and Annotation with genomepy (Python) Source: https://github.com/vanheeringen-lab/genomepy/blob/master/tests/data/sacCer3/README.txt This Python script demonstrates how to subset the sacCer3 genome and its associated annotation files (BED and GTF) to a specific chromosome ('chrIV') and a limited set of genes using the genomepy library. It reads existing annotation, filters it, and writes the filtered data back to new files, then filters the FASTA file. ```Python import genomepy import csv a = genomepy.Annotation("sacCer3", "tests/data") bed = a.bed bed = bed[bed.chrom == "chrIV"] genes = list(set(bed.name))[0:50] bed = bed[bed.name.isin(genes)] genomepy.annotations.utils.write_annot( bed, "tests/data/sacCer3/sacCer3.annotation.bed" ) gtf = a.gtf gtf = gtf[gtf.seqname == "chrIV"] gtf = gtf[gtf.attribute.str.contains('|'.join(genes))] genomepy.annotations.utils.write_annot( gtf, "tests/data/sacCer3/sacCer3.annotation.gtf" ) genomepy.files.filter_fasta("tests/data/sacCer3/sacCer3.fa", "chrIV", outfa="tests/data/sacCer3/sacCer3.fa") ``` -------------------------------- ### Cleaning Local genomepy Data (Python API) Source: https://github.com/vanheeringen-lab/genomepy/blob/master/README.md This snippet shows how to clear locally stored provider data and cached information using the `genomepy.clean()` function in Python. This is useful for resolving issues related to outdated or corrupted provider data. ```Python genomepy.clean() ``` -------------------------------- ### Filtering FASTA Files (Python) Source: https://github.com/vanheeringen-lab/genomepy/blob/master/docs/content/api_core.rst This non-core function, located in `genomepy.files`, allows filtering a FASTA file by chromosome name using regular expressions, writing the output directly to another FASTA file. ```Python from genomepy.files import filter_fasta def filter_fasta(input_fasta: str, output_fasta: str, regex: str): # Filters a FASTA file by chromosome name using regex. pass ``` -------------------------------- ### Subsetting GRCz11 Genome Annotations with Python Source: https://github.com/vanheeringen-lab/genomepy/blob/master/tests/data/GRCz11/README.txt This Python script uses the genomepy library to load GRCz11 genome annotations, filter out scaffold chromosomes (those containing 'K'), and then subset the data to include only the first 5 genes per chromosome for both BED and GTF formats. Finally, it writes the processed annotations to new files in a specified directory. This is useful for creating smaller, manageable annotation files for testing or specific analyses. ```python import genomepy import csv a = genomepy.Annotation("GRCz11", "tests/data") bed = a.bed bed = bed[~bed.chrom.str.contains("K")] # drop scaffolds bed = bed.groupby(["chrom"]).head(5) # subset to 5 genes per chromosome genomepy.annotations.utils.write_annot( bed, "tests/data/GRCz11/GRCz11.annotation.bed" ) gtf = a.gtf gtf = gtf[~gtf.seqname.str.contains("K")] # drop scaffolds gtf = gtf.groupby(["seqname"]).head(5) # subset to 5 genes per chromosome genomepy.annotations.utils.write_annot( gtf, "tests/data/GRCz11/GRCz11.annotation.gtf" ) ``` -------------------------------- ### Clearing Genomepy Cache (Python) Source: https://github.com/vanheeringen-lab/genomepy/blob/master/docs/content/api_core.rst This function clears the genomepy cache, which can be useful for resolving persistent issues or errors by resetting the cached data. ```Python def clean(): # Clears the genomepy cache. pass ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.