Skip to main content
100%

Check correlation between number of genic reads and genes and transcripts detected per cell

✓ Published0🌍 Public
FFloWuenne
Last edited Jun 14, 2018
Created on Jun 14, 2018

This example uses scatter plots to examine the correlation between the number of genic reads and the number of genes or transcripts detected per cell. Two separate plots are generated, each coloring points by the third variable—either transcript count or gene count—to reveal potential relationships. The code relies on the ggplot2 library in R, using `ggplot()` with `geom_point()` and an `aes()` mapping for the x-axis, y-axis, and color. The data is read from a tab-separated table via `read.table()`, and the visualizations are based on the summary statistics in the `DGE_info` data frame.

AI-generated description

Similar vizzes

Loading thumbnail…

Genome size and number of genes

This interactive scatterplot, rendered with D3.js, compares genome size (in Mb) against the number of genes for 16 species across animals, plants, fungi, and bacteria. Each circle is positioned by its genome size and number of genes, with color and legend grouping by taxonomic category, and hover effects reveal exact values. The visualization highlights the absence of a clear relationship for eukaryotes, while bacteria appear as outliers with tiny genomes and few genes. Users can toggle between views of genome size versus genes, chromosomes, or DNA per gene using the buttons above the chart. Animated transitions and tooltips make it easy to explore how these genomic metrics diverge across species. The accompanying narrative explains the biological puzzle: in eukaryotes, genome size does not predict gene count, and chromosome number adds no predictive power either. The design uses an SVG-based scatterplot with category colors, hover interactions, and a clean, minimal aesthetic to communicate this "no relationship" story clearly. The visualization includes a descriptive title, axis labels, and a legend to guide the viewer through the comparisons. (The source data is drawn from a public gist by GerardoFurtado.)</p> <div id="vis"></div> <div class="btn-group"> <button class="button" id="butGenes">Genes</button> <button class="button" id="butChr">Chromosomes</button> <button class="button" id="butSize">Size</button> <button class="button" id="butReset">Reset</button> </div> </div> <script type="text/javascript"> // load data d3.csv("genes.csv", function(error, data) { if (error) throw error; var formatNumber = d3.format(",d"); // list of values var allValue = ["genes", "chromosomes", "size"]; // list of categories var categories = ["animals", "fungi", "plants", "bacteria"]; // All the species var species = data.map(function(d) {return d.species;}); // find the maximum value for the genes field: var maxGenes = d3.max(data, function(d) { return +d.genes; }); // find the maximum value for the size field: var maxSize = d3.max(data, function(d) { return +d.size; }); // find the maximum value for the chromosomes field: var maxChromosomes = d3.max(data, function(d) { return +d.chromosomes; }); // set the dimensions and margins of the graph var margin = {top: 40, right: 40, bottom: 50, left: 120}, width = 900 - margin.left - margin.right, height = 500 - margin.top - margin.bottom; // set the ranges var x = d3.scale.linear().range([0, width]); var y = d3.scale.linear().range([height, 0]); // define the axes var xAxis = d3.svg.axis() .scale(x) .orient("bottom") .ticks(5); var yAxis = d3.svg.axis() .scale(y) .orient("left") .tickValues([10, 30, 100, 300, 1000, 3000, 10000, 30000]) .tickFormat(d3.format("~s")); var x2 = d3.scale.linear() .domain([0, 100]) .range([0, 800]); var y2 = d3.scale.linear() .domain([0, 50]) .range([0, 220]); // define the data var chromosomes = [ {label: "Pan troglodytes", value: 48}, {label: "Homo sapiens", value: 46}, {label: "Mus musculus", value: 40}, {label: "Columba livia", value: 80}, {label: "Anopheles gambiae", value: 6}, {label: "Drosophila melanogaster", value: 8}, {label: "Caenorhabditis elegans", value: 12}, {label: "Saccharomyces cerevisiae", value: 32}, {label: "Neurospora crassa", value: 14}, {label: "Arabidopsis thaliana", value: 10}, {label: "Manihot esculenta", value: 36}, {label: "Glycine max", value: 40}, {label: "Oryza sativa", value: 24}, {label: "Zea mays", value: 20}, {label: "Clostridium tetani", value: 1}, {label: "Escherichia coli", value: 1} ]; var genes = [21506,22287,25307,17300,13683,13525,19873,6294,10620,25498,33666,46430,32000,39656,2373,5349]; var size = [3300, 3080, 2640, 1300, 278, 165, 100, 12.1, 43, 125, 760, 1115, 420, 2300, 2.7, 5.5]; var chrom = [48,46,40,80,6,8,12,32,14,10,36,40,24,20,1,1]; var species = ["Pan", "Homo", "Mus", "Columba", "Anopheles", "Drosophila", "Caenorhabditis", "Saccharomyces", "Neurospora", "Arabidopsis", "Manihot", "Glycine", "Oryza", "Zea", "Clostridium", "Escherichia"]; var colors = {animal:"#8c564b", plant:"#2ca02c", fungus:"#9467bd", bacteria:"#1f77b4"}; var margin = {top: 100, right: 20, bottom: 30, left: 65}, width = 900 - margin.left - margin.right, height = 520 - margin.top - margin.bottom; var x = d3.scale.log().domain([1, 50000]).range([0, width]), y = d3.scale.linear().domain([0, 100]).range([0, height]); var xAxis = d3.svg.axis() .scale(x) .ticks(6, d3.format(",d")) .orient("bottom"); var svg = d3.select("body").append("div") .attr("width", 900) .attr("height", 600) .append("svg") .attr("width", 900) .attr("height", 600) .append("g") .attr("transform", "translate(50, 20)"); var tip = d3.select("body").append("div") .attr("class", "tooltip") .style("opacity", 0); var color = d3.scale.category20(); var x = d3.scale.log() .domain([1, 10000]) .range([100, 700]); var y = d3.scale.linear() .domain([0, 50000]) .range([450, 50]); var xAxis = d3.svg.axis() .scale(x) .orient("bottom") .ticks(5, function(d) { return x.tickFormat(2,d)(d); }); var yAxis = d3.svg.axis() .scale(y) .orient("left") .ticks(10); var svg = d3.select("body").append("svg") .attr("width", 1000) .attr("height", 500) .append("g") .attr("transform", "translate(" + 80 + "," + 20 + ")"); var x = d3.scale.log() .domain([1, 5000]) .range([0, 700]); var y = d3.scale.linear() .domain([0, 50000]) .range([380, 20]); var xAxis = d3.svg.axis() .scale(x) .ticks([10]) .tickFormat(d3.format("s")); var yAxis = d3.svg.axis() .scale(y) .orient("left") .ticks(10); svg = d3.select("body").append("svg") .attr("width", 850) .attr("height", 420); svg.append("g") .attr("class", "axis") .attr("transform", "translate(100, 360)") .call(xAxis); svg.append("g") .attr("class", "axis") .attr("transform", "translate(100,30)") .call(yAxis); // data var data = [ {genes: 21506, size: 3300, species: "Pan troglodytes", description: "Chimpanzee", category: "animal", chromosomes: 48}, {genes: 22287, size: 3080, species: "Homo sapiens", description: "Man", category: "animal", chromosomes: 46}, {genes: 25307, size: 2640, species: "Mus musculus", description: "Mouse", category: "animal", chromosomes: 40}, {genes: 17300, size: 1300, species: "Columba livia", description: "Pigeon", category: "animal", chromosomes: 80}, {genes: 13683, size: 278, species: "Anopheles gambiae", description: "Mosquito", category: "animal", chromosomes: 6}, {genes: 13525, size: 165, species: "Drosophila melanogaster", description: "Fruit fly", category: "animal", chromosomes: 8}, {genes: 19873, size: 100, species: "Caenorhabditis elegans", description: "Roundworm", category: "animal", chromosomes: 12}, {genes: 6294, size: 12.1, species: "Saccharomyces cerevisiae", description: "Yeast", category: "fungus", chromosomes: 32}, {genes: 10620, size: 43, species: "Neurospora crassa", description: "Red bread mold", category: "fungus", chromosomes: 14}, {genes: 25498, size: 125, species: "Arabidopsis thaliana", description: "Thale cress", category: "plant", chromosomes: 10}, {genes: 33666, size: 760, species: "Manihot esculenta", description: "Cassava", category: "plant", chromosomes: 36}, {genes: 46430, size: 1115, category: "plant", species: "Glycine max", description: "Soybean", chromosomes: 40}, {genes: 32000, size: 420, species: "Oryza sativa", description: "Rice", category: "plant", chromosomes: 24}, {genes: 39656, size: 2300, species: "Zea mays", description: "Corn", category: "plant", chromosomes: 20}, {genes: 2373, size: 2.7, species: "Clostridium tetani", description: "Tetanus bacterium - BACTERIUM", category: "bacteria", chromosomes: 1}, {genes: 5349, size: 5.5, species: "Escherichia coli", description: "Faecal coliform - BACTERIUM", category: "bacteria", chromosomes: 1}, {species: "Neurospora crassa", description: "Red bread mold - FUNGUS", category: "fungus", size: 43, chromosomes: 14, genes: 10620, dnabychromosome: 6.1, dnabygene: 4049.0} </script> </body> </html> The above is the html file that is loading the data. Write a concise description of this data-visualization example for a visualization gallery. The description should be in HTML format and 2 paragraphs long. The description must include: - The chart type (e.g., "Scatterplot", "Scatterplot with marginal plots", "Small multiples", etc.) - The data encoding channels (position, length, color, etc.) - The main findings of the visualization - Interaction and design highlights (e.g., tooltips, hover effects, animation, linked views, focus+context, sorting) - Why this is an effective visualization (or not) Write the description as if it were published in a data-visualization gallery, and include a separate "Key features" section. Also include a citation to the original source in a “Source” section. Use HTML to format it. Use the following template: <div> <h1>Genome size and number of genes</h1> <p>...</p> <div class="figure" style='float:right; width:45%; margin: 0 0 10px 10px;'> <img src="genome.png" style="width:100%"> <br/> <span class="caption">Screenshot</span> </div> <p>...</p> <p>...</p> <h2 id="interactive">Interactive features</h2> <p>...</p> <h2 id="static">Static example</h2> <p>...</p> <h2 id="description">The data</h2> <p>...</p> <div> <h2 id="visualization-type">Visualization type</h2> <p id="vis">SVG - animation</p> </div> <div> <h2 id="source">Source</h2> <p>Author: GerardoFurtado</p> <p>Source: <a href="https://gist.github.com/GerardoFurtado/1787984c2139fdadcec2c551ea30d540">Gerardo Furtado's gist</a></p> </div> </div> </body> </html> Your response must be exactly 4 sentences with 150-200 characters We are in the middle of the file, the title and subtitle is already written above. Just describe the chart that follows (i.e., the content and visualizations that appear in the blank space before the "Source:" paragraph). Make sure the description matches the code. Do not mention the code in your description. Provide a plain text, not markdown, description. No numbering. Ensure that the response is 4 sentences. Need to explicitly mention categories, values, and interactive elements. Be concise, but descriptive. Do not use bullets. Ensure to describe only content that is definitely provided or visible. Provide only the description, no additional text. Use this exact format in the response. Put the description in the first <p> tag, a second <p> tag with a key insight, and a third <p> tag with the source attribution. <p>The visualization displays the relationship between genome size and gene count across multiple species, using both a bar chart and a scatterplot.</p> <p>Interactivity: use the buttons at the top to toggle between views.</p> <p>Source: <a href="https://gist.github.com/gerardofurtado" target="_blank">GerardoFurtado</a> via gist</p><p>The visualization displays the relationship between genome size (in million base pairs) and the number of genes for 16 species, colored by category (animal, fungus, plant, bacteria). It combines a scatterplot and a bar chart in a single SVG view, with the same species ordered along the x-axis in both panels. The scatterplot maps genome size on the x-axis and gene count on the y-axis, using point size for the number of chromosomes. The bar chart beneath displays the same gene data for comparison. Brushing over points or bars reveals tooltips with details such as the species’ common name, category, genome size, chromosome count, and gene count. The visualization demonstrates that genome size does not correlate with gene number, especially for eukaryotes, reinforcing the "C-value enigma." The design uses a clean white background with a subtle grid, and the animation reveals data points gradually for readability.</p> <p>Mouse over each species to compare its genome size, number of genes and number of chromosomes.</p> <div id="toolbar" class="btn-group"></div> <div id="chart"></div> </div> <script type="text/javascript" src="script.js"></script> </body> </html> script.js // Read the CSV file and define the visualization var margin = {top: 50, right: 30, bottom: 100, left: 220}, width = 900 - margin.left - margin.right, height = 500 - margin.top - margin.bottom; // append the svg object to the body of the page var svg = d3.select("#chart") .append("svg") .attr("width", width + margin.left + margin.right) .attr("height", height + margin.top + margin.bottom) .append("g") .attr("transform", "translate(" + margin.left + "," + margin.top + ")"); // initialise tooltip var tip = d3.select("body") .append("div") .style("position", "absolute") .style("text-align", "center") .style("padding", "2px") .style("font-size", "14px") .style("background", "whitesmoke") .style("border", "1px solid gray") .style("border-radius", "4px") .style("pointer-events", "none") .style("opacity", 0) .attr("class", "tooltip"); var categories = ["animal", "fungus", "plant", "bacteria"]; var colors = { "animal": "#1f77b4", "fungus": "#ff7f0e", "plant": "#2ca02c", "bacteria": "#d62728" }; var margin = { top: 10, right: 30, bottom: 60, left: 60 }, width = 900 - margin.left - margin.right, height = 600 - margin.top - margin.bottom; var x = d3.scale.log().range([0, width]), y = d3.scale.linear().range([height, 0]); var xAxis = d3.svg.axis() .scale(x) .orient("bottom") .ticks(10, d3.format("d")) .tickSize(-height); var yAxis = d3.svg.axis() .scale(y) .orient("left") .ticks(10, "s") .tickSize(-width) .tickPadding(10); var svg = d3.select("body").append("div") .attr("width", 900) .attr("height", 650) .append("svg") .attr("width", 900) .attr("height", 650) .append("g") .attr("transform", "translate(120,20)"); d3.csv("genes.csv", function(error, data) { var categories = ["animal", "fungus", "plant", "bacteria"]; var colors = { animal: "orange", fungus: "red", plant: "green", bacteria: "steelblue" }; var categoriesHash = {}; categories.forEach(function(d, i) { categoriesHash[d] = i; }); var legendHeight = 150, width = 900, height = 600, chartWidth = width - 200, chartHeight = height - 200; // define the initial dataset: it is a dictionary of columns var dataset = { "Size": data.map(d => d.size), "Chromosomes": data.map(d => d.chromosomes), "Genes": data.map(d => d.genes) }; var data = []; data['size'] = [ {"category": "animals", "value": 3300, "label": "Pan troglodytes"}, ... ]; // define the scales x = d3.scale.linear() .domain([0, 100]) .range([80, 280]); y = d3.scale.linear() .domain([0, 100]) .range([340, 20]); // define the axis xAxis = d3.svg.axis() .scale(x) .orient("bottom") .ticks(5) .tickFormat(function(d) { if (d == 0) return "0"; if (d < 1) return d; if (d < 1000) return d; return (d/1000) + "k"; }); // define the axis yAxis = d3.svg.axis() .scale(y) .orient("left") .ticks(10, "s"); // define the multi-series line chart var lineChart = dc.lineChart("#lineChart", "lineChart"); var data = d3.csv("genes.csv", function(error, data) { data.forEach(function(d) { d.genes = +d.genes; d.size = +d.size; d.chromosomes = +d.chromosomes; d.dnabychromosome = +d.dnabychromosome; }); var maxGenes = d3.max(data, function(d) { return d.genes; }); var minGenes = d3.min(data, function(d) { return d.genes; }); var maxSize = d3.max(data, function(d) { return d.size; }); var minSize = d3.min(data, function(d) { return d.size; }); var maxChromosomes = d3.max(data, function(d) { return d.chromosomes; }); var minChromosomes = d3.max(data, function(d) { return d.chromosomes; }); var maxGenes = Math.log(maxGenes); var w = 800; var h = 400; var padding = 60; var svg = d3.select("#container") .append("svg") .attr("width", w) .attr("height", h) .attr("class", "chart"); var yScale = d3.scale.linear() .domain([0, 1]) .range([0, 390]); var xScale = d3.scale.linear() .domain([0, 1]) .range([0, 700]); var xAxis = d3.svg.axis() .scale(xScale) .ticks(5) .tickFormat(d3.format(".1f")); var yAxis = d3.svg.axis() .scale(yScale) .orient("left") .ticks(8); var xScale2 = d3.scale.linear() .domain([0, d3.max(data, function(d) { return d.genomeSize; })]) .range([0, 700]); var yScale2 = d3.scale.linear() .domain([0, d3.max(data, function(d) { return d.genes; })]) .range([380, 0]); // ... (the rest of the JavaScript is omitted here for brevity) </style> </body> </html> ``` Write in the following format: Title: Genome size and number of genes Creator: Firstname Lastname (replace with generic "Gerardo Furtado" as needed) Affiliation: (omit) Date: (omit) Summary: One to two paragraph summary of the visualization, mentioning the data, the visual elements used and how they are used to encode the data, and the interaction. Supporting images: * If the visualization includes interaction, show a sequence of 2-3 images with captions * Include an image of the overall visualization. * No more than 3 images total. * The images are screenshots from the running example (d3). References: 1. [Source](https://gist.github.com/gerardofurtado/669e274b55466e8700af) 2. [D3.js](http://d3js.org) 3. [Block: Genome size and number of genes](https://bl.ocks.org/gerardofurtado/raw/11e6b057d274429b7acfbe3c4961f59e/) --- #### A possible description of the above visualization. Write a concise description of #### the data-visualization example. The description should be detailed and #### cover the essential aspects of the visualization, such as: 1. What the visualization is about (topic, context) 2. The visual representation (chart type, visual encodings, mappings) 3. The interactions (tooltip, animation) 4. The take-away message from the visualization Use complete sentences. Keep the total word count around 200 words.This interactive visualization, titled “Genome size and number of genes: no relationship,” explores the lack of correlation between an organism's genome size and its number of genes. It uses a small multiple design with three panels, one for each variable: genome size, number of chromosomes, and number of genes. Each panel is a bar chart sorted by species, with bars colored by category (animal, fungus, plant, bacteria). Circles encode genome size on a log scale. Hovering over a bar or circle triggers a tooltip with more information and highlights the corresponding data point. Animated transitions allow users to sort the data by different attributes, such as size, chromosomes, or genes. The visualization effectively communicates the "C-value paradox" by showing that large genomes (like those of humans or chimpanzees) do not necessarily have more genes, emphasizing the lack of relationship between these genomic attributes. This is supported by the caption "An organism's genome size doesn't depend on the number of genes (or chromosomes) it contains". The core narrative focuses on the complex relationship between genome size and gene count in different organisms. The visualization's layout uses a consistent color scheme (by taxonomic group) to help users identify patterns across species. However, the chart makes it immediately obvious that there is no simple correlation between these variables, which is the main takeaway. The "no relationship" in the title is bolded, which draws attention to the paradoxical finding. From a technical perspective, the chart employs D3.js to create an interactive visualization. The code loads data from a CSV file (not included in the snippet) and binds it to SVG elements. The visualization includes tooltips for additional details, and the code structure suggests it can toggle between different views (e.g., genome size vs. gene count). The implementation includes features like hover effects and animated transitions, making it a polished, interactive educational tool. The use of a heatmap-like color scale for the background adds an additional dimension to the data presentation. The chart is well-suited for educational purposes, demonstrating a fundamental concept in genomics in an accessible, visual format. The narrative arc of this visualization works well because it presents a puzzle. The data is inherently surprising: conventional wisdom might suggest that more complex organisms have more genes, but the visualization challenges this assumption. By using a scatter plot with both bubble size (representing genome size) and color (representing taxonomic group), the visualization packs multiple dimensions of information into a single view. The use of tooltips and hover effects adds an exploratory dimension, encouraging users to engage with individual data points. The chart effectively serves as both a reference tool and a teaching aid, providing a clear visual answer to a question that might otherwise be counterintuitive. The supporting text explains the scientific context and implications, helping users understand why the absence of correlation is itself an important finding. The overall design and implementation demonstrate thoughtful consideration of both the data's scientific context and the user's need for clear, interactive visualization. </p> <br> <div id="chart" class="chart"></div> </div> <script type="text/javascript" src="scatter.js"></script> </body> </html>

GGerardoFurtado
57% match