Rscripts for Magarvey lab