Git Lab CI for docker build enabled! You can enable it using .gitlab-ci.yml in your project. Check file template at https://gitlab.bio.di.uminho.pt/snippets/5

Commit d1a04e26 authored by Davide Lagoa's avatar Davide Lagoa
Browse files

minor changes

parent dffb8f03
......@@ -13,7 +13,7 @@ import pt.uminho.ceb.biosystems.transyt.scraper.APIs.KeggAPI;
import pt.uminho.ceb.biosystems.transyt.scraper.APIs.MetaCycAPI;
import pt.uminho.ceb.biosystems.transyt.scraper.APIs.ModelSEEDAPI;
import pt.uminho.ceb.biosystems.transyt.scraper.tcdb.reactionsGenerator.GenerateTransportReactions;
import pt.uminho.ceb.biosystems.transyt.scraper.tcdb.utilities.ProcessTcdbMetabolitesExcel;
import pt.uminho.ceb.biosystems.transyt.scraper.tcdb.utilities.ProcessTcdbMetabolites;
import pt.uminho.ceb.biosystems.transyt.utilities.capsules.ReactionContainer;
import pt.uminho.ceb.biosystems.transyt.utilities.capsules.TcNumberContainer;
import pt.uminho.ceb.biosystems.transyt.utilities.capsules.TcdbMetabolitesContainer;
......@@ -95,7 +95,7 @@ public class Retriever {
List<String[]> table = JSONFilesUtils.readTCDBScrapedInfo();
Map<String, TcdbMetabolitesContainer> tcdbMetabolitesAux = ProcessTcdbMetabolitesExcel.processData(table);
Map<String, TcdbMetabolitesContainer> tcdbMetabolitesAux = ProcessTcdbMetabolites.processData(table);
Map<String, TcdbMetabolitesContainer> tcdbMetabolites = new HashMap<>();
......@@ -206,6 +206,7 @@ public class Retriever {
data.put(key, exceptions.get(key));
}
return data;
}
......
......@@ -7,83 +7,107 @@ import java.util.Map;
import pt.uminho.ceb.biosystems.transyt.utilities.capsules.TcdbMetabolitesContainer;
import pt.uminho.ceb.biosystems.transyt.utilities.dictionary.Synonyms;
public class ProcessTcdbMetabolitesExcel {
public class ProcessTcdbMetabolites {
public static Map<String, TcdbMetabolitesContainer> processData(List<String[]> table) {
// Map<String, Integer> counter = new HashMap();
public static Map<String, TcdbMetabolitesContainer> processData(List<String[]> excel) {
// Map<String, Integer> counter = new HashMap();
Map<String, TcdbMetabolitesContainer> containers = new HashMap<>();
Synonyms dictionary = new Synonyms();
for(String[] line : excel) {
for(String[] line : table) {
String[] id = line[0].split("@");
String uniprotAcc = id[0];
String tcNumber = id[1];
if(line[2].matches(".*Nucleobase-ascorbate.*")) { //create file with these special cases
line[2] = line[2].replace("Nucleobase-ascorbate", "Nucleobase, ascorbate");
}
if(line[2].matches(".*Purine-cytosine.*")) {
line[2] = line[2].replace("Purine-cytosine", "Purine, cytosine");
}
if(line[2].matches(".*Lysine-arginine.*")) {
line[2] = line[2].replace("Lysine-arginine", "Lysine, arginine");
}
line[2] = line[2].replace(" and ", ", ").replaceAll("N-\\s*,", "");
String[] metabolites = line[2].split(", ");
// Utilities.printArray(metabolites);
// Utilities.printArray(metabolites);
for(int i = 0; i < metabolites.length; i++) {
String word = dictionary.getSynonym(metabolites[i].toLowerCase().replaceAll("\\s+", ""));
if(word != null) {
metabolites[i] = word;
}
}
// Utilities.printArray(metabolites);
// System.out.println();
// Utilities.printArray(metabolites);
// System.out.println();
String description = line[4];
//
// for(int i = 0; i < metabolites.length; i++) {
//
// if(counter.containsKey(metabolites[i])) {
//
// int count = counter.get(metabolites[i].toLowerCase().trim()) + 1;
//
// counter.put(metabolites[i].toLowerCase().trim(), count);
// }
// else
// counter.put(metabolites[i].toLowerCase().trim(), 1);
// }
//
//
// for(int i = 0; i < metabolites.length; i++) {
//
// if(counter.containsKey(metabolites[i])) {
//
// int count = counter.get(metabolites[i].toLowerCase().trim()) + 1;
//
// counter.put(metabolites[i].toLowerCase().trim(), count);
// }
// else
// counter.put(metabolites[i].toLowerCase().trim(), 1);
// }
//
if(!containers.containsKey(uniprotAcc))
containers.put(uniprotAcc, new TcdbMetabolitesContainer(uniprotAcc));
containers.get(uniprotAcc).addEntry(tcNumber, description, metabolites);
}
// for(String key : counter.keySet())
// System.out.println(key + "\t" + counter.get(key));
// for(String key : counter.keySet())
// System.out.println(key + "\t" + counter.get(key));
return containers;
}
/**
* Get TC numbers' description.
*
* @param excel
* @return
*/
public static Map<String, String> getTCDescriptions(List<String[]> table) {
Map<String, String> descriptions = new HashMap<>();
for(String[] line : table) {
String[] id = line[0].split("@");
String tcNumber = id[1];
String description = line[4];
if(!descriptions.containsKey(tcNumber))
descriptions.put(tcNumber, description);
}
return descriptions;
}
}
\ No newline at end of file
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