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()) {
......@@ -47,7 +48,7 @@ public class GenerateTransportReactions {
for(String tcNumber : tcdbMetContainer.getTcNumbers()) {
// System.out.println(tcNumber);
// System.out.println(tcNumber);
TcNumberContainer newTcContainer = new TcNumberContainer();
......@@ -92,18 +93,18 @@ public class GenerateTransportReactions {
// System.out.println();
// if(accession.equalsIgnoreCase("P26287") && tcNumber.equals("3.D.3.5.1")) {
// 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)) {
for(List<String> metabolites : tcdbMetContainer.getMetabolitesCombinations(tcNumber, antiportOrSymport, evidence, accession)) {
// if(accession.equalsIgnoreCase("P45539") && tcNumber.equals("2.A.3.8.17")) {
// 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);
// }
// if(accession.equals("P45539"))
// System.out.println(metabolites);
// Set<String> metabolites = tcdbMetContainer.getMetabolites(tcNumber);
......@@ -112,7 +113,10 @@ public class GenerateTransportReactions {
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))
......@@ -154,8 +158,8 @@ 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) {
......@@ -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<>();
......@@ -341,14 +345,14 @@ public class GenerateTransportReactions {
Set<TypeOfTransporter> set = newTcContainer.getAllTransportTypesAssociated();
// if(tcNumber.equals("3.D.4.10.3")) {
// 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)))
......@@ -365,15 +369,18 @@ public class GenerateTransportReactions {
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<>();
......@@ -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]);
}
......@@ -1172,12 +1208,15 @@ public class GenerateTransportReactions {
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) {
if(first) {
......@@ -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