code mnemonics

Compilation of useful programming tips that I sometimes need but always forget about.


Roxygen skeleton

To add the roxygen2 skeleton to document a function:

shift+ctrl+alt+r

shift+opt+cmd+r

source


Correspondance between reshape2::melt and tidyr::gather, reshape::dcast and tidyr::spread

library(reshape2)
library(tidyr)
library(dplyr)

mini_iris <- iris[c(1, 51, 101), ]

# melt
melted1 <- mini_iris %>% melt(id.vars = "Species",value.name = 'dimension',variable.name='trait')
melted2 <- mini_iris %>% gather(key='trait', value='dimension', -Species)

# cast
melted1 %>% dcast(Species ~ trait, value.var = "dimension")
melted2 %>% spread(key='trait', value='dimension')

        

 


TO COME…

TryCatch structure

Posted in Sin categoría | Leave a comment

my reference papers

A list of great papers on the disciplines I am most interested in: evolution, ecology, quantitative & population genetics, statistics, bioinformatics.

 

Is adaptation possible in self-fertilizing species?
http://www.sciencedirect.com/science/article/pii/S0168952517300550

Who will adapt to climate change?
https://www.nature.com/nature/journal/v470/n7335/full/nature09670.html

What is a mutation accumulation line?
http://www.annualreviews.org/doi/10.1146/annurev.ecolsys.39.110707.173437

What is the animal model? (LMM)
http://onlinelibrary.wiley.com/doi/10.1111/j.1365-2656.2009.01639.x/full

Under what circumstances SNPs cannot be identified in GWA?
http://www.nature.com/nrg/journal/v13/n2/full/nrg3118.html

What is heritability?
https://www.nature.com/nrg/journal/v9/n4/full/nrg2322.html

What is missing heritability?
https://www.nature.com/ng/journal/v42/n7/full/ng0710-558.html

How to GWA in plants?
http://onlinelibrary.wiley.com/doi/10.1002/cppb.20041/full

What is population stratification correction in GWA? http://www.nature.com/nrg/journal/v11/n7/full/nrg2813.html

What is a meta-GWA?
https://www.nature.com/nrg/journal/v18/n2/full/nrg.2016.142.html

Population structure? F statistics? 
http://www.genetics.org/content/202/4/1485

What is spatial autocorrelation in the data?
http://onlinelibrary.wiley.com/doi/10.1111/j.2007.0906-7590.05171.x/abstract

What is an environmental niche model?
http://onlinelibrary.wiley.com/doi/10.1111/j.1365-2699.2011.02659.x/abstract

What is (really) a selection coefficient?
http://onlinelibrary.wiley.com/doi/10.1111/mec.13559/abstract

What is phenotypic selection?
http://www.jstor.org/stable/2408842

How linkage, inheritance, and sex interfere evolution at multiple locus?
http://www.genetics.org/content/161/4/1727.long

What are the footprints of selection on the genome?
http://www.genetics.org/content/161/4/1727.long

How does multiple testing correction work?
http://www.nature.com/nbt/journal/v27/n12/full/nbt1209-1135.html

What is principal component analysis?
http://www.nature.com/nbt/journal/v26/n3/full/nbt0308-303.html

SNP imputation in association studies
http://www.nature.com/nbt/journal/v27/n4/full/nbt0409-349.html

What is a hidden Markov model?
http://www.nature.com/nbt/journal/v22/n10/full/nbt1004-1315.html

What is a support vector machine?
http://www.nature.com/nbt/journal/v24/n12/full/nbt1206-1565.html

What is the expectation maximization algorithm?
http://www.nature.com/nbt/journal/v26/n8/full/nbt1406.html

What are DNA sequence motifs?
http://www.nature.com/nbt/journal/v24/n4/full/nbt0406-423.html

What are decision trees?
http://www.nature.com/nbt/journal/v26/n9/full/nbt0908-1011.html

What is dynamic programming?
http://www.nature.com/nbt/journal/v22/n7/full/nbt0704-909.html

What are artificial neural networks?
http://www.nature.com/nbt/journal/v26/n2/full/nbt1386.html

How to map billions of short reads onto genomes?
http://www.nature.com/nbt/journal/v27/n5/full/nbt0509-455.html


Some of these papers come from a blog I came across with and could not find again. Thanks to that unknown blog.

Posted in Sin categoría | Leave a comment