Set Operations with freeCount

R-bloggers 2025-12-15

[This article was first published on R – Myscape, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Overview

In general, set operations are very useful for comparing lists of things. These lists can contain any strings, such as gene or species names.

Set operations are also a good way to identify unique or shared genes across sets of analysis results. The freeCount SO app will help you perform set operations with gene lists, which can be produced from differential expression or network analysis.

Potential Questions

What shared genes are driving the patterns of DE in all genotypes?

What genes are driving the patterns of DE across treatments?

Which DE genes share patterns of co-expression in a given network module?

Learning Goals

  • Learn how to perform set operations with ggVennDiagram
  • Practice comparing lists of gene names
  • Understand how to identify shared and unique genes

Related

This tutorial is the fifth in a series on omics data analysis:

  1. Differential Expression Analysis with freeCount
  2. Functional Analysis with freeCount
  3. Network Analysis with freeCount
  4. Functional Analysis of Networks with freeCount

ggVennDiagram

The ggVennDiagram R package enables fancy Venn plots with 2-7 sets and generates publication quality figures. It also support upset plots with unlimited number of sets from version 1.4.4.


Before Starting

The exercise in this tutorial will be using the freeCount apps in RStudio on a personal computer. Make sure that you have the following tools downloaded, installed, and up-to-date on your personal computer:

  1. R software environment
  2. RStudio desktop application

For Windows users, additionally install RTools.

It is also possible to run the freeCount apps online through Posit Cloud. To see how, checkout the freeCount Bioinformatics Analysis Apps on Posit Cloud tutorial.

Input Data

  1. Download the tribolium gene list 1 file
  2. Download the tribolium gene list 2 file
  3. Download the tribolium gene list 3 file
  4. Download the tribolium gene list 4 file

Tip! After clicking the above linked data, right click and select Save As… to download the above files in the necessary formats.


The Analysis App

The following steps show you how to get and start running the freeCount set operations (SO) app.

  1. Download the freeCount R Shiny applications
    1. Go to https://github.com/ElizabethBrooks/freeCount
    2. Click the green < > Code button
    3. Click Download ZIP
  2. Extract the freeCount-main directory 
  3. Navigate to the apps directory
  4. Open the SO.R file in RStudio
  5. Click Install on the yellow banner to install the necessary R packages (or run the code on lines 10 to 15)
  6. Click the Run App button in the upper right corner of the source pane

Analysis Process

Perform the following steps to make a

  1. Upload the four data sets
  2. Download the two-way venn diagram results
  3. Dowload the three-way venn diagram results
  4. Download the four-way venn diagram results

1. Upload Data

Upload the data sets (lists) that you want to compare.

Input Data

  1. First, upload a file with the list of things that you want to compare. These lists can contain can be any strings, such as gene or species names. In this tutorial we are using the tribolium gene list 1 file.
  2. Next, upload the second file with a list. In this tutorial we are using the tribolium gene list 2 file. After upload the second file, analysis results will begin to appear. You can also continue to upload sets/lists that you want to compare (up to 4 sets).
  3. Third, upload the third file with a list. In this tutorial we are using the tribolium gene list 3 file.
  4. Finally, upload the fourth file with a list. In this tutorial we are using the tribolium gene list 4 file. Up to 4 sets can be compared with the freeCount SO app.

Note that the gene names in these files are actually IDs that are specific to the species and database.

2. Download Two-Way Venn

Download the two-way venn diagram results from the Venn Diagrams tab.

Under each venn diagram are drop down lists and download buttons, which allow you to export specific set intersections. This will allow you to select unique or shared gene lists across the sets that you are comparing.

3. Download Three-Way Venn

Download the three-way venn diagram results from the Venn Diagrams tab.

4. Download Four-Way Venn

Download the four-way venn diagram results from the Venn Diagrams tab.

To leave a comment for the author, please follow the link and comment on their blog: R – Myscape.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Continue reading: Set Operations with freeCount