### Install RIdeogram from GitHub Source: https://github.com/tickingclock1992/rideogram/blob/master/README.md This snippet demonstrates how to install the RIdeogram package from its GitHub repository. It requires the devtools package to be installed and loaded first. ```R install.packages("devtools") library(devtools) devtools::install_github('TickingClock1992/RIdeogram') ``` -------------------------------- ### Install RIdeogram from CRAN Source: https://github.com/tickingclock1992/rideogram/blob/master/README.md This snippet shows the standard method for installing the RIdeogram package directly from the CRAN repository. ```R install.packages("RIdeogram") ``` -------------------------------- ### Visualize Genomic Data with Line and Polygon Labels Source: https://context7.com/tickingclock1992/rideogram/llms.txt Illustrates the creation of idiograms using line and polygon track labels to represent continuous genomic data such as population statistics. This includes examples for single and dual-track comparisons. ```R library(RIdeogram) data(liriodendron_karyotype, package = "RIdeogram") data(Fst_between_CE_and_CW, package = "RIdeogram") data(Pi_for_CE, package = "RIdeogram") # Line label visualization ideogram( karyotype = liriodendron_karyotype, overlaid = Fst_between_CE_and_CW, label = Pi_for_CE, label_type = "line", colorset1 = c("#e5f5f9", "#99d8c9", "#2ca25f") ) convertSVG("chromosome.svg", device = "png") # Polygon label visualization ideogram( karyotype = liriodendron_karyotype, overlaid = Fst_between_CE_and_CW, label = Pi_for_CE, label_type = "polygon", colorset1 = c("#e5f5f9", "#99d8c9", "#2ca25f") ) convertSVG("chromosome.svg", device = "png") ``` -------------------------------- ### R: Define Karyotype Data Frames for RIdeogram Source: https://context7.com/tickingclock1992/rideogram/llms.txt Demonstrates the creation of R data frames for karyotype data, supporting both basic (Chr, Start, End) and full (including centromere positions) formats required by RIdeogram. ```r library(RIdeogram) # --- Karyotype Data Format --- # Basic format (3 columns) - no centromere information karyotype_basic <- data.frame( Chr = c("1", "2", "3"), Start = c(1, 1, 1), End = c(248956422, 242193529, 198295559) ) # Full format (5 columns) - with centromere positions karyotype_full <- data.frame( Chr = c("1", "2", "3"), Start = c(1, 1, 1), End = c(248956422, 242193529, 198295559), CE_start = c(122026459, 92188145, 90772458), CE_end = c(124932724, 94090557, 93655574) ) ``` -------------------------------- ### R: Define Heatmap Data Frame for RIdeogram Source: https://context7.com/tickingclock1992/rideogram/llms.txt Illustrates the structure of an R data frame for heatmap data, which includes chromosome, start and end positions, and a value for overlaying on RIdeogram visualizations. ```r # --- Heatmap (Overlaid) Data Format --- # 4 columns: Chr, Start, End, Value heatmap_data <- data.frame( Chr = c("1", "1", "1", "2", "2"), Start = c(1, 1000001, 2000001, 1, 1000001), End = c(1000000, 2000000, 3000000, 1000000, 2000000), Value = c(87, 103, 45, 92, 78) ) ``` -------------------------------- ### R: Define Line/Polygon Label Data Frames for RIdeogram Source: https://context7.com/tickingclock1992/rideogram/llms.txt Provides examples of R data frames for line or polygon labels in RIdeogram, supporting both single value (with color) and dual values (with two colors) for genomic tracks. ```r # --- Line/Polygon Label Data Format --- # Single value (5 columns): Chr, Start, End, Value, Color line_data_single <- data.frame( Chr = c("1", "1", "1"), Start = c(1, 1000001, 2000001), End = c(1000000, 2000000, 3000000), Value = c(0.0012, 0.0015, 0.0009), Color = c("4daf4a", "4daf4a", "4daf4a") ) # Dual values (7 columns): Chr, Start, End, Value_1, Color_1, Value_2, Color_2 line_data_dual <- data.frame( Chr = c("1", "1", "1"), Start = c(1, 1000001, 2000001), End = c(1000000, 2000000, 3000000), Value_1 = c(0.0012, 0.0015, 0.0009), Color_1 = c("4daf4a", "4daf4a", "4daf4a"), Value_2 = c(0.0008, 0.0011, 0.0007), Color_2 = c("984ea3", "984ea3", "984ea3") ) ``` -------------------------------- ### Generate Basic and Heatmap Chromosome Idiograms Source: https://context7.com/tickingclock1992/rideogram/llms.txt Demonstrates how to initialize an idiogram using karyotype data and overlay gene density heatmaps or marker labels. It also shows the usage of the convertSVG function to export the generated SVG to PNG format. ```R library(RIdeogram) data(human_karyotype, package = "RIdeogram") data(gene_density, package = "RIdeogram") data(Random_RNAs_500, package = "RIdeogram") # Basic idiogram ideogram(karyotype = human_karyotype) convertSVG("chromosome.svg", device = "png") # Idiogram with heatmap and markers ideogram( karyotype = human_karyotype, overlaid = gene_density, label = Random_RNAs_500, label_type = "marker", colorset1 = c("#fc8d59", "#ffffbf", "#91bfdb") ) convertSVG("chromosome.svg", device = "png") ``` -------------------------------- ### R: Load Data from Text Files for RIdeogram Source: https://context7.com/tickingclock1992/rideogram/llms.txt Demonstrates how to load various RIdeogram data formats (karyotype, heatmap, markers) from tab-delimited text files into R data frames using the `read.table` function. ```r # Load from text files karyotype <- read.table("karyotype.txt", sep = "\t", header = TRUE, stringsAsFactors = FALSE) heatmap <- read.table("gene_density.txt", sep = "\t", header = TRUE, stringsAsFactors = FALSE) markers <- read.table("markers.txt", sep = "\t", header = TRUE, stringsAsFactors = FALSE) ``` -------------------------------- ### Visualize Genomic Synteny with RIdeogram Source: https://context7.com/tickingclock1992/rideogram/llms.txt Generates synteny visualizations between two or three genomes using bezier curves. It requires specific karyotype and synteny data structures to map homologous regions across species. ```R library(RIdeogram) # Dual Genome Comparison data(karyotype_dual_comparison, package = "RIdeogram") data(synteny_dual_comparison, package = "RIdeogram") ideogram(karyotype = karyotype_dual_comparison, synteny = synteny_dual_comparison) convertSVG("chromosome.svg", device = "png") # Ternary Genome Comparison data(karyotype_ternary_comparison, package = "RIdeogram") data(synteny_ternary_comparison, package = "RIdeogram") ideogram(karyotype = karyotype_ternary_comparison, synteny = synteny_ternary_comparison) convertSVG("chromosome.svg", device = "png") ``` -------------------------------- ### Extract Feature Density from GFF Files Source: https://context7.com/tickingclock1992/rideogram/llms.txt Processes GFF annotation files to calculate genomic feature density (e.g., gene density) in defined window sizes. The output is formatted for use as an overlay in RIdeogram visualizations. ```R library(RIdeogram) # Extract gene density from GFF3 file gene_density <- GFFex( input = "gencode.v32.annotation.gff3.gz", karyotype = "human_karyotype.txt", feature = "gene", window = 1000000 ) # Use extracted density data in ideogram ideogram(karyotype = human_karyotype, overlaid = gene_density) convertSVG("chromosome.svg", device = "png") ``` -------------------------------- ### ideogram - Generate Genome Synteny Visualization Source: https://context7.com/tickingclock1992/rideogram/llms.txt Generates a visual representation of genomic synteny (conserved gene order) using karyotype and synteny data. Supports dual and ternary genome comparisons with optional gradient-filled curves. ```APIDOC ## ideogram(karyotype, synteny, ...) ### Description Generates a visualization of synteny relationships between two or three genomes using bezier curves. It requires pre-formatted karyotype and synteny data frames. ### Method Function Call ### Parameters #### Arguments - **karyotype** (data.frame) - Required - Data frame containing chromosome information (Chr, Start, End, fill, species, size, color). - **synteny** (data.frame) - Required - Data frame containing homologous region coordinates between species. ### Request Example ideogram(karyotype = karyotype_data, synteny = synteny_data) ### Response #### Success Response - **Output** (file) - Generates 'chromosome.svg' in the working directory. ``` -------------------------------- ### Convert SVG Visualizations to Image Formats Source: https://context7.com/tickingclock1992/rideogram/llms.txt Converts generated SVG chromosome plots into common image formats like PNG, PDF, TIFF, and JPG. Supports custom dimensions and resolution settings for high-quality output. ```R library(RIdeogram) # Convert to PDF with custom dimensions convertSVG( svg = "chromosome.svg", file = "chromosome_output", device = "pdf", width = 8.2677, height = 11.6929, dpi = 300 ) # Shortcut functions svg2png("chromosome.svg", file = "my_output", dpi = 600) ``` -------------------------------- ### convertSVG - Convert SVG to Image Formats Source: https://context7.com/tickingclock1992/rideogram/llms.txt Converts generated SVG chromosome visualizations into common image formats like PNG, PDF, TIFF, or JPG with support for custom resolution and dimensions. ```APIDOC ## convertSVG(svg, file, device, width, height, dpi) ### Description Converts an existing SVG file into a specified raster or vector image format. ### Method Function Call ### Parameters #### Arguments - **svg** (string) - Required - Path to the input SVG file. - **device** (string) - Required - Target format: 'png', 'pdf', 'tiff', or 'jpg'. - **dpi** (numeric) - Optional - Resolution in dots per inch. - **width/height** (numeric) - Optional - Dimensions in inches. ### Request Example convertSVG("chromosome.svg", device = "png", dpi = 300) ### Response #### Success Response - **Output** (file) - Saves the converted image file to the disk. ``` -------------------------------- ### R: Define Marker Label Data Frame for RIdeogram Source: https://context7.com/tickingclock1992/rideogram/llms.txt Shows how to create an R data frame for marker labels in RIdeogram, specifying type, shape, chromosome, start/end positions, and color for genomic features. ```r # --- Marker Label Data Format --- # 6 columns: Type, Shape, Chr, Start, End, color marker_data <- data.frame( Type = c("RNA1", "RNA2", "RNA3"), Shape = c("circle", "box", "triangle"), # Available shapes Chr = c("1", "1", "2"), Start = c(5000000, 15000000, 8000000), End = c(5500000, 15500000, 8500000), color = c("e41a1c", "377eb8", "4daf4a") # Hex colors without # ) ``` -------------------------------- ### GFFex - Extract Feature Density Source: https://context7.com/tickingclock1992/rideogram/llms.txt Parses GFF annotation files to calculate the density of specific genomic features (e.g., genes, retrotransposons) across defined windows, suitable for heatmap overlays. ```APIDOC ## GFFex(input, karyotype, feature, window) ### Description Processes a GFF3 file to extract counts of a specific feature type within fixed-size genomic windows. ### Method Function Call ### Parameters #### Arguments - **input** (string) - Required - Path to the GFF3 file. - **karyotype** (string) - Required - Path to the karyotype definition file. - **feature** (string) - Required - The feature type to count (e.g., 'gene'). - **window** (numeric) - Required - Window size in base pairs. ### Request Example GFFex(input = "data.gff3", karyotype = "karyotype.txt", feature = "gene", window = 1000000) ### Response #### Success Response - **data.frame** (object) - Returns a data frame with columns: Chr, Start, End, Value. ``` -------------------------------- ### R: Define Synteny Data Frames for RIdeogram Source: https://context7.com/tickingclock1992/rideogram/llms.txt Shows R data frame structures for synteny comparisons in RIdeogram, including formats for dual-species comparison (linking regions) and synteny karyotype representation. ```r # --- Synteny Data Format (Dual Comparison) --- # 7 columns for 2-species comparison synteny_dual <- data.frame( Species1_Chr = c("1", "1", "2"), Species1_Start = c(15600, 250000, 50000), Species1_End = c(18700, 280000, 75000), Species2_Chr = c("1", "2", "1"), Species2_Start = c(10500, 120000, 200000), Species2_End = c(12000, 145000, 220000), fill = c("cccccc", "cccccc", "e41a1c") # Use "gradient" for gradient fill ) # --- Synteny Karyotype Format --- # 7 columns: Chr, Start, End, fill, species, size, color synteny_karyotype <- data.frame( Chr = c("1", "2", "1", "2"), Start = c(1, 1, 1, 1), End = c(23037639, 18779844, 50000000, 45000000), fill = c("969696", "969696", "969696", "969696"), species = c("Grape", "Grape", "Populus", "Populus"), size = c(12, 12, 12, 12), color = c("252525", "252525", "252525", "252525") ) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.