title: "Elena's Worklog" author: "Elena Venable" output: html_document: toc: true theme: united pdf_document: toc: true
cd
moves to home directorymkdir Hollings
makes Hollings directorygit clone https://github.com/eriqande/SNPcontam.git
clones the SNPcontam repository to my Hollings directorygit config --global user.name "evenable"
to input namegit config --global user.email Elena_venable@brown.edu
: to input emai addressgit config --global core.editor emacs
changed the default editor to emacsgit status
git push origin master
pushes my local changes to SNPcontam repositorygit config --global credential.helper osxkeychain
knitr
, devtools
, and roxygen2
likelihood(gt,af)
gt
is genotypes as 0s, 1s, and 2s, where 1s and 2s are homozygous and 1s are heterozygousaf
is the allele frequencies of the lociROC
: creating ROC curvethreshold
: finding threshold likelihood ratio/heterozygousity ratio for p-valuelratio
: calculating likelihood ratio genotypeshetero
: calculating proportion of heterozygous locirandom_gene
: creates n random genotypes using genotype frequencieslratio
, random_gene
, and hetero
ROC
and threshold
although not sure if they work properlyaf <- runif(20,0,1)
Ran <- random_gene(1000,af)
L <- likelihood(af,Ran$rclean)
LC <- likelihood(af, Ran$rcontam)
ratio <- lratio(L$clean, L$contam,af)
ratio_c <- lratio(LC$clean, LC$contam,af)
hetero <- hetero(Ran$rclean,af)
hetero_c <- hetero(Ran$rcontam, af)
par(mfrow=c(2,2))
ROC(100,ratio[[1]], ratio_c[[1]])
hist(ratio[[1]],col=rgb(1,0,0,0.5),xlim = c(-40,20),main="Likelihood Ratio Histogram")
hist(ratio_c[[1]],col=rgb(0,0,1,0.5),add=T)
ROC(100,hetero[[1]],hetero_c[[1]])
hist(hetero[[1]],col=rgb(1,0,0,0.5),xlim = c(0,1),main="Heterozygousity Histogram")
hist(hetero_c[[1]],col=rgb(0,0,1,0.5),add=T)
ROC
functionROC
, lratio
, and hetero
contam_MCMC
for algorithmfull_z
used to calculate full conditional distribution of zmain-body-text.tex
manuscriptmain-body-text.tex
contam_MCMC
and full_z
full_z
to get rid of the apply()
command and used log()
, colSums()
, and exp()
. Also changed output from list to just return(p)
contam_MCMC
to reflect change in the full_z
outputsimulate_genos
to simulate random contaminated and clean genotypes with a certain proportion of contaminationtest_MCMC
to compare MCMC of simualted samples to true resultsloci_table
missingl_table
threshold_table
MCMC_sims
test_MCMC
to have different outputs that correspond better with the desired simulation outputlapply
to run the test_MCMC
function on all of theMCMC_plots
that will create the three graphsMCMC_zplots
, MCMC_alleleplot
, and MCMC_rhoplot
MCMC_zplots
because I couldn't decide which one looks the bestMCMC_sims
so that the code now produces graphsP_likelihood
MCMC_sims
so that we can change the rho values and number of loci used and still use the same codeallele_table
which makes a table of the mean difference between the allele value and the poterior mean for each of the 16 different scenariosMCMC_sims
code to be more efficient and worked with produced figures and graphsMCMC_sims
dataMCMC_sims
code to get rid of loopsdo.call()
to combine data frames rather than setting up large complicated data frame in which to store dataMCMC_sims
and the plotting functionsMCMC_sims
in the README for the packageMCMC_sims
on the computer with many cores, but there was something wrong with the simulation codesimulation_functions.R
in not-package/simulations
02_makecharts_1.R
and 03_maketables_1.R
contain the code for making charts and tablesMacports
and pdf2svg
in order to be able to import Latex text from Latexit to Inkscape as an svgP_likelihood
codePcontam
which creates a matrix of likelihoods for a contaminated sampleP_likelihood
functionP_likelihood
analyze_MCMC
functionnot-package
DAG_2
mixed_MCMC
DAG_2
mixed_MCMC
sim_mixture
that randomly picks individuals from the baseline and then test the mixture model, mixed_MCMC
README
in not-package\notes
to explain the codesim_mixture
does not simulate contaminated samplesmixed_MCMC
took about 10 secondssim_mixture
scriptsim_mixture
script with Eric and made some changes to simplify codemixed_MCMC
make_mixture
makes a baseline and a mixture matrix for a simulation when given the original baselineget_likelihood_matrices
computes the likelihood matrices for clean and contam given a baseline and a mixture matrixpopulation_compare
which runs make_mixture
, sim_mixture
, and mixed_MCMC
and displays population assignment info for non-contaminated individualsmixed_MCMC
code so that it can be run with $\rho = 0$ and only run the MCMC for mixing proportions and population assignmentmake_mixture
so makes different mixture matrix and baseline if $\rho = 0$population_compare
script to be general so that it can be run for any portion of the baselinemake_mixture
so that lists of IDs can be input for both contaminated and clean individualsmake_mixture
so that mixture matrix and baseline matrix have the same format (pre-transformation to 0s,1s, and 2s)make_mixture
code so that it includes RepPop, RepUnit, and Pop in the mixture and baselinepopulation_compare
so that it works with prepare_base_and_mixe_for_MCMC
population_compare
to calculate the fraction of samples that are correctly assigned to their RepUnit and populationmixed_simulation_function
to store all of the simulation functions and moved make_mixture
into the scriptmake_lists
to take the proportions of the from the ca_fishery_proportions
and take individuals to be used in the mixturemixed_MCMC_sims
mixed_MCMC_with_means
to calculate posterior means and such so that an lapply can be applied in mixed_MCMC_sims
to run all the simulationsmixed_MCMC_sims
so that it uses different rho valuesmixed_MCMC_functions
to make graphs and tables and to calculate fraction of individuals correctly identifiedsingle_pop_MCMC
that wraps all of the MCMC functions for the single population (analyze_MCMC
and contam_MCMC
)single_pop_MCMC
called change_to_ones_zeros_twos
that changes the data (which is in the 2 column SNP format) to data with individuals in the columns and loci on the rows with only zeros, ones, twos, and NAschange_to_ones_zeros_twos
from code in prepare_base_and_mix_for_mixture_MCMC
but edited for only one set of data instead of mixture and baselinekl_genotypes
are the samples from the Klamath watershednoyo_genotypes
are the samples from the Noyo Rivercontaminated_coho
are the IDs, origins, and contamination status of all the suspect samplessingle_pop_MCMC
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.