Commit 67e66eb7 authored by Gosset Simon's avatar Gosset Simon
Browse files

Update R/biogrid_window_opt.R, R/build_network_window.R, R/methods.R

parent 649c7453
......@@ -98,10 +98,28 @@ format_database = function(organism,organismID, putative, file, uniprot, pathrac
file.remove(path.copy)
# Lecture du thesaurus
thesaurus <- read.delim(file = sortie, header = T, sep = "\t")
thesaurus <- as.matrix(thesaurus)
thesaurus2 <- read.delim(file = sortie, header = T, sep = "\t")
thesaurus2 <- as.matrix(thesaurus2)
file.remove(sortie)
thesaurus = thesaurus_data[,-c(4,6,7,8)]
thesaurus[,3] = thesaurus_data[,5]
colnames(thesaurus)[3] = colnames(thesaurus_data)[5]
thesaurus[,4] = thesaurus_data[,3]
colnames(thesaurus)[4] = colnames(thesaurus_data)[3]
thesaurus <- as.matrix(thesaurus)
thesaurus = thesaurus[!is.na(thesaurus[,2]),]
cat("OK\n>Loading database ... ")
# Lecture de la base
......
......@@ -213,16 +213,17 @@ build_network = function(organism, db, ipl, th, method, degree, remove.sdi, remo
# Visualisation de la progression des corrections
cat ( '\n>Autocorrection' )
cat ( '\n' )
data2 <<- data
pb1 <<- txtProgressBar(min = 0, max = dim(data)[1], style = 3)
nbpassage<<-0
nf<<-c()
apply(data,1,cherche_uniprotID,data=data,thesaurus=thesaurus)
apply(data2,1,cherche_uniprotID,data=data2,thesaurus=thesaurus)
not_founds<-nf
# Memorisation du nouveau reseau (correction avec le thesaurus)
network2 <- data
network2 <- data2
### Toutes les corrections automatiques sont faites sur le reseau ###
......
......@@ -96,15 +96,39 @@ DataBases<-function(Final.List.Redondant){
}
search_id <- function(cible, thesaurus) {
search_id <- function(cible, thesaurus, interactor) {
cible = as.vector(cible)
if(interactor == 1) {
uid = cible[4]
alias = cible[1]
genename = cible[11]
}
if(interactor == 2) {
uid = cible[5]
alias = cible[2]
genename = cible[12]
}
print(uid)
print(alias)
print(genename)
# Recherche de la cible dans tout le thesaurus pour associer le bon UniprotID avec le nom de la proteine et le nom du gene
# On regarde si la cible peut etre un ID-isoforme pour cherche l'ID seul dans le thesaurus : UniprotID ou OldID
CIBLE <- unlist(strsplit(cible, "-"))
CIBLE <- unlist(strsplit(uid, "-"))
ciblePrincipale <- CIBLE[1]
if (length(CIBLE[]) > 1) {
complementCible <- paste('-', CIBLE[2], sep = '')
}
......@@ -127,12 +151,13 @@ search_id <- function(cible, thesaurus) {
# }
# }
resultat = grep(pattern = ciblePrincipale, x = thesaurus[,1])
if (length(resultat) != 0) {
resultat = c(thesaurus[resultat,1], thesaurus[resultat,5], thesaurus[resultat,3])
} else {
resultat = grep(pattern = ciblePrincipale, x = thesaurus[,5])
resultat = grep(pattern = alias, x = thesaurus[,5])
if (length(resultat) != 0) {
resultat = c(thesaurus[resultat,1], thesaurus[resultat,5], thesaurus[resultat,3])
} else {
......@@ -148,7 +173,7 @@ search_id <- function(cible, thesaurus) {
if (length(resultat) != 0) {
resultat = c(thesaurus[resultat,1], thesaurus[resultat,5], thesaurus[resultat,3])
} else {
resultat = grep(pattern = ciblePrincipale, x = thesaurus[,3])
resultat = grep(pattern = genename, x = thesaurus[,3])
if (length(resultat) != 0) {
resultat = c(thesaurus[resultat,1], thesaurus[resultat,5], thesaurus[resultat,3])
}
......@@ -163,6 +188,7 @@ search_id <- function(cible, thesaurus) {
############################################################################################
recup_ppi <- function(inputListFile, Base, remove_degree = 0) {
......@@ -994,7 +1020,7 @@ update_db <- function(db, resume, os, Os, organism.path) {
# fonction de recherche de l'uniprot ID de reference et association du bon nom de proteine et de gene
cherche_uniprotID<-function(data_i,data,thesaurus){
# Colonne A
resultatA <- search_id(data_i[4],thesaurus)
resultatA <- search_id(data_i,thesaurus, interactor = 1)
if (length(resultatA) == 3) {
ID <- resultatA[1]
Proteine <- resultatA[2]
......@@ -1014,7 +1040,7 @@ cherche_uniprotID<-function(data_i,data,thesaurus){
}
# Colonne B
resultatB <- search_id(data_i[5], thesaurus)
resultatB <- search_id(data_i, thesaurus, interactor = 2)
if (length(resultatB) == 3) {
ID <- resultatB[1]
Proteine <- resultatB[2]
......@@ -1034,6 +1060,7 @@ cherche_uniprotID<-function(data_i,data,thesaurus){
nf <<- rbind(nf, not_found)
}
nbpassage<<-nbpassage+1
data2[nbpassage,]<<- data_i
setTxtProgressBar(pb1, nbpassage)
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment