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 @@
# 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.
rm(list=ls())
#set work directory as canto-space
setwd("./")
getwd()
......@@ -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")
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
count<-1
phenpos<-c()
for(m in 1:nrow(quallist)){
phen<-unlist(strsplit(quallist[m,3],","))
phenqual1<-c()
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 the annotations are for 'phenotypic class' (FBcv:0000347) then:
# a) the single term 'progressive' shoud be allowed
if(quallist[m,1]==Df[which(Df[,2]=="phenotypic class"),1]){
Df1[count,1]<-quallist[m,1]
phen<-append(phen, Df[which(Df[,2]=="progressive"), 1])
Df1[count,4]<-paste(phen,collapse = '|')
phenqual1<-append(phenqual1, Df[which(Df[,2]=="progressive"), 1])
Df1[count,4]<-paste(phenqual1,collapse = '|')
count<-count+1
# 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
viable<-c("viable","increased mortality","long lived")
viable<-c("viable","increased mortality during development","short lived","long lived")
for (n in 1:length(viable)){
viable[n]<-Df[which(Df[,2]==viable[n]),1]
}
......@@ -138,7 +145,7 @@ for(m in 1:nrow(quallist)){
}
else{
Df1[count,1]<-quallist[m,1]
Df1[count,4]<-paste(phen, collapse = '|')
Df1[count,4]<-paste(phenqual1, collapse = '|')
count<-count+1
Df1[count,1]<-quallist[m,1]
Df1[count,4]<-"FBdv:00007008"
......@@ -150,7 +157,7 @@ for(m in 1:nrow(quallist)){
}
if(quallist[m,2]=='genetic interaction'){
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,5]<-"Interaction qualifier - ONLY USE FOR INTERACTIONS"
count<-count+1
......@@ -173,4 +180,5 @@ if (is.na(Df1[j,8])==TRUE){Df1[j,8]<-as.character("user")}
else{}
}
write.table(Df1, file = "./canto/extension_config.tsv", sep='\t', quote= FALSE, row.names = FALSE)
\ No newline at end of file
write.table(Df1, file = "./canto/extension_config.tsv", sep='\t', quote= FALSE, row.names = FALSE)
#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