Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
m2bsgreprod
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
THIBERT-RIPOSO Anais
m2bsgreprod
Commits
1a51f7c5
Commit
1a51f7c5
authored
6 months ago
by
THIBERT-RIPOSO Anais
Browse files
Options
Downloads
Patches
Plain Diff
scripts R des tp1 à 4
parent
8482dc2a
No related branches found
No related tags found
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
src/.Rhistory
+0
-0
0 additions, 0 deletions
src/.Rhistory
src/tp1.R
+45
-0
45 additions, 0 deletions
src/tp1.R
src/tp2.R
+10
-14
10 additions, 14 deletions
src/tp2.R
src/tp3.R
+25
-0
25 additions, 0 deletions
src/tp3.R
src/tp4.R
+20
-0
20 additions, 0 deletions
src/tp4.R
with
100 additions
and
14 deletions
src/.Rhistory
0 → 100644
+
0
−
0
View file @
1a51f7c5
This diff is collapsed.
Click to expand it.
src/tp1.R
0 → 100644
+
45
−
0
View file @
1a51f7c5
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("snpStats", quietly = TRUE))
# BiocManager::install("snpStats")
#if (!require("SNPRelate", quietly = TRUE))
#BiocManager::install("SNPRelate")
# Charger les bibliothèques
#library(snpStats)
#library(SNPRelate)
#library(devtools)
#library(plyr)
# Les données analysées nécessitant beaucoup de RAM, nous allons sélectionner aléatoirement 250000 SNPs et réecrire des fichiers bed, bim, fam
penncath_bed_path
=
"results/data/penncath.bed"
penncath_bim_path
=
"results/data/penncath.bim"
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"
)
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"
)
#head(genoBim)
genotype
<-
geno
$
genotype
#print(genotype)
genoFam
<-
geno
$
fam
#head(genoFam)
# On commence par libérer de l'espace
rm
(
geno
)
rdata_path
=
file.path
(
output_dir
,
"TP1_asbvg.RData"
)
save.image
(
rdata_path
)
This diff is collapsed.
Click to expand it.
src/tp2.R
+
10
−
14
View file @
1a51f7c5
wdir
=
"/amuhome/t20006223/m2bsgreprod/src"
dir.create
(
wdir
)
setwd
(
wdir
)
#load data
load
(
"results/tp1/TP1_asbvg.RData"
)
library
(
devtools
)
#fichier de sortie
output_dir
=
"results/tp2"
dir.create
(
output_dir
,
showWarnings
=
F
,
recursive
=
T
)
#on installe et ouvre les packages/librairies nécessaires
if
(
!
require
(
"BiocManager"
,
quietly
=
TRUE
))
install.packages
(
"BiocManager"
)
if
(
!
require
(
"snpStats"
,
quietly
=
TRUE
))
BiocManager
::
install
(
"snpStats"
)
if
(
!
require
(
"SNPRelate"
,
quietly
=
TRUE
))
BiocManager
::
install
(
"SNPRelate"
)
library
(
snpStats
)
#on enregistre le fichier de sortie
library
(
SNPRelate
)
rdata_path
=
file.path
(
output_dir
,
"TP2_asbvg.RData"
)
save.image
(
rdata_path
)
# Les données analysées nécessitant beaucoup de RAM, nous allons sélectionner aléatoirement 250000 SNPs et réecrire des fichiers bed, bim, fam
penncath_bed_path
=
"/amuhome/t20006223/m2bsgreprod/results/data/penncath.bed"
penncath_bim_path
=
"/amuhome/t20006223/m2bsgreprod/results/data/penncath.bim"
penncath_fam_path
=
"/amuhome/t20006223/m2bsgreprod/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"
))
This diff is collapsed.
Click to expand it.
src/tp3.R
0 → 100644
+
25
−
0
View file @
1a51f7c5
#load data
load
(
"results/tp2/TP2_asbvg.RData"
)
#fichier de sortie
output_dir
=
"results/tp3"
dir.create
(
output_dir
,
showWarnings
=
F
,
recursive
=
T
)
#library
if
(
!
require
(
"BiocManager"
,
quietly
=
TRUE
))
install.packages
(
"BiocManager"
)
if
(
!
require
(
"snpStats"
,
quietly
=
TRUE
))
BiocManager
::
install
(
"snpStats"
)
#if (!require("doParallel", quietly = TRUE))
# BiocManager::install("doParallel")
library
(
snpStats
)
library
(
plyr
)
library
(
GenABEL
)
#library(doParallel)
rdata_path
=
file.path
(
output_dir
,
"TP3_asbvg.RData"
)
save.image
(
rdata_path
)
This diff is collapsed.
Click to expand it.
src/tp4.R
0 → 100644
+
20
−
0
View file @
1a51f7c5
#load data
load
(
"results/tp3/TP3_asbvg.RData"
)
#fichier de sortie
output_dir
=
"results/tp4"
dir.create
(
output_dir
,
showWarnings
=
F
,
recursive
=
T
)
#Library
if
(
!
require
(
"dplyr"
,
quietly
=
T
))
install.packages
(
"dplyr"
)
if
(
!
require
(
"plyr"
,
quietly
=
T
))
install.packages
(
"plyr"
)
if
(
!
require
(
"GenABEL"
,
quietly
=
T
))
install.packages
(
"GenABEL"
)
rdata_path
=
file.path
(
output_dir
,
"TP4_asbvg.RData"
)
save.image
(
rdata_path
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment