Last active
December 2, 2019 14:22
-
-
Save monogenea/a9a6c8a7cb4360228eceee21a7b78a63 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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