FAQ | This is a LIVE service | Changelog

Skip to content
Snippets Groups Projects
Commit f550b718 authored by Vitor Trovisco's avatar Vitor Trovisco
Browse files

Update list-to-extension_config.R

Changes allow extension_config.tsv to list several top terms for the same namespace (there are a few cases).
parent ea3bb515
No related branches found
No related tags found
No related merge requests found
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
# GO CC - GO:0005575. # GO CC - GO:0005575.
# extension_config.tsv only uses IDs and, therefore, qualifier namespaces must be converted into their topterm IDs, whcih requires screening the FBcv obo file. # extension_config.tsv only uses IDs and, therefore, qualifier namespaces must be converted into their topterm IDs, whcih requires screening the FBcv obo file.
rm(list=ls())
#set work directory as canto-space #set work directory as canto-space
setwd("./") setwd("./")
getwd() getwd()
...@@ -101,25 +102,31 @@ colnames(Df1)<-c("domain ID", "subset relation", "extension relation", "range ID ...@@ -101,25 +102,31 @@ colnames(Df1)<-c("domain ID", "subset relation", "extension relation", "range ID
#read file with list of allowed qualifiers (on "allowed_qualifiers.tsv") #read file with list of allowed qualifiers (on "allowed_qualifiers.tsv")
quallist<-read.table("./extension_config-Rscript/allowed_qualifiers.tsv", sep="\t", header=TRUE, stringsAsFactors=FALSE) quallist<-read.table("./extension_config-Rscript/allowed_qualifiers.tsv", sep="\t", header=TRUE, stringsAsFactors=FALSE)
count<-1
#for each type of allowed qualifier, replace the namespace with corresponding top term with that namespace #for each type of allowed qualifier, replace the namespace with corresponding top term with that namespace
count<-1
phenpos<-c()
for(m in 1:nrow(quallist)){ for(m in 1:nrow(quallist)){
phen<-unlist(strsplit(quallist[m,3],",")) phen<-unlist(strsplit(quallist[m,3],","))
phenqual1<-c()
for(l in 1:length(phen)){ for(l in 1:length(phen)){
phen[l]<-Df[which(Df[,3]==phen[l]&Df[,5]==phen[l]&is.na(Df[,6])==TRUE),1] phenpos<-which(Df[,3]==phen[l]&Df[,5]==phen[l]&is.na(Df[,6])==TRUE)
phenqual<-c()
for(l1 in 1:length(phenpos)){
phenqual[l1]<-Df[phenpos[l1],1]
}
phenqual1[l]<-paste(phenqual,collapse = "|")
} }
if(quallist[m,2]=='phenotype'){ if(quallist[m,2]=='phenotype'){
#if the annotations are for 'phenotypic class' (FBcv:0000347) then: #if the annotations are for 'phenotypic class' (FBcv:0000347) then:
# a) the single term 'progressive' shoud be allowed # a) the single term 'progressive' shoud be allowed
if(quallist[m,1]==Df[which(Df[,2]=="phenotypic class"),1]){ if(quallist[m,1]==Df[which(Df[,2]=="phenotypic class"),1]){
Df1[count,1]<-quallist[m,1] Df1[count,1]<-quallist[m,1]
phen<-append(phen, Df[which(Df[,2]=="progressive"), 1]) phenqual1<-append(phenqual1, Df[which(Df[,2]=="progressive"), 1])
Df1[count,4]<-paste(phen,collapse = '|') Df1[count,4]<-paste(phenqual1,collapse = '|')
count<-count+1 count<-count+1
# b) and 'the 'fertility/sterility terms must not allow developmental stage terms # b) and 'the 'fertility/sterility terms must not allow developmental stage terms
##once the ontology file is updated so that all viability/mortality/life-span terms are under a common parent term, this next bit should be updated ##once the ontology file is updated so that all viability/mortality/life-span terms are under a common parent term, this next bit should be updated
viable<-c("viable","increased mortality","long lived") viable<-c("viable","increased mortality during development","short lived","long lived")
for (n in 1:length(viable)){ for (n in 1:length(viable)){
viable[n]<-Df[which(Df[,2]==viable[n]),1] viable[n]<-Df[which(Df[,2]==viable[n]),1]
} }
...@@ -138,7 +145,7 @@ for(m in 1:nrow(quallist)){ ...@@ -138,7 +145,7 @@ for(m in 1:nrow(quallist)){
} }
else{ else{
Df1[count,1]<-quallist[m,1] Df1[count,1]<-quallist[m,1]
Df1[count,4]<-paste(phen, collapse = '|') Df1[count,4]<-paste(phenqual1, collapse = '|')
count<-count+1 count<-count+1
Df1[count,1]<-quallist[m,1] Df1[count,1]<-quallist[m,1]
Df1[count,4]<-"FBdv:00007008" Df1[count,4]<-"FBdv:00007008"
...@@ -150,7 +157,7 @@ for(m in 1:nrow(quallist)){ ...@@ -150,7 +157,7 @@ for(m in 1:nrow(quallist)){
} }
if(quallist[m,2]=='genetic interaction'){ if(quallist[m,2]=='genetic interaction'){
Df1[count,1]<-quallist[m,1] Df1[count,1]<-quallist[m,1]
Df1[count,4]<-paste(phen, collapse = '|') Df1[count,4]<-paste(phenqual1, collapse = '|')
Df1[count,3]<-"int_qual" Df1[count,3]<-"int_qual"
Df1[count,5]<-"Interaction qualifier - ONLY USE FOR INTERACTIONS" Df1[count,5]<-"Interaction qualifier - ONLY USE FOR INTERACTIONS"
count<-count+1 count<-count+1
...@@ -173,4 +180,5 @@ if (is.na(Df1[j,8])==TRUE){Df1[j,8]<-as.character("user")} ...@@ -173,4 +180,5 @@ if (is.na(Df1[j,8])==TRUE){Df1[j,8]<-as.character("user")}
else{} else{}
} }
write.table(Df1, file = "./canto/extension_config.tsv", sep='\t', quote= FALSE, row.names = FALSE) write.table(Df1, file = "./canto/extension_config.tsv", sep='\t', quote= FALSE, row.names = FALSE)
\ No newline at end of file #for each type of allowed qualifier, replace the namespace with corresponding top term with that namespace
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment