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 bb751175 authored by dlagoa's avatar dlagoa
Browse files

duplicated entries fixed

parent 0502b2cf
......@@ -1250,10 +1250,6 @@ public class GenerateTransportReactions {
if(reactantMetabolites.containsKey(evidenceOfSymOrAnti) || productMetabolites.containsKey(evidenceOfSymOrAnti)) {
// if(tc.equals("2.A.15.2.1 P31553"))
// System.out.println(evidenceOfSymOrAnti);
// System.out.println(metabolites);
if(metabolites.size() == 2) {
boolean first = true;
......@@ -1272,20 +1268,9 @@ public class GenerateTransportReactions {
String subString = evidenceOfSymOrAnti.substring(0, evidenceOfSymOrAnti.length()-1);
// try {
reactant = reactant.replaceAll(reactantMetabolites.get(subString), metabolite); //example --> replaces by 'solute'
product = product.replaceAll(productMetabolites.get(subString), metabolite);
// }
// catch (Exception e){
//
//
// System.out.println(subString + "\t" + reactantMetabolites);
//
// e.printStackTrace();
// }
//
}
}
......@@ -1296,16 +1281,6 @@ public class GenerateTransportReactions {
}
}
// if(!accept && transportType.equals(TypeOfTransporter.Biochemical)) {
//
// for(String react : reactantMetabolites.keySet())
// reactant = reactant.replace(reactantMetabolites.get(react), react);
//
// for(String prod : productMetabolites.keySet())
// product = product.replace(productMetabolites.get(prod), prod);
//
// }
count++;
//transport of electrons
......@@ -1336,10 +1311,6 @@ public class GenerateTransportReactions {
//'perfect' match
// if(tc.equals("1.C.30.1.2 O32831"))
// System.out.println(metabolites + "\t" + reactantMetabolites);
if(!accept) {
if(metabolites.containsAll(reactantMetabolites.keySet()) || metabolites.containsAll(productMetabolites.keySet())) {
......@@ -1370,13 +1341,6 @@ public class GenerateTransportReactions {
for(String metabolite : metabolites) {
// if(tc.equalsIgnoreCase("1.H.1.1.5 Q8N6F1")) {
// System.out.println("AQUIII2");
// System.out.println(react);
// System.out.println(metabolite);
//
// }
if((react.replaceAll("[^A-Za-z0-9]", "").equalsIgnoreCase("Ion") || react.matches("Metal\\s\\w*ion")) && (metabolite.matches("\\w+\\+") || metabolite.matches("\\w+\\-") || metabolite.matches("Metal\\s\\w*ion"))) {
if((react.replaceAll("[^A-Za-z0-9]", "").equalsIgnoreCase("Ion") || metabolite.matches("Metal\\s\\w*ion")) ||
......@@ -1520,15 +1484,6 @@ public class GenerateTransportReactions {
for(String metabolite : metabolites) {
// if(tc.equals("2.A.8.1.1 P12012")) {
// System.out.println("AQUIIII190");
// System.out.println(react);
// System.out.println(metabolite);
// System.out.println(dictionary.isChildOf(react, metabolite));
// System.out.println(dictionary.isChildOf(metabolite, react));
// System.out.println(dictionary.getHierarchiesDictionary());
// }
if(dictionary.isChildOf(react, metabolite)) {
reactant = reactant.replace(reactantMetabolites.get(react), metabolite);
......@@ -1547,17 +1502,6 @@ public class GenerateTransportReactions {
for(String metabolite : metabolites) {
// if(tc.equals("2.A.81.1.6 Q845W9")) {
// System.out.println("AQUIIII291");
// System.out.println(prod);
// System.out.println(metabolite);
// System.out.println(dictionary.isChildOf(prod, metabolite));
// System.out.println(dictionary.isChildOf(metabolite, prod));
// System.out.println(dictionary.getHierarchiesDictionary());
//
// }
if(dictionary.isChildOf(prod, metabolite)) {
product = product.replace(productMetabolites.get(prod), metabolite);
......@@ -1590,7 +1534,6 @@ public class GenerateTransportReactions {
for(String metabolite : metabolites) {
if(GENERAL_METABOLITES.contains(react)
// if((react.replaceAll("[^A-Za-z0-9]", "").equalsIgnoreCase("Solute") || react.replaceAll("[^A-Za-z0-9]", "").equalsIgnoreCase("Toxin") || react.replaceAll("[^A-Za-z0-9]", "").equalsIgnoreCase("Drug"))
&& (!metabolites.contains(TcdbMetabolitesContainer.EMPTY) && !metabolite.equalsIgnoreCase("Unknown"))
&& (!metabolite.matches("\\w+\\+") && !metabolite.matches("\\w+\\-"))) {
......@@ -1599,7 +1542,6 @@ public class GenerateTransportReactions {
}
else if(GENERAL_METABOLITES.contains(metabolite)
// if((react.replaceAll("[^A-Za-z0-9]", "").equalsIgnoreCase("Solute") || react.replaceAll("[^A-Za-z0-9]", "").equalsIgnoreCase("Toxin") || react.replaceAll("[^A-Za-z0-9]", "").equalsIgnoreCase("Drug"))
&& (!metabolites.contains(TcdbMetabolitesContainer.EMPTY) && !metabolite.equalsIgnoreCase("Unknown"))
&& (!metabolite.matches("\\w+\\+") && !metabolite.matches("\\w+\\-"))) {
......@@ -1615,39 +1557,21 @@ public class GenerateTransportReactions {
for(String metabolite : metabolites) {
if(GENERAL_METABOLITES.contains(prod)
// if((prod.replaceAll("[^A-Za-z0-9]", "").equalsIgnoreCase("Solute") || prod.replaceAll("[^A-Za-z0-9]", "").equalsIgnoreCase("Toxin") || prod.replaceAll("[^A-Za-z0-9]", "").equalsIgnoreCase("Drug"))
&& (!metabolites.contains(TcdbMetabolitesContainer.EMPTY) && !metabolite.equalsIgnoreCase("Unknown"))
&& (!metabolite.matches("\\w+\\+") && !metabolite.matches("\\w+\\-"))){
// if(tc.equals("2.A.1.2.51 A3M9E9")) {
// System.out.println(prod + "\t" + metabolite);
// System.out.println(productMetabolites.get(prod));
// System.out.println(product);
// }
product = product.replace(productMetabolites.get(prod), metabolite);
accept = true;
// if(tc.equals("2.A.1.2.51 A3M9E9"))
// System.out.println(product);
}
else if(GENERAL_METABOLITES.contains(metabolite)
// if((prod.replaceAll("[^A-Za-z0-9]", "").equalsIgnoreCase("Solute") || prod.replaceAll("[^A-Za-z0-9]", "").equalsIgnoreCase("Toxin") || prod.replaceAll("[^A-Za-z0-9]", "").equalsIgnoreCase("Drug"))
&& (!metabolites.contains(TcdbMetabolitesContainer.EMPTY) && !metabolite.equalsIgnoreCase("Unknown"))
&& (!metabolite.matches("\\w+\\+") && !metabolite.matches("\\w+\\-"))){
// if(tc.equals("2.A.1.2.51 A3M9E9")) {
// System.out.println(prod + "\t" + metabolite);
// System.out.println(productMetabolites.get(prod));
// System.out.println(product);
// }
product = product.replace(productMetabolites.get(prod), prod);
accept = true;
// if(tc.equals("2.A.1.2.51 A3M9E9"))
// System.out.println(product);
}
}
}
......@@ -1662,8 +1586,6 @@ public class GenerateTransportReactions {
for(String react : reactantMetabolites.keySet()) {
// if(react.matches(""))
for(String metabolite : metabolites) {
......@@ -1683,17 +1605,9 @@ public class GenerateTransportReactions {
if(prod.replaceAll("[^A-Za-z0-9]", "").equalsIgnoreCase("Solute") && (!metabolites.contains(TcdbMetabolitesContainer.EMPTY) && !metabolite.equalsIgnoreCase("Unknown"))){
// if(tc.equals("2.A.1.2.51 A3M9E9")) {
// System.out.println(prod + "\t" + metabolite);
// System.out.println(productMetabolites.get(prod));
// System.out.println(product);
// }
product = product.replace(productMetabolites.get(prod), metabolite);
accept = true;
// if(tc.equals("2.A.1.2.51 A3M9E9"))
// System.out.println(product);
}
}
......@@ -1747,11 +1661,6 @@ public class GenerateTransportReactions {
for(String metabolite : metabolites) {
// if(tc.equals("3.D.1.1.1 P33602")) {
// System.out.println(react + "\t" + metabolite + "\t" + react.replaceAll("[^A-Za-z0-9]", "") + "\t" + metabolite.replaceAll("[^A-Za-z0-9]", ""));
// System.out.println(react.replaceAll("[^A-Za-z0-9]", "").equalsIgnoreCase(metabolite.replaceAll("[^A-Za-z0-9]", "")));
// }
if(react.replaceAll("[^A-Za-z0-9]", "").equalsIgnoreCase(metabolite.replaceAll("[^A-Za-z0-9]", ""))){
reactant = reactant.replace(reactantMetabolites.get(react), metabolite);
......@@ -1781,25 +1690,16 @@ public class GenerateTransportReactions {
if(prod.replaceAll("[^A-Za-z0-9]", "").equalsIgnoreCase(metabolite.replaceAll("[^A-Za-z0-9]", ""))) {
// if(tc.equals("1.C.10.3.1 K7JEL9"))
// System.out.println(prod + "\t" + metabolite);
product = product.replace(productMetabolites.get(prod), metabolite);
accept = true;
}
else if(prod.replace("D-", "").replaceAll("[^A-Za-z0-9]", "").equalsIgnoreCase(metabolite.replaceAll("[^A-Za-z0-9]", ""))) {
// if(tc.equals("1.C.10.3.1 K7JEL9"))
// System.out.println(prod + "\t" + metabolite);
product = product.replace(productMetabolites.get(prod), metabolite);
accept = true;
}
else if(prod.replace("L-", "").replaceAll("[^A-Za-z0-9]", "").equalsIgnoreCase(metabolite.replaceAll("[^A-Za-z0-9]", ""))) {
// if(tc.equals("1.C.10.3.1 K7JEL9"))
// System.out.println(prod + "\t" + metabolite);
product = product.replace(productMetabolites.get(prod), metabolite);
accept = true;
}
......@@ -1807,23 +1707,13 @@ public class GenerateTransportReactions {
}
if(accept) {
// System.out.println("guardar");
confidenceLevel = count;
}
// if(tc.equals("3.D.1.1.1 P0AFD6")) {
// System.out.println("AQUI1222 " + metabolites);
// }
}
count++;
//for unknown or empty, the default equation is accepted
// if(tc.equals("2.A.1.11.1 Q51330")) {
// System.out.println("AQUI1222 " + metabolites);
// }
if(!accept) {
if(metabolites.contains("Unknown") || metabolites.contains(TcdbMetabolitesContainer.EMPTY)) {
......@@ -1839,22 +1729,6 @@ public class GenerateTransportReactions {
}
}
count++;
// if(!accept) {
//
// for(String metabolite : metabolites) {
//
// for(String react : reactantMetabolites.keySet()) {
//
// if(dictionary.isChildOf(metabolite, react))
// accept = true;
// }
// }
// }
count++;
if(accept) {
String[] result = new String[3];
......
......@@ -462,10 +462,7 @@ public class ProcessCompartments {
* @param compartmentsList
* @return
*/
private static String[] findCompartmentsRelativePosition(String reactant, String product, Compartments[] compartmentsList) {
// System.out.println(reactant);
// System.out.println(product);
public static String[] findCompartmentsRelativePosition(String reactant, String product, Compartments[] compartmentsList) {
String[] reaction = new String[2];
......@@ -479,37 +476,34 @@ public class ProcessCompartments {
allCompartments.addAll(auxReactant);
allCompartments.addAll(auxProduct);
// System.out.println(allCompartments);
int error = 0;
for(String comp : allCompartments) {
// System.out.println(comp.length() + " " + comp);
if(!comp.contains("E:CH3") && !comp.contains("E:Co")){
for(int i = 0; i < compartmentsList.length; i++) {
try {
if(compartmentsList[i].equals(Compartments.valueOf(comp.toLowerCase().trim()))) {
for(int i = 0; i < compartmentsList.length; i++) {
try {
if(compartmentsList[i].equals(Compartments.valueOf(comp.toLowerCase().trim()))) {
compartmentsRelativePositions.put(i, comp);
break;
}
}
catch (Exception e) {
error++;
compartmentsRelativePositions.put(i, comp);
compartmentsRelativePositions.put(compartmentsList.length+error, comp);
e.printStackTrace();
break;
}
}
catch (Exception e) {
error++;
compartmentsRelativePositions.put(compartmentsList.length+error, comp);
e.printStackTrace();
break;
}
}
}
boolean first = true;
// System.out.println(compartmentsRelativePositions);
for(Integer key : compartmentsRelativePositions.keySet()) {
if(first) {
......
......@@ -74,8 +74,6 @@ public class Retriever {
data2 = ProcessCompartments.processCompartments(data2);
System.out.println("IGNORE PREVIOUS ERRORS");
List<String[]> excel = JSONFilesUtils.readTCDBScrapedInfo();
Map<String, TcdbMetabolitesContainer> tcdbMetabolites = ProcessTcdbMetabolitesExcel.processData(excel);
......
package tcdb.triage;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
public class Test {
public static void main(String[] args) {
import org.biojava.nbio.core.sequence.template.AbstractSequence;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.htmlunit.HtmlUnitDriver;
String molecule = " <species boundaryCondition=\"false\" constant=\"false\" hasOnlySubstanceUnits=\"false\" id=\"M_cpd15604_e0\" name=\"Gly-Leu_e0\" metaid=\"M_cpd15604_e0\" sboTerm=\"SBO:0000247\" compartment=\"e\" fbc:charge=\"0\" fbc:chemicalFormula=\"C8H16N2O3\">\r\n fbc:chemicalFormula=\"C10H12N5O3R\">";
import pt.uminho.ceb.biosystems.transyt.scraper.APIs.UniprotAPIExtension;
import pt.uminho.ceb.biosystems.transyt.scraper.tcdb.tcdbTransportTypesRetriever.ProcessCompartments;
import pt.uminho.ceb.biosystems.transyt.scraper.transmembraneDomains.betaBarrels.ReadPREDTMBB2;
import pt.uminho.ceb.biosystems.transyt.utilities.enumerators.Compartments;
import pt.uminho.ceb.biosystems.transyt.utilities.files.JSONFilesUtils;
import uk.ac.ebi.kraken.interfaces.uniprot.UniProtEntry;
// String text = "text";
public class Test {
System.out.println(molecule);
// public static void main(String[] args) {
//
// Compartments[] compartmentsList = Compartments.values();
//
// ProcessCompartments.findCompartmentsRelativePosition("DNA (in the phage capsid)", "DNA (in the bacterial cytoplasm)", compartmentsList);
//
// }
//
public static void main(String[] args) {
Pattern p;
Matcher m;
p = Pattern.compile("chemicalFormula=\"(\\S*)\"");
m = p.matcher(molecule);
if(m.find()) {
WebDriver driver = new HtmlUnitDriver();
System.out.println(m.group(1));
}
// And now use this to visit the website
driver.get("https://www.ncbi.nlm.nih.gov/gene/?term=STER_A2");
// Find the text input element by its name
// WebElement element = driver.findElement(By.name("sequence")); //text area
// element.sendKeys(query);
//
// element = driver.findElement(By.xpath("/html/body/form/input[2]")); //check prediction for batch
// element.click();
//
// element = driver.findElement(By.xpath("/html/body/form/input[3]")); //uncheck Signal peptide predictions
// element.click();
//
// element = driver.findElement(By.xpath("/html/body/form/input[7]")); //email
// element.click();
// element.sendKeys(email);
//
// element = driver.findElement(By.xpath("/html/body/form/input[8]")); //run prediction
// element.click();
System.out.println(driver.getCurrentUrl());
System.out.println("AQUI " + driver.getTitle());
// System.out.println(driver.getPageSource());
}
}
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