diff --git a/.~lock.lab_gwas_stats.docx# b/.~lock.lab_gwas_stats.docx# new file mode 100644 index 0000000..11d557a --- /dev/null +++ b/.~lock.lab_gwas_stats.docx# @@ -0,0 +1 @@ +,noah,NovaArchSys,20.10.2022 16:12,file:///home/noah/.config/libreoffice/4; \ No newline at end of file diff --git a/Schrick-Noah_CS-6643_Lab-6.R b/Schrick-Noah_CS-6643_Lab-6.R index e69de29..bb6dc52 100644 --- a/Schrick-Noah_CS-6643_Lab-6.R +++ b/Schrick-Noah_CS-6643_Lab-6.R @@ -0,0 +1,24 @@ +# Lab 6 for the University of Tulsa's CS-6643 Bioinformatics Course +# GWAS +# Professor: Dr. McKinney, Fall 2022 +# Noah L. Schrick - 1492657 + +## Set Working Directory to file directory - RStudio approach +setwd(dirname(rstudioapi::getActiveDocumentContext()$path)) + +#### Part 0: PLINK +if (!require("BiocManager")) install.packages("BiocManager") +library(BiocManager) +if (!require("snpStats")) BiocManager::install("snpStats") +library(snpStats) + +ex.data <- read.pedfile(file="extra.ped", snps="extra.map") +ex.data$fam +phenotype <- ex.data$fam$affected-1 # change pheno from 1/2 to 0/1 +genotypes <- ex.data$genotypes # encoded as AA/AB/BB +snp.ids <- as.character(ex.data$map$snp.names) +genotypes.df <- data.frame(as(genotypes, "character")) +colnames(genotypes.df) <- snp.ids +# observed contingency table for SNP rs630969 +table(phenotype,genotypes.df$rs630969, + dnn=c("phenotype","genotype")) # dnn dimension names of table \ No newline at end of file diff --git a/lab_gwas_stats.docx b/lab_gwas_stats.docx index 24a7cf9..20fad62 100644 Binary files a/lab_gwas_stats.docx and b/lab_gwas_stats.docx differ