Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
GNet
APPINetwork
Commits
67e66eb7
Commit
67e66eb7
authored
May 24, 2022
by
Gosset Simon
Browse files
Update R/biogrid_window_opt.R, R/build_network_window.R, R/methods.R
parent
649c7453
Changes
3
Hide whitespace changes
Inline
Side-by-side
R/biogrid_window_opt.R
View file @
67e66eb7
...
@@ -98,9 +98,27 @@ format_database = function(organism,organismID, putative, file, uniprot, pathrac
...
@@ -98,9 +98,27 @@ format_database = function(organism,organismID, putative, file, uniprot, pathrac
file.remove
(
path.copy
)
file.remove
(
path.copy
)
# Lecture du thesaurus
# Lecture du thesaurus
thesaurus
<-
read.delim
(
file
=
sortie
,
header
=
T
,
sep
=
"\t"
)
thesaurus
2
<-
read.delim
(
file
=
sortie
,
header
=
T
,
sep
=
"\t"
)
thesaurus
<-
as.matrix
(
thesaurus
)
thesaurus
2
<-
as.matrix
(
thesaurus
2
)
file.remove
(
sortie
)
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 ... "
)
cat
(
"OK\n>Loading database ... "
)
...
...
R/build_network_window.R
View file @
67e66eb7
...
@@ -213,16 +213,17 @@ build_network = function(organism, db, ipl, th, method, degree, remove.sdi, remo
...
@@ -213,16 +213,17 @@ build_network = function(organism, db, ipl, th, method, degree, remove.sdi, remo
# Visualisation de la progression des corrections
# Visualisation de la progression des corrections
cat
(
'\n>Autocorrection'
)
cat
(
'\n>Autocorrection'
)
cat
(
'\n'
)
cat
(
'\n'
)
data2
<<-
data
pb1
<<-
txtProgressBar
(
min
=
0
,
max
=
dim
(
data
)[
1
],
style
=
3
)
pb1
<<-
txtProgressBar
(
min
=
0
,
max
=
dim
(
data
)[
1
],
style
=
3
)
nbpassage
<<
-0
nbpassage
<<
-0
nf
<<-
c
()
nf
<<-
c
()
apply
(
data
,
1
,
cherche_uniprotID
,
data
=
data
,
thesaurus
=
thesaurus
)
apply
(
data
2
,
1
,
cherche_uniprotID
,
data
=
data
2
,
thesaurus
=
thesaurus
)
not_founds
<-
nf
not_founds
<-
nf
# Memorisation du nouveau reseau (correction avec le thesaurus)
# Memorisation du nouveau reseau (correction avec le thesaurus)
network2
<-
data
network2
<-
data
2
### Toutes les corrections automatiques sont faites sur le reseau ###
### Toutes les corrections automatiques sont faites sur le reseau ###
...
...
R/methods.R
View file @
67e66eb7
...
@@ -96,15 +96,39 @@ DataBases<-function(Final.List.Redondant){
...
@@ -96,15 +96,39 @@ DataBases<-function(Final.List.Redondant){
}
}
search_id
<-
function
(
cible
,
thesaurus
)
{
search_id
<-
function
(
cible
,
thesaurus
,
interactor
)
{
cible
=
as.vector
(
cible
)
# Recherche de la cible dans tout le thesaurus pour associer le bon UniprotID avec le nom de la proteine et le nom du gene
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
# 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
]
ciblePrincipale
<-
CIBLE
[
1
]
if
(
length
(
CIBLE
[])
>
1
)
{
if
(
length
(
CIBLE
[])
>
1
)
{
complementCible
<-
paste
(
'-'
,
CIBLE
[
2
],
sep
=
''
)
complementCible
<-
paste
(
'-'
,
CIBLE
[
2
],
sep
=
''
)
}
}
...
@@ -127,12 +151,13 @@ search_id <- function(cible, thesaurus) {
...
@@ -127,12 +151,13 @@ search_id <- function(cible, thesaurus) {
# }
# }
# }
# }
resultat
=
grep
(
pattern
=
ciblePrincipale
,
x
=
thesaurus
[,
1
])
resultat
=
grep
(
pattern
=
ciblePrincipale
,
x
=
thesaurus
[,
1
])
if
(
length
(
resultat
)
!=
0
)
{
if
(
length
(
resultat
)
!=
0
)
{
resultat
=
c
(
thesaurus
[
resultat
,
1
],
thesaurus
[
resultat
,
5
],
thesaurus
[
resultat
,
3
])
resultat
=
c
(
thesaurus
[
resultat
,
1
],
thesaurus
[
resultat
,
5
],
thesaurus
[
resultat
,
3
])
}
else
{
}
else
{
resultat
=
grep
(
pattern
=
ciblePrincipale
,
x
=
thesaurus
[,
5
])
resultat
=
grep
(
pattern
=
alias
,
x
=
thesaurus
[,
5
])
if
(
length
(
resultat
)
!=
0
)
{
if
(
length
(
resultat
)
!=
0
)
{
resultat
=
c
(
thesaurus
[
resultat
,
1
],
thesaurus
[
resultat
,
5
],
thesaurus
[
resultat
,
3
])
resultat
=
c
(
thesaurus
[
resultat
,
1
],
thesaurus
[
resultat
,
5
],
thesaurus
[
resultat
,
3
])
}
else
{
}
else
{
...
@@ -148,7 +173,7 @@ search_id <- function(cible, thesaurus) {
...
@@ -148,7 +173,7 @@ search_id <- function(cible, thesaurus) {
if
(
length
(
resultat
)
!=
0
)
{
if
(
length
(
resultat
)
!=
0
)
{
resultat
=
c
(
thesaurus
[
resultat
,
1
],
thesaurus
[
resultat
,
5
],
thesaurus
[
resultat
,
3
])
resultat
=
c
(
thesaurus
[
resultat
,
1
],
thesaurus
[
resultat
,
5
],
thesaurus
[
resultat
,
3
])
}
else
{
}
else
{
resultat
=
grep
(
pattern
=
ciblePrincipal
e
,
x
=
thesaurus
[,
3
])
resultat
=
grep
(
pattern
=
genenam
e
,
x
=
thesaurus
[,
3
])
if
(
length
(
resultat
)
!=
0
)
{
if
(
length
(
resultat
)
!=
0
)
{
resultat
=
c
(
thesaurus
[
resultat
,
1
],
thesaurus
[
resultat
,
5
],
thesaurus
[
resultat
,
3
])
resultat
=
c
(
thesaurus
[
resultat
,
1
],
thesaurus
[
resultat
,
5
],
thesaurus
[
resultat
,
3
])
}
}
...
@@ -163,6 +188,7 @@ search_id <- function(cible, thesaurus) {
...
@@ -163,6 +188,7 @@ search_id <- function(cible, thesaurus) {
############################################################################################
############################################################################################
recup_ppi
<-
function
(
inputListFile
,
Base
,
remove_degree
=
0
)
{
recup_ppi
<-
function
(
inputListFile
,
Base
,
remove_degree
=
0
)
{
...
@@ -994,7 +1020,7 @@ update_db <- function(db, resume, os, Os, organism.path) {
...
@@ -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
# 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
){
cherche_uniprotID
<-
function
(
data_i
,
data
,
thesaurus
){
# Colonne A
# Colonne A
resultatA
<-
search_id
(
data_i
[
4
]
,
thesaurus
)
resultatA
<-
search_id
(
data_i
,
thesaurus
,
interactor
=
1
)
if
(
length
(
resultatA
)
==
3
)
{
if
(
length
(
resultatA
)
==
3
)
{
ID
<-
resultatA
[
1
]
ID
<-
resultatA
[
1
]
Proteine
<-
resultatA
[
2
]
Proteine
<-
resultatA
[
2
]
...
@@ -1014,7 +1040,7 @@ cherche_uniprotID<-function(data_i,data,thesaurus){
...
@@ -1014,7 +1040,7 @@ cherche_uniprotID<-function(data_i,data,thesaurus){
}
}
# Colonne B
# Colonne B
resultatB
<-
search_id
(
data_i
[
5
]
,
thesaurus
)
resultatB
<-
search_id
(
data_i
,
thesaurus
,
interactor
=
2
)
if
(
length
(
resultatB
)
==
3
)
{
if
(
length
(
resultatB
)
==
3
)
{
ID
<-
resultatB
[
1
]
ID
<-
resultatB
[
1
]
Proteine
<-
resultatB
[
2
]
Proteine
<-
resultatB
[
2
]
...
@@ -1034,6 +1060,7 @@ cherche_uniprotID<-function(data_i,data,thesaurus){
...
@@ -1034,6 +1060,7 @@ cherche_uniprotID<-function(data_i,data,thesaurus){
nf
<<-
rbind
(
nf
,
not_found
)
nf
<<-
rbind
(
nf
,
not_found
)
}
}
nbpassage
<<-
nbpassage
+1
nbpassage
<<-
nbpassage
+1
data2
[
nbpassage
,]
<<-
data_i
setTxtProgressBar
(
pb1
,
nbpassage
)
setTxtProgressBar
(
pb1
,
nbpassage
)
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment