Skip to content

Instantly share code, notes, and snippets.

@monogenea

monogenea/2-poissonGWAS.R

Last active Dec 2, 2019
Embed
What would you like to do?
# Load lipid datasets & match SNP-Lipidomics samples
lipidsMalay <- read.delim("public/Lipidomic/117Malay_282lipids.txt", row.names = 1)
lipidsIndian <- read.delim("public/Lipidomic/120Indian_282lipids.txt", row.names = 1)
lipidsChinese <- read.delim("public/Lipidomic/122Chinese_282lipids.txt", row.names = 1)
all(Reduce(intersect, list(colnames(lipidsMalay),
colnames(lipidsIndian),
colnames(lipidsChinese))) == colnames(lipidsMalay)) # TRUE
lip <- rbind(lipidsMalay, lipidsIndian, lipidsChinese)
# Country
country <- sapply(list(SNP_M, SNP_I, SNP_C), function(k){
nrow(k$genotypes)
})
origin <- data.frame(sample.id = rownames(SNP$genotypes),
Country = factor(rep(c("M", "I", "C"), country)))
matchingSamples <- intersect(rownames(lip), rownames(SNP$genotypes))
SNP$genotypes <- SNP$genotypes[matchingSamples,]
lip <- lip[matchingSamples,]
origin <- origin[match(matchingSamples, origin$sample.id),]
# Combine SNP and Lipidomics
genData <- list(SNP = SNP$genotype, MAP = SNP$map, LIP = lip)
# Write processed omics and GDS
save(genData, origin, file = "PhenoGenoMap.RData")
write.plink("convertGDS", snps = SNP$genotypes)
# Clear memory
rm(list = ls())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.