Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

682 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🐝 chromR

R GitHub code size in bytes GitHub last commit GitHub

🐝 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.

πŸ“– Features

πŸ“Š Visualization Option

  • Plot genes, domains, or specific regions on chromosomes or contigs.
  • Highlight specific genes, regions, or domains using keyword filtering.
  • 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)

🎨 Color Customization

  • Define colors for categories using R color names (e.g., "black") or hex codes (e.g., #1f77b4).
  • Support for RColorBrewer palettes via palette

πŸ“ Data Handling

  • Accepts standard GFF (General Feature Format) files as input gff_file.
  • Support for fill files fill_file in CSV/TSV formats.
  • Export processed data as tables in CSV or TSV formats CSV/TSV with table

πŸ” Filtering Option

  • Strict mode strict to 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

βš™οΈ Integration & Compatibility

  • πŸš€ Command-Line Friendly. Run directly from the terminal or integrate into pipelines.
  • πŸ–₯️ RStudio Compatible. Easy to modify, debug, or execute within RStudio.

πŸ–ΌοΈ Example Output

  • 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

Figure 1.

Figure 2.

πŸ§ͺ Installation

1. Clone this repository:

git clone https://github.com/mathiashole/chromR.git
cd chromR

2. Install required R packages:

Open R or RStudio and run:

install.packages(c("dplyr", "readr", "ggplot2", "yaml"))

πŸ”§ Usage

Requirements:

Ensure the following R packages are installed: dplyr, readr, ggplot2

Execution Options:

1. Using the Terminal

  • Navigate to the folder containing chromR.R and execute the script with the necessary arguments:
Rscript chromR.R --gff_file </path/to/file.gff> --keywords <keyword1> <keyword2> --colors <color1>

2. Using RStudio

  • Open chromR.R in RStudio.
  • Set the arguments manually in the script or pass them interactively.

βš™οΈ Arguments and configurations

Command-line arguments

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 configuration options

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").

πŸ’‘ Bash Quick Examples

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>

πŸ’‘ R Quick Examples

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)

πŸ’– Contributing

We welcome contributions!

  • :octocat: 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.

🚧 Roadmap

See the full roadmap here roadmap

πŸ“œ License

MIT Β© Mathias Mangino

About

Chromosome plot

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages