From 33d5fa001e4625c808518b48f8dbf23b6659b1f0 Mon Sep 17 00:00:00 2001 From: TRON Kelly <t19016063@V-PJ-47-066.salsa.univ-amu.fr> Date: Wed, 23 Oct 2024 16:23:10 +0200 Subject: [PATCH] tp1 --- src/tp1.R | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/tp1.R b/src/tp1.R index 904a363..44b14f3 100644 --- a/src/tp1.R +++ b/src/tp1.R @@ -1,16 +1,17 @@ +options(repos = c(CRAN = "https://cloud.r-project.org")) output_dir = "results/tp1" dir.create(output_dir, showWarnings = F, recursive = T) -#if (!require("BiocManager", quietly = TRUE)) - # install.packages("BiocManager") +# if (!require("BiocManager", quietly = TRUE)) +# install.packages("BiocManager") #if (!require("snpStats", quietly = TRUE)) - # BiocManager::install("snpStats") +# BiocManager::install("snpStats") #if (!require("SNPRelate", quietly = TRUE)) #BiocManager::install("SNPRelate") -#Charger les bibliothèques +# Charger les bibliothèques #library(snpStats) #library(SNPRelate) #library(devtools) @@ -24,7 +25,7 @@ penncath_fam_path = "results/data/penncath.fam" geno <- snpStats::read.plink(penncath_bed_path, penncath_bim_path, penncath_fam_path, select.snps=sample(1:861473, 25000, replace = FALSE ), na.strings = ("-9")) plink_base=file.path(output_dir, "plink_base") -write.plink(plink_base, snps=geno$genotypes, pedigree=geno$fam[,1], id=geno$fam[,1], mother=geno$fam[,4], sex=geno$fam[,5], phenotype=geno$fam[,6], chromosome = geno$map[,1], genetic.distance = geno$map[,3], position = geno$map[,4], allele.1 = geno$map[,5], allele.2 = geno$map[,6], na.code = ("-9")) +snpStats::write.plink(plink_base, snps=geno$genotypes, pedigree=geno$fam[,1], id=geno$fam[,1], mother=geno$fam[,4], sex=geno$fam[,5], phenotype=geno$fam[,6], chromosome = geno$map[,1], genetic.distance = geno$map[,3], position = geno$map[,4], allele.1 = geno$map[,5], allele.2 = geno$map[,6], na.code = ("-9")) genoBim<-geno$map colnames(genoBim)<-c("chr", "SNP", "gen.dist", "position", "A1", "A2") @@ -41,3 +42,4 @@ rm(geno) rdata_path = file.path(output_dir, "TP1_asbvg.RData") save.image(rdata_path) + -- GitLab