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

tests

parent fc9cd681
......@@ -6,6 +6,7 @@ import java.util.Map;
import java.util.Scanner;
import java.util.Set;
import org.apache.commons.collections.bag.SynchronizedSortedBag;
import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.graphdb.Node;
import org.neo4j.graphdb.Relationship;
......
......@@ -94,19 +94,19 @@ public class ProvideTransportReactionsToGenes {
logger.info("Beginning transaction with neo4j triage database...");
Transaction dataTx = graphDatabaseService.beginTx();
//////////////////////////
// @SuppressWarnings("resource")
// Scanner reader = new Scanner(System.in);
//
// int n = 1;
//
//
// while (n != 99) {
start();
//
start(); //uncomment
//
// System.out.println("Insert a number to repeat or 99 to finish");
//
// try {
// n = reader.nextInt();
// } catch (Exception e) {
......@@ -116,7 +116,7 @@ public class ProvideTransportReactionsToGenes {
// }
//
// }
/////////////////////////
dataTx.close();
service.shutdown();
graphDatabaseService.shutdown();
......@@ -181,7 +181,7 @@ public class ProvideTransportReactionsToGenes {
reactionsByTcNumber = getReactionsByTcNumber(identifyTcNumbersForSearch());
// System.out.println(reactionContainersByID.containsKey("2.A.63.1.4"));
// System.out.println(reactionContainersByID.containsKey("2.A.63.1.4"));
Map<String, GeneContainer> data = buildGenesContainers();
......@@ -192,7 +192,7 @@ public class ProvideTransportReactionsToGenes {
logger.debug("Reactions search complete!");
Reports.generateKBaseReport(jobIdentification, organism, taxID, queryFileTotalOfGenes, properties, finalResults);
// System.out.println("coiso");
// tests();
}
......@@ -227,6 +227,24 @@ public class ProvideTransportReactionsToGenes {
private void tests() {
// for(String key : finalResults.keySet())
// System.out.println(key);
// String query = "WP_046131677.1 MULTISPECIES: DedA family protein [Bacillus]";
//
// System.out.println(finalResults.containsKey(query));
//
// if(blastResults.containsKey(query)) {
//
// System.out.println(blastResults.get(query).size());
//
// for(AlignmentCapsule capsule : blastResults.get(query)) {
// System.out.println(capsule.getTarget() + "\t" + capsule.getTcdbID());
// }
// }
// }
// System.out.println("TESTES!!!");
// for(AlignmentCapsule capsule : blastResults.get("WP_046131684.1 MULTISPECIES: Na+/H+ antiporter subunit D [Bacillus]"))
......@@ -234,32 +252,44 @@ public class ProvideTransportReactionsToGenes {
//
// Set<String> res = new HashSet<>();
System.out.println(finalResults.size());
// System.out.println(finalResults.size());
// //
// for(String key : finalResults.keySet()) {
//
for(String key : finalResults.keySet()) {
System.out.print(key + "\t");
for(String tc : finalResults.get(key).keySet()) {
System.out.print(tc + "\t");
// for(String reactionID : finalResults.get(key).get(tc))
// res.add(reactionContainersByID.get(reactionID).getReaction());
// System.out.println(key + "\t" + tc + "\t");// + reactionContainersByID.get(reactionID));
}
System.out.println();
}
// System.out.print(key + "\t");
//
// for(String tc : finalResults.get(key).keySet()) {
//
// System.out.print(tc + "\t");
//
// // for(String reactionID : finalResults.get(key).get(tc))
// // res.add(reactionContainersByID.get(reactionID).getReaction());
// // System.out.println(key + "\t" + tc + "\t");// + reactionContainersByID.get(reactionID));
//
// }
// System.out.println();
// }
// for(String coiso : res)
// System.out.println(coiso);
// Node node = service.findTcNumberNode("2.A.63.1.4");
// Node node = service.findUniprotAccessionNode("P0ABP6");
//
//
//
// if(node!= null) {
//
// System.out.println(node.getAllProperties());
//
// }
// Node node = service.findTcNumberNode("9.B.27.2.5");
//
// if(node!= null) {
//
// System.out.println(node.getAllProperties());
//
// Iterable<Relationship> relations = node.getRelationships(TriageRelationshipType.has_reaction);
//
// for(Relationship rel : relations) {
......@@ -277,7 +307,7 @@ public class ProvideTransportReactionsToGenes {
Map<String, Set<String>> containers = new HashMap<>();
// System.out.println(identifyTcNumbersForSearch.contains("2.A.63.1.4"));
// System.out.println(identifyTcNumbersForSearch.contains("2.A.63.1.4"));
for(String tcNumber : identifyTcNumbersForSearch) {
......@@ -325,8 +355,8 @@ public class ProvideTransportReactionsToGenes {
}
// System.out.println(tcNumbersNotPresentInTRIAGEdatabase.contains("2.A.63.1.4"));
// System.out.println(containers.containsKey("2.A.63.1.4"));
// System.out.println(tcNumbersNotPresentInTRIAGEdatabase.contains("2.A.63.1.4"));
// System.out.println(containers.containsKey("2.A.63.1.4"));
return containers;
}
......
......@@ -13,7 +13,7 @@ public class TriageNeo4jInitializer {
private static final Logger logger = LoggerFactory.getLogger(WriteByMetabolitesID.class);
private static final String PATH = "C:/Users/Davide/Documents/neo4j-community-3.4.1/data/databases/triage45.db";
private static final String PATH = "C:/Users/Davide/Documents/neo4j-community-3.4.1/data/databases/triage48.db";
/**
* initialize triage neo4j database.
......
......@@ -21,6 +21,7 @@ import pt.uminho.sysbio.biosynth.integration.io.dao.neo4j.MetaboliteMajorLabel;
import reactions.TransportReactionsBuilder;
import tcdb.capsules.ReactionContainer;
import uk.ac.ebi.kraken.interfaces.uniprot.UniProtEntry;
import utilities.FileUtils;
class Test {
......@@ -37,12 +38,12 @@ class Test {
}
@org.junit.jupiter.api.Test
// @org.junit.jupiter.api.Test
void test2() {
System.out.println(FilesUtils.readGenerationsLimitFile("C:\\Users\\Davide\\Documents\\reactionsBuilderTriage\\ChildsExceptions.txt"));
// TransportReactionsBuilder.isEquationBalanced("C4H7O2 (out) + C21H32N7O16P3S1 (in) + C10H12N5O13P3 (in) $IRREV$ C25H38N7O17P3S1 (in) + C10H12N5O7P1 (in) + H1O7P2 (in)", ReactionContainer.IRREV_TOKEN);
// TransportReactionsBuilder.isEquationBalanced("C4H7O2 (out) + C21H32N7O16P3S1 (in) + C10H12N5O13P3 (in) $IRREV$ C25H38N7O17P3S1 (in) + C10H12N5O7P1 (in) + H1O7P2 (in)", ReactionContainer.IRREV_TOKEN);
}
......@@ -144,7 +145,7 @@ class Test {
}
// @org.junit.jupiter.api.Test
// @org.junit.jupiter.api.Test
void tests2() {
System.out.println("TR_".concat(String.format("%06d", 1)));
......@@ -263,4 +264,68 @@ class Test {
}
}
@org.junit.jupiter.api.Test
void mappingKeggIDToModelSEED() throws IOException {
Map<String, Map<MetaboliteMajorLabel, String>> compounds = FileUtils.readMapFromFile2("C:\\Users\\Davide\\Documents\\InternalDB\\info\\getMetabolitesIDs3.txt");
Map<String, Set<String>> res = new HashMap<>();
for(String key : compounds.keySet()) {
Map<MetaboliteMajorLabel, String> identifiers = compounds.get(key);
if(identifiers.containsKey(MetaboliteMajorLabel.LigandCompound) && identifiers.containsKey(MetaboliteMajorLabel.ModelSeed)) {
String keggID = identifiers.get(MetaboliteMajorLabel.LigandCompound);
String modelSEED = identifiers.get(MetaboliteMajorLabel.ModelSeed);
if(res.containsKey(keggID)) {
res.get(keggID).add(modelSEED);
}
else {
Set<String> set = new HashSet<>();
set.add(modelSEED);
res.put(keggID, set);
}
}
else if(identifiers.containsKey(MetaboliteMajorLabel.LigandGlycan) && identifiers.containsKey(MetaboliteMajorLabel.ModelSeed)) {
String keggID = identifiers.get(MetaboliteMajorLabel.LigandGlycan);
String modelSEED = identifiers.get(MetaboliteMajorLabel.ModelSeed);
if(res.containsKey(keggID)) {
res.get(keggID).add(modelSEED);
}
else {
Set<String> set = new HashSet<>();
set.add(modelSEED);
res.put(keggID, set);
}
}
else if(identifiers.containsKey(MetaboliteMajorLabel.LigandDrug) && identifiers.containsKey(MetaboliteMajorLabel.ModelSeed)) {
String keggID = identifiers.get(MetaboliteMajorLabel.LigandDrug);
String modelSEED = identifiers.get(MetaboliteMajorLabel.ModelSeed);
if(res.containsKey(keggID)) {
res.get(keggID).add(modelSEED);
}
else {
Set<String> set = new HashSet<>();
set.add(modelSEED);
res.put(keggID, set);
}
}
}
FilesUtils.saveMapInFile3("C:\\Users\\Davide\\Desktop\\KEGG_To_ModelSEED.txt", res);
}
}
......@@ -12,12 +12,26 @@ import utilities.triage_utilities.Utilities;
class TriageMain {
@Test
// @Test
void test() {
// int count = 1;
// double[] blastThresholds = {1E-30, 1E-60, 1E-90};
// double[] queryCoverages = {0.4, 0.6, 0.8};
String path = "C:\\Users\\Davide\\OneDrive - Universidade do Minho\\UMinho\\Tese\\KBase\\Genomes\\Bacillus glycinifermentans\\GCF_900093775.1.faa";
new ProvideTransportReactionsToGenes(1664069, path, new Properties()); //29421 - Nitrobacter vulgaris
}
@Test
void batchTest() {
int count = 1;
double[] blastThresholds = {1E-60, 1E-90};
double[] blastThresholds = {1E-30, 1E-60, 1E-90};
double[] queryCoverages = {0.4, 0.6, 0.8};
Set<String> paths = FilesUtils.readWordsInFile("C:\\Users\\Davide\\OneDrive - Universidade do Minho\\UMinho\\Tese\\KBase\\Reports\\paths.txt");
......@@ -41,6 +55,8 @@ class TriageMain {
properties.setQueryCoverage(queryCoverage);
properties.seteValueThreshold(blastThresh);
System.out.println(path);
new ProvideTransportReactionsToGenes(taxID, path, properties); //29421 - Nitrobacter vulgaris
System.out.println(count + " job complete");
......
......@@ -36,12 +36,12 @@ class Uniprot {
}
// @Test
@Test
void test2() {
List<String> toSearch = new ArrayList<>();
toSearch.add("Q97XW7"); //[Q97xw7, B0R9X2, P87020, O07620, Q7JZR2]
toSearch.add("C7RGN6"); //[Q97xw7, B0R9X2, P87020, O07620, Q7JZR2]
List<UniProtEntry> res = UniProtAPI.getEntriesFromUniProtIDs(toSearch, 0);
......@@ -55,7 +55,7 @@ class Uniprot {
}
}
@Test
// @Test
void test3() {
TaxonomyContainer res = UniprotAPIExtension.getTaxonomyFromNCBITaxnomyID(29421, 0);
......
#Generated by Maven Integration for Eclipse
#Thu Jul 26 15:55:43 BST 2018
#Tue Aug 07 13:21:13 BST 2018
m2e.projectLocation=C\:\\Users\\Davide\\Biosynth2\\biosynth
m2e.projectName=biosynth
groupId=Biosynth
......
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