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

refactoring project

parent 08d839ba
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=9
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=9
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=9
org.eclipse.jdt.core.compiler.source=1.8
......@@ -13,22 +13,28 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.9</source>
<target>1.9</target>
</configuration>
</plugin>
</plugins>
</build>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.9</source>
<target>1.9</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>utilities</groupId>
<artifactId>triage-utilities</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
......@@ -91,14 +97,14 @@
<artifactId>json-simple</artifactId>
<version>1.1.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-server -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
<version>3.9.1</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
<version>3.9.1</version>
</dependency>
</dependencies>
</project>
......@@ -8,7 +8,7 @@ import java.util.concurrent.TimeUnit;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import tcdb.connection.LinkConnection;
import connection.LinkConnection;
public class ReadResults {
......
package tcdb.capsules;
import java.util.HashMap;
import java.util.Map;
import tcdb.tcdbTransportTypesRetriever.TypeOfTransporter;
/**
* @author Davide
*
*/
public class ReactionContainer {
public static final String REVERSIBLE_TOKEN = "$REV$";
public static final String IRREVERSIBLE_TOKEN = "$IRREV$";
public static final String REV_TOKEN = "\\$REV\\$";
public static final String IRREV_TOKEN = "\\$IRREV\\$";
private String originalReaction = "";
private String product = "";
private String reactant = "";
private Boolean reversible = false;
private TypeOfTransporter transportType;
private Map<String, String> properties;
private Integer reactionID = null;
private String confidenceLevel = "0";
/**
* Changes the reactant of the reaction.
*
* @param key
* @param value
*/
public void replaceReactant(String reactant) {
this.reactant = reactant;
}
/**
* Changes the product of the reaction.
*
* @param key
* @param value
*/
public void replaceProduct(String product) {
this.product = product;
}
/**
* Add property to properties map.
*
* @param key
* @param value
*/
public void addProperty(String key, String value) {
properties.put(key, value);
}
/**
* @return the properties
*/
public Map<String, String> getProperties() {
return properties;
}
/**
* Container to store information regarding a single reaction;
*
* @param product
* @param reactant
* @param reversible
*/
public ReactionContainer(String reactant, String product, boolean reversible) {
this.product = product;
this.reactant = reactant;
this.reversible = reversible;
properties = new HashMap();
}
/**
* @return the product
*/
public String getProduct() {
return product;
}
/**
* @return the reactant
*/
public String getReactant() {
return reactant;
}
/**
* @return the reversible
*/
public Boolean getReversible() {
return reversible;
}
/**
* @return the transportType
*/
public TypeOfTransporter getTransportType() {
return transportType;
}
/**
* @param transportType the transportType to set
*/
public void setTransportType(TypeOfTransporter transportType) {
this.transportType = transportType;
}
/**
* Get reaction in string format.
*
* @return
*/
public String getReaction() {
String reaction = reactant.concat(" ");
if(reversible)
reaction = reaction.concat(REVERSIBLE_TOKEN);
else
reaction =reaction.concat(IRREVERSIBLE_TOKEN);
reaction = reaction.concat(" ").concat(product);
return reaction;
}
/**
* @param product the product to set
*/
public void setProduct(String product) {
this.product = product;
}
/**
* @param reactant the reactant to set
*/
public void setReactant(String reactant) {
this.reactant = reactant;
}
/**
* @return the reactionID
*/
public Integer getReactionID() {
return reactionID;
}
/**
* @param reactionID the reactionID to set
*/
public void setReactionID(Integer reactionID) {
this.reactionID = reactionID;
}
/**
* @param properties the properties to set
*/
public void setProperties(Map<String, String> properties) {
this.properties = properties;
}
/**
* @return the originalReaction
*/
public String getOriginalReaction() {
return originalReaction;
}
/**
* @param originalReaction the originalReaction to set
*/
public void setOriginalReaction(String originalReaction) {
this.originalReaction = originalReaction;
}
/**
* @return the originalReaction
*/
public String getDirection() {
if(this.reversible)
return REVERSIBLE_TOKEN;
else
return IRREVERSIBLE_TOKEN;
}
/**
* @return the confidenceLevel
*/
public String getConfidenceLevel() {
return confidenceLevel;
}
/**
* @param confidenceLevel the confidenceLevel to set
*/
public void setConfidenceLevel(String confidenceLevel) {
this.confidenceLevel = confidenceLevel;
}
}
package tcdb.capsules;
import java.util.Set;
public class RowInfo {
private String id;
private Set<String> internalSubstrates;
private Set<String> tcdbSubstrates;
private String tcNumber;
private String description;
private Set<String> transportType;
private String originalInternalDB;
public RowInfo(String id, String tcNumber, String description, Set<String> internalSubstrates, Set<String> tcdbSubstrates,
Set<String> transportType, String originalInternalDB){
this.id = id;
this.tcNumber = tcNumber;
this.description = description;
this.internalSubstrates = internalSubstrates;
this.tcdbSubstrates = tcdbSubstrates;
this.transportType = transportType;
this.originalInternalDB = originalInternalDB;
}
/**
* @return the id
*/
public String getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(String id) {
this.id = id;
}
/**
* @return the internalSubstrates
*/
public Set<String> getInternalSubstrates() {
return internalSubstrates;
}
/**
* @param internalSubstrates the internalSubstrates to set
*/
public void setInternalSubstrates(Set<String> internalSubstrates) {
this.internalSubstrates = internalSubstrates;
}
/**
* @return the tcdbSubstrates
*/
public Set<String> getTcdbSubstrates() {
return tcdbSubstrates;
}
/**
* @param tcdbSubstrates the tcdbSubstrates to set
*/
public void setTcdbSubstrates(Set<String> tcdbSubstrates) {
this.tcdbSubstrates = tcdbSubstrates;
}
/**
* @return the tcNumber
*/
public String getTcNumber() {
return tcNumber;
}
/**
* @param tcNumber the tcNumber to set
*/
public void setTcNumber(String tcNumber) {
this.tcNumber = tcNumber;
}
/**
* @return the description
*/
public String getDescription() {
return description;
}
/**
* @param description the description to set
*/
public void setDescription(String description) {
this.description = description;
}
/**
* @return the transportType
*/
public Set<String> getTransportType() {
return transportType;
}
/**
* @param transportType the transportType to set
*/
public void setTransportType(Set<String> transportType) {
this.transportType = transportType;
}
/**
* @return the originalInternalDB
*/
public String getOriginalInternalDB() {
return originalInternalDB;
}
/**
* @param originalInternalDB the originalInternalDB to set
*/
public void setOriginalInternalDB(String originalInternalDB) {
this.originalInternalDB = originalInternalDB;
}
}
\ No newline at end of file
package tcdb.capsules;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import tcdb.tcdbTransportTypesRetriever.TypeOfTransporter;
public class TcNumberContainer {
private Map<Integer, ReactionContainer> reactions;
private Integer id = 0;
private String superFamily;
private String family;
/**
* Container with all information about a given transporter.
*/
public TcNumberContainer(){
this.reactions = new HashMap<>();
}
/**
* Method to add reaction to the container.
*
* @param reaction
* @param transporter
* @param reversibility
*/
public void addReaction(ReactionContainer reaction) {
reactions.put(id, reaction);
id++;
}
/**
* Get all ids stored in the container.
*
* @return
*/
public Set<Integer> getAllReactionsIds(){
return reactions.keySet();
}
/**
* @return the reactions
*/
public Map<Integer, ReactionContainer> getReactionsByID() {
return reactions;
}
/**
* @return the superFamily
*/
public String getSuperFamily() {
return superFamily;
}
/**
* @param superFamily the superFamily to set
*/
public void setSuperFamily(String superFamily) {
this.superFamily = superFamily;
}
/**
* @return the family
*/
public String getFamily() {
return family;
}
/**
* @param family the family to set
*/
public void setFamily(String family) {
this.family = family;
}
/**
* Get reaction container by ID.
*
* @return
*/
public ReactionContainer getReactionContainer(Integer id){
if(reactions.keySet().contains(id))
return reactions.get(id);
return null;
}
}
package tcdb.capsules;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import tcdb.tcdbTransportTypesRetriever.TypeOfTransporter;
/**
* @author Davide
*
*/
public class TcdbMetabolitesContainer {
public static final String EMPTY = "Empty";
public static final String ELECTRON = "Electron";
public static final String UNKNOWN = "Unknown";
public static final String PROTON = "H+";
private String uniprotID;
private Set<String> tcNumbers;
private Map<String, Set<String>> metabolitesMap;
private Map<String, String> descriptionsMap;
/**
* Container with information retrieved from tcdb about the transported metabolites by each transpot system.
*
* @param uniprotID
*/
public TcdbMetabolitesContainer(String uniprotID) {
this.uniprotID = uniprotID;
this.tcNumbers = new HashSet<>();
this.metabolitesMap = new HashMap<>();
this.descriptionsMap = new HashMap<>();
}
/**
* @return the uniprotID
*/
public String getUniprotID() {
return uniprotID;
}
/**
* Add entry to the container
*
* @param tcNumber
* @param description
* @param metabolites
*/
public void addEntry(String tcNumber, String description, String[] metabolites) {
tcNumbers.add(tcNumber);
descriptionsMap.put(tcNumber, description);
Set<String> met = new HashSet<>();
for(int i = 0; i < metabolites.length; i ++) {
if(!metabolites[i].trim().isEmpty())
met.add(metabolites[i].trim());
}
if(met.isEmpty())
met.add(EMPTY);
metabolitesMap.put(tcNumber, met);
}
/**
* Get the metabolites of a given tcnumber
*
* @param tcNumber
* @return
*/
public Set<String> getMetabolites(String tcNumber){
return metabolitesMap.get(tcNumber);