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 94ffa7a2 authored by Davide Lagoa's avatar Davide Lagoa
Browse files

debug

parent c28f3605
package tcdb.reactionsGenerator;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
......@@ -35,9 +36,9 @@ public class GenerateTransportReactions {
int noMetabolitesNoReactionsCounter = 0;
Map<String, TcdbMetabolitesContainer> tcdbMetabolites2 = new HashMap<>();
tcdbMetabolites2.put("P0AE74", tcdbMetabolites.get("P0AE74"));
// Map<String, TcdbMetabolitesContainer> tcdbMetabolites2 = new HashMap<>();
//
// tcdbMetabolites2.put("Q9Y6L6", tcdbMetabolites.get("Q9Y6L6"));
for(String accession : tcdbMetabolites.keySet()) {
......@@ -46,8 +47,8 @@ public class GenerateTransportReactions {
TcdbMetabolitesContainer tcdbMetContainer = tcdbMetabolites.get(accession);
for(String tcNumber : tcdbMetContainer.getTcNumbers()) {
// System.out.println(tcNumber);
// System.out.println(tcNumber);
TcNumberContainer newTcContainer = new TcNumberContainer();
......@@ -58,9 +59,9 @@ public class GenerateTransportReactions {
if(data.containsKey(familyTC)) {
try {
TypeOfTransporter evidence = null;
TcNumberContainer tcNumberContainer = data.get(familyTC);
if(tcNumberContainer.getAllReactionsIds().size() == 0) {
......@@ -69,7 +70,7 @@ public class GenerateTransportReactions {
}
else {
for(int id : tcNumberContainer.getAllReactionsIds()) {
evidence = null;
ReactionContainer reactionContainer = tcNumberContainer.getReactionContainer(id);
......@@ -79,10 +80,10 @@ public class GenerateTransportReactions {
if(evidence == null && proteinFamilyDescription.containsKey(tcNumber.replaceAll("(\\.\\d+)$", ""))) {
evidence = checkForEvidenceOfTransport(proteinFamilyDescription.get(tcNumber.replaceAll("(\\.\\d+)$", "")), tcNumber);
}
if(evidence == null && tcNumberContainer.getFamily() != null)
evidence = checkForEvidenceOfTransport(tcNumberContainer.getFamily(), tcNumber);
if(evidence == null && tcNumberContainer.getSuperFamily() != null)
evidence = checkForEvidenceOfTransport(tcNumberContainer.getSuperFamily(), tcNumber);
......@@ -91,28 +92,31 @@ public class GenerateTransportReactions {
Boolean antiportOrSymport = selectMethodOfMetabolitesDistribution(reactionContainer.getReaction(), reactionContainer.getTransportType(), dictionary);
// System.out.println();
// if(accession.equalsIgnoreCase("P26287") && tcNumber.equals("3.D.3.5.1")) {
// System.out.println("AQUIII" + "\t" + reactionContainer.getReaction());
// System.out.println("AQUIII2" + "\t " + antiportOrSymport + " \t" + evidence + "\t" + reactionContainer.getTransportType().toString());
// }
for(Set<String> metabolites : tcdbMetContainer.getMetabolitesCombinations(tcNumber, antiportOrSymport, accession)) {
// if(accession.equalsIgnoreCase("P26287") && tcNumber.equals("3.D.3.5.1")) {
// System.out.println("AQUIII" + "\t" + reactionContainer.getReaction());
// System.out.println("AQUIII2" + "\t " + antiportOrSymport + " \t" + evidence + "\t" + reactionContainer.getTransportType().toString());
// }
// if(accession.equalsIgnoreCase("P45539") && tcNumber.equals("2.A.3.8.17")) {
// System.out.println("AQUIII3" + metabolites + "\t" + reactionContainer.getReaction());
// }
// if(accession.equals("P45539"))
// System.out.println(metabolites);
for(List<String> metabolites : tcdbMetContainer.getMetabolitesCombinations(tcNumber, antiportOrSymport, evidence, accession)) {
// if(accession.equalsIgnoreCase("P45539") && tcNumber.equals("2.A.3.8.17")) {
// System.out.println("AQUIII3" + metabolites + "\t" + reactionContainer.getReaction());
// }
// if(accession.equals("P45539"))
// System.out.println(metabolites);
// Set<String> metabolites = tcdbMetContainer.getMetabolites(tcNumber);
// System.out.println(reactionContainer.getTransportType());
if(evidence == null) {
if(reactionContainer.getTransportType().equals(TypeOfTransporter.Uniport) || reactionContainer.getTransportType().equals(TypeOfTransporter.Symport))
if(reactionContainer.getTransportType().equals(TypeOfTransporter.PEPdependent))
newTcContainer = processPEPReactions(tcNumber+" "+accession, reactionContainer.getReaction(), "PEP-0" , reactionContainer.getProperties(), metabolites, newTcContainer);
else if(reactionContainer.getTransportType().equals(TypeOfTransporter.Uniport) || reactionContainer.getTransportType().equals(TypeOfTransporter.Symport))
newTcContainer = processUniportAndSymportReactions(reactionContainer, newTcContainer, metabolites, dictionary, tcNumber+" "+accession);
else if(!reactionContainer.getTransportType().equals(TypeOfTransporter.Antiport))
......@@ -122,7 +126,7 @@ public class GenerateTransportReactions {
}
else if(evidence.equals(TypeOfTransporter.RedoxQuinol) || evidence.equals(TypeOfTransporter.Cytochrome)
|| evidence.equals(TypeOfTransporter.RedoxNADH) || evidence.equals(TypeOfTransporter.MoreThanOne)) {
newTcContainer = processAntiportReactions(reactionContainer, newTcContainer, metabolites, dictionary, tcNumber+" "+accession);
}
else if(evidence.equals(TypeOfTransporter.Uniport) && reactionContainer.getTransportType().equals(TypeOfTransporter.Uniport)){
......@@ -153,9 +157,9 @@ public class GenerateTransportReactions {
}
}
}
// System.out.println(newTcContainer.getAllReactionsIds().size());
// System.out.println(tcNumberContainer.getAllReactionsIds().size());
// System.out.println(newTcContainer.getAllReactionsIds().size());
// System.out.println(tcNumberContainer.getAllReactionsIds().size());
if(newTcContainer.getAllReactionsIds().size() == 0 && tcNumberContainer.getAllReactionsIds().size() > 0) {
......@@ -180,11 +184,11 @@ public class GenerateTransportReactions {
newTcContainer.setSuperFamily(tcNumberContainer.getSuperFamily());
}
// System.out.println(newTcContainer.getAllReactionsIds().size());
// System.out.println(newTcContainer.getAllReactionsIds().size());
newTcContainer = filterUnwantedReactions(tcNumber, newTcContainer, evidence);
// System.out.println(newTcContainer.getAllReactionsIds().size());
// System.out.println(newTcContainer.getAllReactionsIds().size());
newContainers.put(tcNumber, newTcContainer);
}
......@@ -207,7 +211,7 @@ public class GenerateTransportReactions {
}
private static TcNumberContainer processBiochemicalReactions(ReactionContainer reactionContainer,
TcNumberContainer newTcContainer, Set<String> metabolites, Synonyms dictionary, String tc) {
TcNumberContainer newTcContainer, List<String> metabolites, Synonyms dictionary, String tc) {
// Set<String> preReactions = new HashSet<>();
......@@ -340,23 +344,23 @@ public class GenerateTransportReactions {
private static TcNumberContainer filterUnwantedReactions(String tcNumber, TcNumberContainer newTcContainer, TypeOfTransporter evidence) {
Set<TypeOfTransporter> set = newTcContainer.getAllTransportTypesAssociated();
// if(tcNumber.equals("3.D.4.10.3")) {
// System.out.println("Evidence" + evidence);
// System.out.println(set);
// }
// System.out.println("Evidence" + evidence);
// System.out.println(set);
TypeOfTransporter toKeep = TypeOfTransporter.Uniport;
if(evidence == null && (!set.contains(TypeOfTransporter.Uniport) || !set.contains(TypeOfTransporter.Symport) || !set.contains(TypeOfTransporter.Antiport)))
if(evidence == null && !set.contains(TypeOfTransporter.Uniport) && !set.contains(TypeOfTransporter.Symport) && !set.contains(TypeOfTransporter.Antiport))
toKeep = TypeOfTransporter.MoreThanOne;
else if(evidence != null && (set.contains(evidence) || evidence.equals(TypeOfTransporter.MoreThanOne)))
toKeep = evidence;
else if(!set.contains(toKeep) && set.contains(TypeOfTransporter.Symport))
toKeep = TypeOfTransporter.Symport;
else if(!set.contains(toKeep) && set.contains(TypeOfTransporter.Antiport))
toKeep = TypeOfTransporter.Antiport;
......@@ -364,16 +368,19 @@ public class GenerateTransportReactions {
for(TypeOfTransporter t : set)
toKeep = t;
}
// if(tcNumber.equals("3.D.4.10.3")) {
// System.out.println("tokeep" + toKeep);
// System.out.println(tcNumber.startsWith("3.D"));
// System.out.println();
// }
// if(tcNumber.equals("3.D.4.10.3")) {
// System.out.println("tokeep" + toKeep);
// System.out.println(tcNumber.startsWith("3.D"));
// System.out.println();
// }
// System.out.println(set.size());
// System.out.println(toKeep);
if(set.size() > 1 && !toKeep.equals(TypeOfTransporter.MoreThanOne)) {
// System.out.println(set + "\t" + tcNumber);
// System.out.println(set + "\t" + tcNumber);
for(int id : newTcContainer.getAllReactionsIds()) {
......@@ -395,7 +402,36 @@ public class GenerateTransportReactions {
* @param metabolites
* @return
*/
private static TcNumberContainer correctReaction(String tc, String originalReaction, String confLevel, TypeOfTransporter evidence, Map<String, String> properties, Set<String> metabolites, TcNumberContainer newTcContainer) {
private static TcNumberContainer processPEPReactions(String tc, String originalReaction, String confLevel, Map<String, String> properties, List<String> metabolites, TcNumberContainer newTcContainer) {
String[] result = originalReaction.split(ReactionContainer.IRREV_TOKEN);
String reactant = result[0];
for(String metabolite : metabolites)
reactant = reactant.replace("Sugar", metabolite);
ReactionContainer newReactContainer = new ReactionContainer(reactant, result[1], true);
newReactContainer.setTransportType(TypeOfTransporter.PEPdependent);
newReactContainer.setProperties(properties);
newReactContainer.setOriginalReaction(originalReaction);
newReactContainer.setConfidenceLevel(confLevel);
newTcContainer.addReaction(newReactContainer);
return newTcContainer;
}
/**
* Process metabolites associated to the wrong transport types.
*
* @param evidence
* @param reactionContainer
* @param metabolites
* @return
*/
private static TcNumberContainer correctReaction(String tc, String originalReaction, String confLevel, TypeOfTransporter evidence, Map<String, String> properties, List<String> metabolites, TcNumberContainer newTcContainer) {
Set<String> reactions = new HashSet<>();
......@@ -501,9 +537,9 @@ public class GenerateTransportReactions {
else if(tcNumber.equals("2.A.60.1.5"))
return TypeOfTransporter.Antiport;
else if(tcNumber.matches("3\\.D\\..+")) {
if(description.matches("(?i).*cytochrome.*") && description.matches("(?i).*quinol.*")) {
return TypeOfTransporter.MoreThanOne;
}
......@@ -524,7 +560,7 @@ public class GenerateTransportReactions {
else if(description.matches("(?i).*antiporte*r*[\\s*\\.*]*.*"))
return TypeOfTransporter.Antiport;
}
catch (Exception e) {
System.out.println(tcNumber);
......@@ -994,7 +1030,7 @@ public class GenerateTransportReactions {
* @param familyTC
* @return
*/
public static TcNumberContainer processUniportAndSymportReactions(ReactionContainer reactionContainer, TcNumberContainer newTcContainer, Set<String> metabolites, Synonyms dictionary,String tc) throws Exception {
public static TcNumberContainer processUniportAndSymportReactions(ReactionContainer reactionContainer, TcNumberContainer newTcContainer, List<String> metabolites, Synonyms dictionary,String tc) throws Exception {
String originalReaction = reactionContainer.getReaction();
......@@ -1125,7 +1161,7 @@ public class GenerateTransportReactions {
* @return
*/
@SuppressWarnings("unchecked")
private static String[] checkReactionsMetabolites(String reactant, String product, Set<String> metabolites, Synonyms dictionary, TypeOfTransporter transportType , String tc) {
private static String[] checkReactionsMetabolites(String reactant, String product, List<String> metabolites, Synonyms dictionary, TypeOfTransporter transportType , String tc) {
// if(tc.equals("3.D.1.1.1 P33602"))
// System.out.println(reactant + " <<<<>>>> " + product + "\t\t" + metabolites);
......@@ -1139,7 +1175,7 @@ public class GenerateTransportReactions {
reactant = (String) regex[0];
product = (String) regex[1];
metabolites = new HashSet<>((Set<String>) regex[2]);
metabolites = new ArrayList<>((List<String>) regex[2]);
}
......@@ -1168,15 +1204,18 @@ public class GenerateTransportReactions {
int confidenceLevel = 0;
for(String evidenceOfSymOrAnti : TWO_METABOLITES_EVIDENCE) {
if(reactantMetabolites.containsKey(evidenceOfSymOrAnti) || productMetabolites.containsKey(evidenceOfSymOrAnti)) {
// if(tc.equals("2.A.15.2.1 P31553"))
// System.out.println(metabolites);
// System.out.println(evidenceOfSymOrAnti);
// System.out.println(metabolites);
if(metabolites.size() == 2) {
boolean first = true;
Collections.reverse(metabolites); //this is important to respect TCDB order
for(String metabolite : metabolites) {
......@@ -1812,7 +1851,7 @@ public class GenerateTransportReactions {
* @param familyTC
* @return
*/
public static TcNumberContainer processAntiportReactions(ReactionContainer reactionContainer, TcNumberContainer newTcContainer, Set<String> metabolites, Synonyms dictionary, String tc) throws Exception {
public static TcNumberContainer processAntiportReactions(ReactionContainer reactionContainer, TcNumberContainer newTcContainer, List<String> metabolites, Synonyms dictionary, String tc) throws Exception {
// Set<String> preReactions = new HashSet<>();
// Set<String> reactions = new HashSet<>();
......
......@@ -30,8 +30,8 @@ public class Retriever {
///////// - SEARCHER
Properties properties = new Properties();
// Properties properties = new Properties();
//
// TcdbRetriever.getSubstrates(properties.getQueriesBackupDirectory());
//
// System.out.println("Retrieving TCDB FASTA file...");
......
package tcdb.triage;
import blast.Blast;
import tcdb.capsules.ReactionContainer;
public class Test {
......
#Generated by Maven Integration for Eclipse
#Mon Oct 01 15:09:50 BST 2018
#Wed Oct 10 16:12:25 BST 2018
m2e.projectLocation=C\:\\Users\\Davide\\Biosynth2\\triage
m2e.projectName=triage
groupId=tcdb
......
This diff is collapsed.
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