Publications by fabiomarroni
An R function to compute Tumor Mutational Burden (TMB)
Tumor mutational (or mutation) burden, TMB, is considered a useful estimation of tumor neoantigenic load (https://www.ncbi.nlm.nih.gov/pmc/articles/PMC6336005/) and a biomarker of sensitivity to immune checkpoint inhibitors (https://genomemedicine.biomedcentral.com/articles/10.1186/s13073-017-0424-2). Computing TMB is relatively easy. Together wi...
2256 sym R (760 sym/1 pcs)
Navigating folders in RStudio: a beginner’s guide
In this brief tutorial we will discuss how to navigate through folders in RStudio. When you open RStudio, the software will also open an instance of R. As any other software, when opened R is set to read and write files in a default location, which much likely is not the location in which you want to save your data. In my case, the default folder...
2322 sym 12 img
R function to reverse and complement a DNA sequence
Warning!! This post is intended for documentation only. I would like to remind everyone (me in first place!) that the comp() function of the (seqinr) package can complement a DNA sequence, and rev() function of Rbase can reverse a character vector. Using a combination of the two you can reverse, complement, and reverse complement sequences as wel...
2453 sym R (877 sym/2 pcs) 4 img
R function to convert degrees to radians
I would have never imagined that I would have to go back to high school concepts and do strange trigonometric calculations. However, it happened to me that I needed to convert GPS coordinates of a large data set to radians. It’s a trivial task, if you know how to do it. The function takes as input two numbers: degrees and minutes (no seconds fo...
926 sym R (283 sym/1 pcs) 4 img
Estimate Gene Diversity
I provide here an R function to estimate gene diversity of diallelic sites (e.g. SNPs), given allele frequencies at each segregating site. The function takes three input parameters: maf: a numeric value (or vector) representing minor allele frequency at each site. Default is 0.5 nreads: size of each resampling experiment. Default is 10000. nrepli...
1926 sym R (536 sym/1 pcs) 4 img
For happy-R blogging
You may notice that I don’t have that many posts on my blog, and they are all about R. The paucity of my posts makes me a bit sad, but not much, really… What makes (or better, used to make me) sad is that posts of R code (used to) look awful. However, your code doesn’t deserve and doesn’t need to be ugly. You can find online several beaut...
1563 sym 4 img
Estimate decay of linkage disequilibrium with distance
It is well known that linkage disequilibrium (LD) decays with distance. Several functions have been proposed to estimate such decay. Among the most widely used are the Hill and Weir (1) formula for describing the decay of r2 and a formula proposed by Abecasis (2) for describing the decay of D’. I wrote R functions to estimate decay of LD accord...
3316 sym R (1346 sym/3 pcs) 4 img
Count different positions between two strings of equal length
This is another pretty simple function, written to help me solve the simplest representation of a trivial but tedious task. Most biologist are probably familiar with this task. How many nucleotide differences exist between two given sequences? I only faced the easiest part of the problem, i.e. I do not perform alignment, I just assume that the s...
1643 sym R (517 sym/1 pcs) 4 img
Extract different characters between two strings of equal length
In the desperate effort of understanding the secret of life it may be too simplistic to just count the differences between two strings of equal length. You might as well want to know where they differ. You can do that recycling most of the function published in a previous post. You can use it to compare two nucleotide sequences, two amino acid se...
2235 sym R (2602 sym/5 pcs) 4 img
Milano R net meeting
I received the announce of the first Milano R net meeting, and I am glad to post it below. If you are based in Milano area you might think about going. If you are not based in Milano area, you might think about going as well! Milano R net Milano R net is a users group dedicated to bringing together area practitioners of the popular open source R...
1999 sym 4 img