knitr::opts_chunk$set(echo = TRUE)

Installation

Load in these libaries used by this package

library(ggplot2)
library(tidyverse)
library(devtools)

Install these packages to properly use this package and then load the libraries

install.packages("vcfR")
install.packages("ape")
install.packages("poppr")
devtools::install_github("bcm-uga/LEA")
library(vcfR)
library(ape)
library(poppr)
library(LEA)

Now install this sweet R package

devtools::install_github("sorenDJ/R_package_Johnson")
library("CoolBeans")

Let us download some data to play around with this package:

DNA_Samples_Data_Analysis is a csv file that contains data on collected tissue and DNA samples

mtDNA_samples_data is a text file that contains certain samples (ones inlcuded in the vcf file) and columns from the above mentioned csv file

mtDNA_pop is a vcf file that contains the SNP data from the mitochondria for 122 samples of the Blacktail Shiner

download.file("https://raw.githubusercontent.com/sorenDJ/R_package_Johnson/master/data/DNA_Samples_Data_Analysis.csv", destfile = "/cloud/project/data/DNA_Samples_Data_Analysis.csv")

download.file("https://raw.githubusercontent.com/sorenDJ/R_package_Johnson/master/data/mtDNA_samples_data.txt", destfile = "/cloud/project/data/mtDNA_samples_data.txt")

download.file("https://raw.githubusercontent.com/sorenDJ/R_package_Johnson/master/data/mtDNA_pop.vcf", destfile = "/cloud/project/data/mtDNA_pop.vcf")

pop_data_output function

Example:

pop_data_output(file = "/cloud/project/data/DNA_Samples_Data_Analysis.csv", columns = c(SJ_number, Species, sub_species), sample_col = SJ_number, samples = c("AR01", "AR02", "AR03"), NA_values = c("", "na"), output_file = "/cloud/project/test_pop_data.txt")

samp_2B_seq function

Example:

samp_2B_seq(file = "/cloud/project/data/DNA_Samples_Data_Analysis.csv", na_values = c("", "na"), col2count = strange_topology, output_csv = "/cloud/project/test_output.csv", filter = c("yes", NA))

op_K_snmf function

Example:

op_K_snmf(vcf_file = "/cloud/project/data/mtDNA_pop.vcf", K = 1:10, new_name = "/cloud/project/test_1.geno", repetitions = 5, project_name = "snmf_test_1")

snmf_structure_plot function

Example:

snmf_structure_plot(project_name = snmf_test_1, K = 4, colors = c("green", "blue", "purple", "red"))

genlight_creator

Example:

genlight_creator(vcf_file = "/cloud/project/data/mtDNA_pop.vcf", pop_data = "/cloud/project/data/mtDNA_samples_data.txt", genlight_name = "gl.test", pop_col = sub_species)


sorenDJ/R_package_Johnson documentation built on Dec. 23, 2021, 4:23 a.m.