π chromR is an R script designed for visualizing gene or domain positions on chromosomes or contigs. It allows users to customize their plots using keywords, file-based inputs, and color options, making it ideal for genomic data exploration.
- Plot genes, domains, or specific regions on chromosomes or contigs.
- Highlight specific genes, regions, or domains using
keywordfiltering. - Additional plot types:
line_plot: display features as lines instead of points.accumulated_plot: generate an accumulated gene count plot.(Fig. 2)folded_plot: generate an accumulated gene count plot but folded in center of chromosome.(Fig. 2)
- Define colors for categories using R color names (e.g., "black") or hex codes (e.g., #1f77b4).
- Support for RColorBrewer palettes via
palette
- Accepts standard GFF (General Feature Format) files as input
gff_file. - Support for fill files
fill_filein CSV/TSVformats. - Export processed data as tables in CSV or TSV formats CSV/TSV with
table
- Strict mode
strictto show only chromosomes containing keywords - High point support via layout file
layout - Custom chromosome ordering
order_file - Filter by number of chromosomes to display
number
- π Command-Line Friendly. Run directly from the terminal or integrate into pipelines.
- π₯οΈ RStudio Compatible. Easy to modify, debug, or execute within RStudio.
- Description: This graph shows the position of two transposons in
Saccharomyces cerevisiae R64, Ty1 (Ty1,gene) and TYA (TYA,gene) highlighted in green and orange. - Command used:
Rscript chromR.R -g ../genome/Saccharomyces_cerevisiae.R64-1-1.114.gff3 --keywords Ty1 gene TYA gene
- Genome example: Download Saccharomyces cerevisiae GFF
git clone https://github.com/mathiashole/chromR.git
cd chromR
Open R or RStudio and run:
install.packages(c("dplyr", "readr", "ggplot2", "yaml"))
Ensure the following R packages are installed: dplyr, readr, ggplot2
- Navigate to the folder containing
chromR.Rand execute the script with the necessary arguments:
Rscript chromR.R --gff_file </path/to/file.gff> --keywords <keyword1> <keyword2> --colors <color1>
- Open chromR.R in RStudio.
- Set the arguments manually in the script or pass them interactively.
| Argument | Description | Example |
|---|---|---|
--config / -c |
Path to the YAML configuration file. All program options are read from this file. | Rscript chromR.R --config config.yaml |
| YAML key | Description | Example |
|---|---|---|
gff_file |
Path to the GFF annotation file. | data/genome.gff |
feature_mode |
Feature selection mode (fill or keyword). |
fill |
feature_file |
File containing genomic regions (used with fill mode). |
regions.tsv |
keywords |
Attribute/type pairs used to select features (used with keyword mode). |
["gene", "TYA"] |
strict_filter |
Require exact keyword matching. | true |
max_chromosomes |
Maximum number of chromosomes to plot. | 5 or N |
palette |
Name of an RColorBrewer palette. Ignored if colors is provided. |
Dark2 |
colors |
Custom colors (hex codes or color names). | ["#d95f02", "#1b9e77"] |
line_plot |
Generate a line plot instead of a histogram. | true |
accumulated_plot |
Plot accumulated densities instead of individual densities. | false |
density_mode |
Density representation (hist or density). |
hist |
facet_plot |
Generate faceted plots. | true |
facet_mode |
Facet representation (hist or density). |
hist |
facet_scales |
Scale behavior for facets (fixed or free). |
free |
interactive |
Enable interactive plotting. | false |
window_mode |
Enable sliding-window analysis. | true |
window_size |
Sliding-window size (bp). | 5000 |
gene_list |
List of genes for sliding-window analysis. | ["TYA", "Ty1"] |
min_genes |
Minimum number of genes required per window. | 2 |
π‘ Note: Colors must match the number of keywords provided. They can be standard R color names or hex codes. In the case of hexadecimal colors, they must be put in quotes (e.g. "#F4A582").
Example 1: Basic Plot
Highlight gene1 and CDS in orange:
Rscript chromR.R --gff_file data.gff --keywords gene1 CDS --colors orange
Rscript chromR.R -g </path/of/file.gff> -k <keyword1> <keyword1_asociated> <keyword2> <keyword2_asociated>
If you have any genome data, put this data in TSV or CSV format and use GFF to map the chromosome.
Example 2: Fill data to Plot
Rscript chromR.R --gff_file data.gff --fill_file data_to_fill_information.tsv/.csv --format tsv/csv
Rscript chromR.R -g </path/of/file.gff> -ff <path/of/data_to_fill> -f <tsv/csv>
Example 1: Basic Plot
Highlight gene1 and CDS in orange:
args <- c("chromR.R", "--gff_file", "data.gff", "--keywords", "gene1 CDS", "--colors, "orange")
# Execution command
system2("Rscript", args = args)
If you have any genome data, put this data in TSV or CSV format and use GFF to map the chromosome.
Example 2: Fill data to Plot
args <- c("chromR.R", "--gff_file", "data.gff", "--fill_file", "data_to_fill_information.tsv/.csv", "--format", "tsv/csv")
# Execution command
system2("Rscript", args = args)
We welcome contributions!
Pull requests and π stars are always welcome.- For major changes, please open an issue first to discuss what you would like to change.
- Please make sure to update tests as appropriate.
MIT Β© Mathias Mangino

