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

minor changes

parent 9a22eefa
......@@ -95,50 +95,56 @@ public class FindTransporters {
for(String tc : toSearch) {
OutputStream out = new FileOutputStream(path.concat(tc).concat(".txt"));
try {
OutputStream out = new FileOutputStream(path.concat(tc).concat(".txt"));
LinkConnection conn = new LinkConnection();
LinkConnection conn = new LinkConnection();
boolean found = false;
attempt = 0;
boolean found = false;
attempt = 0;
while(attempt < LIMIT && !found) {
while(attempt < LIMIT && !found) {
if(conn.getCodeConnection(TcdbExplorer.TCDB_TCNUMBER_URL.concat(tc)) == 200){
FilesUtils.webPageSaver(conn.getPageOpenStream(), out);
if(conn.getCodeConnection(TcdbExplorer.TCDB_TCNUMBER_URL.concat(tc)) == 200){
FilesUtils.webPageSaver(conn.getPageOpenStream(), out);
// data.put(tc, getTcContainer(conn.getPage(), tc, data));
// data.put(tc, getTcContainer(conn.getPage(), tc, data));
data.putAll(getTcContainer(conn.getPage(), tc));
data.putAll(getTcContainer(conn.getPage(), tc));
searched.add(tc);
searched.add(tc);
found = true;
found = true;
TimeUnit.MILLISECONDS.sleep(500);
TimeUnit.MILLISECONDS.sleep(500);
}
else {
attempt++;
TimeUnit.SECONDS.sleep(10);
}
}
else {
attempt++;
TimeUnit.SECONDS.sleep(10);
}
}
}
int progress = ((searched.size()+failed.size())*100)/toSearch.size();
int progress = ((searched.size()+failed.size())*100)/toSearch.size();
if(progress > lastProgress){
if(progress > lastProgress){
lastProgress = progress;
String message = progress + " % search complete";
logger.debug(message);
}
lastProgress = progress;
String message = progress + " % search complete";
logger.info(message);
}
if(attempt == LIMIT && !found){
if(attempt == LIMIT && !found){
logger.warn("results not found for query: " + TcdbExplorer.TCDB_TCNUMBER_URL.concat(tc));
logger.warn("results not found for query: " + TcdbExplorer.TCDB_TCNUMBER_URL.concat(tc));
failed.add(tc);
}
}
catch (Exception e) {
failed.add(tc);
logger.trace("StackTrace {}",e);
}
}
......
......@@ -34,30 +34,27 @@ public class Retriever {
logger.info("Retrieving TCDB FASTA file...");
TcdbRetriever.getSubstrates();
Set<String> tcNumbers = TcdbExplorer.getTcNumbers(true);
Set<String> toSearch = TcdbExplorer.generateTCsFamily(tcNumbers);
FindTransporters.saveAllTCFamiliesInformation(toSearch);
Map<String, String> proteinFamilyDescription = TcdbExplorer.getProteinsBelongingToFamilyDescription(tcNumbers);
String familyDescriptionFileName = FilesUtils.generateFileName("familyDescription", ".txt");
// TcdbRetriever.getSubstrates();
//
// Set<String> tcNumbers = TcdbExplorer.getTcNumbers(true);
//
// Set<String> toSearch = TcdbExplorer.generateTCsFamily(tcNumbers);
//
// FindTransporters.saveAllTCFamiliesInformation(toSearch);
//
// Map<String, String> proteinFamilyDescription = TcdbExplorer.getProteinsBelongingToFamilyDescription(tcNumbers);
//
// FilesUtils.saveMapInFile(FilesUtils.getBackupFamilyDescriptionsFilesDirectory().concat("familyDescription.txt"), proteinFamilyDescription);
FilesUtils.saveMapInFile(FilesUtils.getBackupFamilyDescriptionsFilesDirectory().concat(familyDescriptionFileName), proteinFamilyDescription);
//////////
// Map<String, String> proteinFamilyDescription = FilesUtils.readMapFromFile("C:\\Users\\Davide\\Documents\\InternalDB\\proteinFamilyDescriptions.txt");
Map<String, String> proteinFamilyDescription = FilesUtils.readMapFromFile(FilesUtils.getBackupFamilyDescriptionsFilesDirectory().concat("familyDescription.txt"));
logger.info("Search complete!");
//
// int n = 1;
// while (n != 99) {
// Map<Integer, ReactionContainer> container = data.get("2.A.1").getReactionsByID();
......@@ -134,35 +131,35 @@ public class Retriever {
return data;
}
/**
* @param tcdbMetabolites
*/
private static void checkDescriptions(Map<String, TcdbMetabolitesContainer> tcdbMetabolites) {
Set<String> symport = new HashSet<>();
Set<String> uniport = new HashSet<>();
Set<String> antiport = new HashSet<>();
for(String accession : tcdbMetabolites.keySet()) {
TcdbMetabolitesContainer container = tcdbMetabolites.get(accession);
for(String tcNumber : container.getTcNumbers()) {
String description = container.getDescription(tcNumber);
if(description.matches("(?i).*uniport.*"))
uniport.add(tcNumber);
else if(description.matches("(?i).*symport.*"))
symport.add(tcNumber);
else if(description.matches("(?i).*antiport.*"))
antiport.add(tcNumber);
}
}
}
// /**
// * @param tcdbMetabolites
// */
// private static void checkDescriptions(Map<String, TcdbMetabolitesContainer> tcdbMetabolites) {
//
// Set<String> symport = new HashSet<>();
// Set<String> uniport = new HashSet<>();
// Set<String> antiport = new HashSet<>();
//
//
// for(String accession : tcdbMetabolites.keySet()) {
//
// TcdbMetabolitesContainer container = tcdbMetabolites.get(accession);
//
// for(String tcNumber : container.getTcNumbers()) {
//
// String description = container.getDescription(tcNumber);
//
// if(description.matches("(?i).*uniport.*"))
// uniport.add(tcNumber);
// else if(description.matches("(?i).*symport.*"))
// symport.add(tcNumber);
// else if(description.matches("(?i).*antiport.*"))
// antiport.add(tcNumber);
//
// }
// }
//
// }
// List<String> metabolitesAux2 = new ArrayList<>();
//
......
package tcdb.triage;
import pt.uminho.ceb.biosystems.transyt.utilities.files.FilesUtils;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Test {
public static final String PATH = FilesUtils.getBackupFilesDirectory().concat("TCFilesBackup");
public static void main(String[] args) {
String path = PATH.concat(FilesUtils.generateFolderName("version_"));
System.out.println(path);
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\">";
// String text = "text";
System.out.println(molecule);
Pattern p;
Matcher m;
p = Pattern.compile("chemicalFormula=\"(\\S*)\"");
m = p.matcher(molecule);
if(m.find()) {
System.out.println(m.group(1));
}
}
}
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