Here is an example of plotting 4 venn diagrams in a single screen with a 2*2 layout.


library(VennDiagram)

#defining vectors
av<- 1:10
bv<- 12:20
cv<-  7:15

# Building venndiagram grid objects (i.e. gList)
a<- venn.diagram(list(av= av, bv=bv), filename=NULL, main="VD1")
b<- venn.diagram(list(av=av, cv=cv), filename=NULL, main="VD2")
c<- venn.diagram(list(bv=bv, cv=cv), filename=NULL, main="VD3")
d<- venn.diagram(list(av=av, cv=cv), filename=NULL, main="VD4")

# Draw the diagrams
pushViewport(plotViewport(layout=grid.layout(2, 2)))
pushViewport(plotViewport(layout.pos.col=1, layout.pos.row=1))
grid.draw(a)
popViewport()
pushViewport(plotViewport(layout.pos.col=2, layout.pos.row=1))
grid.draw(b)
popViewport()
pushViewport(plotViewport(layout.pos.col=1, layout.pos.row=2))
grid.draw(c)
popViewport()
pushViewport(plotViewport(layout.pos.col=2, layout.pos.row=2))
grid.draw(d)



1

View comments

plotting individual values within multiple groups together with their means
In this post I show how groupScatterPlot(), function of the rnatoolbox R package can be used for plotting the individual values in several groups together with their mean (or other statistics). I think this is a useful function for plotting grouped data when some groups (or all groups) have few data points ! You may be wondering why to include such function in the rnatoolbox package ?! Well ! I happen to use it quit a bit for plotting expression values of different groups of genes/transcripts in a sample or expression levels of a specific gene/transcript in several sample groups. These expression value are either FPKM, TPM, LCPM, or PSI values (Maybe I should go through these different normalizations later in a different post 😐!). But of course its application is not restricted to gene expression or RNAseq data analysis.
Inferring the sex of the subjects from RNAseq BAM files
2
In this post I show how classifySex(), function of the rnatoolbox R package can be used for inferring the sex of  the studied subjects from their binary alignment bam files. The sex can be a source of unwanted variation within the data, for which you may want to adjust your differential gene expression or splicing analysis. However, complete  metadata are unfortunately not always available. Furthermore, sometimes details within metadata are incorrect or have been misplaced due to manual error. Therefore, it is a good practice to quickly double check some details within the data to either complete the missing metadata information or to make sure that the prior stages have been performed without any accidental mix-ups. For muscle tissues, this showed to be useful on our ribo-depleted RNAseq data. NOTE! Earlier the function referred to in this post was named differently(i.e. getGender). Since version 0.2.1 classifySex() is used.
Assessing the number of mapped reads in several bam files
Recently I have started to organize my commonly used functions related to quality assessment and analyzing RNAseq data into an R package. It is called rnatoolbox and it is available here. In this post I introduce getMappedReadsCount(), i.e. a function that can be used for checking the number of aligned/mapped fragments in several bam files and detecting the outliers. The outliers are the bam files with oddly high (i.e. exceeding1.5 times the interquartile) and oddly low (i.e. lower than 1.5 times the interquartile) number of mapped fragments.
adhan package: retrieving and aligning the prayer times in R
Hierarchical clustering, cutting the tree and colouring the tree leaves based on sample classes
MD5 for large files, and folders with subfolders and many files
Correlation in R ( NA friendliness, accepting matrix as input, returning p values, visualization, and Pearson vs Spearman)
2
Many times, in our projects, we may need to compare different measured factors in our samples to one another, and study whether they are linearly dependent. These information can also help us to detect covariates and factors that affect our studies but we would like to adjust for/remove their effects (more on this at sometime later). Here, I mention several functions that can be used to perform correlation tests. All of these functions do support both Pearson and ranked (Spearman) methods. Note that in the end of this post I will focus on these two different methods (i.e. Pearson vs Spearman) and show their differences in application.
Maintining the data frame fromat when indexing
Occasionally when indexing data frames the format is converted, leading to confusing consequences. As for instance, when indexing to select a single column the result is a 'numeric' or 'integer' vector. The following  demonstrates this :
Venus (female) and Mars (male) symbols in R plot - using Unicode
Plotting multiple Venndiagram (or diagrams) in single screen
1
Axis break in R for line plot
Espresso coffee so far consumed in our lab
Merging PDFs in Linux
1
Detecting U12-type introns using IntEREst R/Biocondcutor package
Modifying read names in fastq and bam files
Example of a fastq file in read 1 (in paired read sequencing) is as follows: @SRR3117565.1.1 1 length=100 NCAAAACAGCTCTCCCTCCTTTGATCTGATGGTCTGCAGAGGTCCTCAAATCCACACACTGCCACTCTTCAAGACCAACCACTGGGCCTTCTTAATCTCA +SRR3117565.1.1 1 length=100 #1=BDDDDHFHHAHDE?GFEEDHG@HFHEECDCGHE:FDFHD*?DHFDEHHF>;;B<;A;>=A=??@CCCC>5>>AC @SRR3117565.2.1 2 length=100 NTCCTGACTCACACGCCACAACCATGACTGGCTCAGCTCCCTTAATTCCAGCTTCCCTTACATGACGCAATTCCTTCTCAGATTCGGGTTTTCAGCTGAG +SRR3117565.2.1 2 length=100 #4BDFFFFHHHHHJJJJJJJJJJJJJJJJJJJJJJIJJJJJJJJJJJJJJJJJJJJJJJJJJJJJIHHFEFEEEEEEDDEDDDDDDDDBDDDDDDDDDDD
Analyzing RNA-seq data (DEG, Alt. splicing and splicing efficiency analysis)
Adding a text to sequence names of a fasta file using R
The daRk knight Rises
Yesterday (on the opening day of the new Batman movie) I search the Internet for the Batman formula and it's implementations in R. I found several links that used the ggplot2 library however only one was working with the latest version of the package. With minor changes, this is the result that I got for the Batman curve.
gacatag
Labels
Blog Archive
About Me
About Me
My Photo
I am a Postdoc researcher at the Neuromuscular Disorders Research lab and Genetic Determinants of Osteoporosis Research lab, in University of Helsinki and Folkhälsan RC. I specialize in Bioinformatics. I am interested in Machine learning and multi-omics data analysis. My go-to programming language is R.
My Blog List
My Blog List
Loading
Dynamic Views theme. Powered by Blogger. Report Abuse.