Showing
1 changed file
with
42 additions
and
0 deletions
scripts/ObtenciondeAllData.R
0 → 100644
1 | +# ENFERMEDADES MONOGENICAS | ||
2 | +# EQUIPO 5 | ||
3 | + | ||
4 | +# Este script procesa dos distintas tablas, una obtenida de OMIM tras ciertos filtros | ||
5 | +# (gene_filtered_phenENS.txt) y la tabla obtenida del script "get_monogenic_disease_data.sh", | ||
6 | +# con la informaci?n de la base de datos DISEASES DB. | ||
7 | + | ||
8 | +#### OMIM | ||
9 | +phen<-read.csv(file = "C:/Users/Fer/Desktop/gene_filtered_phenENS.txt", header = FALSE, sep = "\t") ##path a archivo gene_filtered_phenENS.txt | ||
10 | +colnames(phen)[7]<-"MIM.gene.accession" ##Cambio de nombres de columnas paa facilitar procesamiento | ||
11 | +colnames(phen)[12]<-"Gene.stable.ID" | ||
12 | + | ||
13 | +ensembl<-read.csv(file = "C:/Users/Fer/Desktop/mart_export_v2.txt", header = TRUE, sep = "\t") ##Lectura de archivo mart_export.txt descargado de ensembl | ||
14 | +MIM_phen<-merge(x = phen, y = ensembl, by = "MIM.gene.accession") ##Union de las dos tablas (phen y ensembl) por el MIM gene accesion number | ||
15 | +MIM_phen1<-MIM_phen[c(15, 16, 17, 18, 20, 19)] ##Seleccion y reordenamiento de columnas | ||
16 | + | ||
17 | + | ||
18 | + | ||
19 | +### DISEASES DB | ||
20 | +DB<-read.csv(file = "C:/Users/Fer/Desktop/match_v2.tsv", header = FALSE, sep = "\t") ##Lectura de archivo output de script | ||
21 | +colnames(DB)[6]="Protein.stable.ID" ##Cambio de nombre de columna que contiene el Protein Stable ID | ||
22 | +##Debido a que habIa renglones que no contenian Protein Stable ID dividimos la tabla en dos para procesarlos de distinta manera | ||
23 | +empty<-kevin[which(DB$Protein.stable.ID==""),] ##Data frame con renglones que NO tenian Protein Stable ID | ||
24 | +full<-DB[-c(which(DB$Protein.stable.ID=="")),] ##Data frame con renglones que SI tenian Protein Stable ID | ||
25 | + | ||
26 | +with_PSI<-merge(x = full, y = ensembl, by = "Protein.stable.ID") ##Union de las dos tablas (DB y ensembl) por el Protein Stable ID | ||
27 | +full1<-with_PSI[,c(6,7,8,9,11,10)] ##Seleccion y reordenamiento de columnas | ||
28 | + | ||
29 | + | ||
30 | +empty$Strand="" ##agregar columna vacia a empty | ||
31 | +colnames(empty)<-colnames(full1) ##Asignacion de los mismos nombres de columna que tiene full1 a empty | ||
32 | +empty_me<-merge(x = empty, y = ensembl, by = "Gene.name") ##Union de las dos tablas (emty y ensembl) por el Gene.name | ||
33 | +empty_me<-empty_me[c(7,8,9,1,11, 10)] ##Seleccion y reordenamiento de columnas | ||
34 | +colnames(empty_me)<-colnames(empty) ##Asigancion de mismos nombres de columnas de empty a empty_me | ||
35 | + | ||
36 | +match_full<-as.data.frame(rbind(as.matrix(empty_me), as.matrix(full1))) | ||
37 | +colnames(match_full)<-colnames(MIM_phen1) | ||
38 | + | ||
39 | +# Generamos una tabla que contenga la informacion de las 2 bases de datos | ||
40 | +all_data<-as.data.frame(unique(rbind(as.matrix(match_full), as.matrix(MIM_foo1)))) ##all_data es una tabla con las siguientes columnas: Gene type, Gene Start, Gene End, Gene Name, Strand, Gene Stable ID. Es la tabla con todos los genes que usaremos para la obtenci?n de secuencias | ||
41 | +write.table(all_data, file = "C:/Users/Fer/Desktop/all_data.txt", quote = F, sep = "\t", row.names = FALSE, col.names = FALSE) ##path donde desee el output (all_data.txt) | ||
42 | + |
-
Please register or login to post a comment