Merge branch 'master' into ModelingGenerator
This commit is contained in:
commit
180cc0179e
20 changed files with 587 additions and 77 deletions
6
.gitignore
vendored
6
.gitignore
vendored
|
|
@ -13,3 +13,9 @@ bin/iBioSim.jar
|
||||||
.settings/
|
.settings/
|
||||||
**/.project
|
**/.project
|
||||||
/.metadata/
|
/.metadata/
|
||||||
|
|
||||||
|
# intellij artefacts
|
||||||
|
out
|
||||||
|
*.iws
|
||||||
|
*.ipr
|
||||||
|
*.iml
|
||||||
|
|
|
||||||
|
|
@ -336,7 +336,7 @@ public class SBML2SBOL {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
compDef_type.add(ComponentDefinition.DNA);
|
compDef_type.add(ComponentDefinition.DNA_REGION);
|
||||||
compDef_role.add(SequenceOntology.PROMOTER);
|
compDef_role.add(SequenceOntology.PROMOTER);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -357,10 +357,10 @@ public class SBML2SBOL {
|
||||||
if (species.isSetSBOTerm()) {
|
if (species.isSetSBOTerm()) {
|
||||||
if (species.getSBOTermID().equals(GlobalConstants.SBO_DNA) ||
|
if (species.getSBOTermID().equals(GlobalConstants.SBO_DNA) ||
|
||||||
species.getSBOTermID().equals(GlobalConstants.SBO_DNA_SEGMENT)) {
|
species.getSBOTermID().equals(GlobalConstants.SBO_DNA_SEGMENT)) {
|
||||||
compDef_type.add(ComponentDefinition.DNA);
|
compDef_type.add(ComponentDefinition.DNA_REGION);
|
||||||
} else if (species.getSBOTermID().equals(GlobalConstants.SBO_RNA) ||
|
} else if (species.getSBOTermID().equals(GlobalConstants.SBO_RNA) ||
|
||||||
species.getSBOTermID().equals(GlobalConstants.SBO_RNA_SEGMENT)) {
|
species.getSBOTermID().equals(GlobalConstants.SBO_RNA_SEGMENT)) {
|
||||||
compDef_type.add(ComponentDefinition.RNA);
|
compDef_type.add(ComponentDefinition.RNA_REGION);
|
||||||
} else if (species.getSBOTermID().equals(GlobalConstants.SBO_PROTEIN)) {
|
} else if (species.getSBOTermID().equals(GlobalConstants.SBO_PROTEIN)) {
|
||||||
compDef_type.add(ComponentDefinition.PROTEIN);
|
compDef_type.add(ComponentDefinition.PROTEIN);
|
||||||
} else if (species.getSBOTermID().equals(GlobalConstants.SBO_NONCOVALENT_COMPLEX) ||
|
} else if (species.getSBOTermID().equals(GlobalConstants.SBO_NONCOVALENT_COMPLEX) ||
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.sbml.jsbml</groupId>
|
<groupId>org.sbml.jsbml</groupId>
|
||||||
<artifactId>jsbml</artifactId>
|
<artifactId>jsbml</artifactId>
|
||||||
<version>1.3-SNAPSHOT</version>
|
<version>1.4</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
@ -84,7 +84,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.sbolstandard</groupId>
|
<groupId>org.sbolstandard</groupId>
|
||||||
<artifactId>libSBOLj</artifactId>
|
<artifactId>libSBOLj</artifactId>
|
||||||
<version>2.3.2-SNAPSHOT</version>
|
<version>2.4.1-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-math3 -->
|
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-math3 -->
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,64 @@
|
||||||
|
package edu.utah.ece.async.ibiosim.dataModels.ebiBiomodels;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.GsonBuilder;
|
||||||
|
import org.apache.http.Header;
|
||||||
|
import org.apache.http.HttpEntity;
|
||||||
|
import org.apache.http.HttpResponse;
|
||||||
|
import org.apache.http.StatusLine;
|
||||||
|
import org.apache.http.client.ClientProtocolException;
|
||||||
|
import org.apache.http.client.HttpResponseException;
|
||||||
|
import org.apache.http.client.ResponseHandler;
|
||||||
|
import org.apache.http.entity.ContentType;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.nio.charset.Charset;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Mihai Glon\u021b mglont@ebi.ac.uk
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("WeakerAccess")
|
||||||
|
public abstract class AbstractResponseHandler<T> implements ResponseHandler<T> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public T handleResponse(HttpResponse response) throws IOException {
|
||||||
|
StatusLine statusLine = response.getStatusLine();
|
||||||
|
HttpEntity entity = response.getEntity();
|
||||||
|
if (statusLine.getStatusCode() == 307) {
|
||||||
|
//noinspection unused
|
||||||
|
final Header location = response.getFirstHeader("Location");
|
||||||
|
// TODO follow the redirection if location is not null
|
||||||
|
}
|
||||||
|
return parseResponse(statusLine, entity, getObjectMappingClass());
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract Class<T> getObjectMappingClass();
|
||||||
|
|
||||||
|
protected T parseResponse(StatusLine statusLine, HttpEntity entity, Class<T> pojoClass)
|
||||||
|
throws IOException {
|
||||||
|
if (statusLine.getStatusCode() >= 400) {
|
||||||
|
throw new HttpResponseException(
|
||||||
|
statusLine.getStatusCode(),
|
||||||
|
statusLine.getReasonPhrase());
|
||||||
|
}
|
||||||
|
if (entity == null) {
|
||||||
|
throw new ClientProtocolException("Response contains no content");
|
||||||
|
}
|
||||||
|
ContentType contentType = ContentType.getOrDefault(entity);
|
||||||
|
Charset charset = contentType.getCharset() != null ? contentType.getCharset() :
|
||||||
|
StandardCharsets.UTF_8;
|
||||||
|
|
||||||
|
try (BufferedReader reader = new BufferedReader(
|
||||||
|
new InputStreamReader(entity.getContent(), charset))) {
|
||||||
|
return unmarshallContent(reader, pojoClass);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected T unmarshallContent(BufferedReader reader, Class<T> type) {
|
||||||
|
Gson gson = new GsonBuilder().create();
|
||||||
|
return gson.fromJson(reader, type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,101 @@
|
||||||
|
package edu.utah.ece.async.ibiosim.dataModels.ebiBiomodels;
|
||||||
|
|
||||||
|
import org.apache.http.client.methods.HttpGet;
|
||||||
|
import org.apache.http.impl.client.CloseableHttpClient;
|
||||||
|
import org.apache.http.impl.client.HttpClients;
|
||||||
|
|
||||||
|
import static edu.utah.ece.async.ibiosim.dataModels.ebiBiomodels.Requests.SEARCH_RESULTS_PER_PAGE;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.TreeSet;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.IntStream;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Mihai Glon\u021b mglont@ebi.ac.uk
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("WeakerAccess")
|
||||||
|
public class BioModelsConnectionService implements AutoCloseable {
|
||||||
|
private final CloseableHttpClient client;
|
||||||
|
|
||||||
|
public BioModelsConnectionService() {
|
||||||
|
this(HttpClients.createDefault());
|
||||||
|
}
|
||||||
|
|
||||||
|
public BioModelsConnectionService(CloseableHttpClient client) {
|
||||||
|
this.client = Objects.requireNonNull(client, "The HttpClient cannot be null");
|
||||||
|
}
|
||||||
|
|
||||||
|
public ModelResponse getModel(String m) {
|
||||||
|
final HttpGet request = Requests.newGetModelRequest(m);
|
||||||
|
return performRequest(request, new GetModelResponseHandler());
|
||||||
|
}
|
||||||
|
|
||||||
|
public CuratedModelsResponse getCuratedModelSet() {
|
||||||
|
final HttpGet request = Requests.newCuratedModelSearchRequest();
|
||||||
|
CuratedModelsResponse firstPage = performRequest(request, new CuratedModelsResponseHandler());
|
||||||
|
if (null == firstPage) return null;
|
||||||
|
|
||||||
|
return doGetAllCuratedModels(firstPage);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getModelFileName(String model) {
|
||||||
|
HttpGet filesRequest = Requests.newGetFilesRequest(model);
|
||||||
|
|
||||||
|
ModelFilesResponse files = performRequest(filesRequest, new GetFilesResponseHandler());
|
||||||
|
if (null == files) return null;
|
||||||
|
|
||||||
|
return files.getMainFileName();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ModelFileResponse getModelFile(String model) {
|
||||||
|
String mainFileName = getModelFileName(model);
|
||||||
|
if (mainFileName == null) return null;
|
||||||
|
HttpGet modelFileRequest = Requests.newGetModelFileRequest(model, mainFileName);
|
||||||
|
return performRequest(modelFileRequest, new GetModelFileResponseHandler());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void close() {
|
||||||
|
try {
|
||||||
|
client.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
System.err.printf("Could not close the HttpClient instance: %s%n", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private CuratedModelsResponse doGetAllCuratedModels(CuratedModelsResponse firstPage) {
|
||||||
|
int total = firstPage.getMatches();
|
||||||
|
int pageCount = (int) Math.ceil(((double) total) / SEARCH_RESULTS_PER_PAGE);
|
||||||
|
Stream<ModelSummary> remainder = IntStream.range(1, pageCount)
|
||||||
|
.mapToObj(this::getSearchResultsPage)
|
||||||
|
.filter(p -> p != null) // requests that threw exceptions return null
|
||||||
|
.flatMap(CuratedModelsResponse::getModelsStream);
|
||||||
|
|
||||||
|
Set<ModelSummary> responses = Stream.concat(firstPage.getModelsStream(), remainder)
|
||||||
|
.collect(Collectors.toCollection(TreeSet::new));
|
||||||
|
|
||||||
|
return new CuratedModelsResponse(responses);
|
||||||
|
}
|
||||||
|
|
||||||
|
private <T> T performRequest(HttpGet request, AbstractResponseHandler<T> responseHandler) {
|
||||||
|
try {
|
||||||
|
return client.execute(request, responseHandler);
|
||||||
|
} catch (IOException e) {
|
||||||
|
System.err.printf("I/O exception encountered while performing request %s: %s%n",
|
||||||
|
request.getURI().toString(), e);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private CuratedModelsResponse getSearchResultsPage(int page) {
|
||||||
|
if (page < 1) throw new IllegalArgumentException(String.valueOf(page));
|
||||||
|
|
||||||
|
final int offset = page * SEARCH_RESULTS_PER_PAGE;
|
||||||
|
HttpGet request = Requests.newCuratedModelSearchRequest(offset);
|
||||||
|
return performRequest(request, new CuratedModelsResponseHandler());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,37 @@
|
||||||
|
package edu.utah.ece.async.ibiosim.dataModels.ebiBiomodels;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Mihai Glon\u021b mglont@ebi.ac.uk
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
public class CuratedModelsResponse {
|
||||||
|
private int matches;
|
||||||
|
private Set<ModelSummary> models;
|
||||||
|
|
||||||
|
public CuratedModelsResponse() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public CuratedModelsResponse(Set<ModelSummary> models) {
|
||||||
|
this.models = models;
|
||||||
|
if (null == models) {
|
||||||
|
matches = 0;
|
||||||
|
} else {
|
||||||
|
matches = models.size();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Stream<ModelSummary> getModelsStream() {
|
||||||
|
return models.parallelStream();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMatches() {
|
||||||
|
return matches;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Set<ModelSummary> getModels() {
|
||||||
|
return models;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
package edu.utah.ece.async.ibiosim.dataModels.ebiBiomodels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Mihai Glon\u021b mglont@ebi.ac.uk
|
||||||
|
*/
|
||||||
|
public class CuratedModelsResponseHandler extends AbstractResponseHandler<CuratedModelsResponse> {
|
||||||
|
@Override
|
||||||
|
protected Class<CuratedModelsResponse> getObjectMappingClass() {
|
||||||
|
return CuratedModelsResponse.class;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
package edu.utah.ece.async.ibiosim.dataModels.ebiBiomodels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Mihai Glon\u021b mglont@ebi.ac.uk
|
||||||
|
*/
|
||||||
|
public class GetFilesResponseHandler extends AbstractResponseHandler<ModelFilesResponse> {
|
||||||
|
@Override
|
||||||
|
protected Class<ModelFilesResponse> getObjectMappingClass() {
|
||||||
|
return ModelFilesResponse.class;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
package edu.utah.ece.async.ibiosim.dataModels.ebiBiomodels;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Mihai Glon\u021b mglont@ebi.ac.uk
|
||||||
|
*/
|
||||||
|
public class GetModelFileResponseHandler extends AbstractResponseHandler<ModelFileResponse> {
|
||||||
|
@Override
|
||||||
|
protected Class<ModelFileResponse> getObjectMappingClass() {
|
||||||
|
return ModelFileResponse.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected ModelFileResponse unmarshallContent(BufferedReader reader, Class<ModelFileResponse> type) {
|
||||||
|
return ModelFileResponse.parse(reader);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
package edu.utah.ece.async.ibiosim.dataModels.ebiBiomodels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Mihai Glon\u021b mglont@ebi.ac.uk
|
||||||
|
*/
|
||||||
|
public final class GetModelResponseHandler extends AbstractResponseHandler<ModelResponse> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<ModelResponse> getObjectMappingClass() {
|
||||||
|
return ModelResponse.class;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,35 @@
|
||||||
|
package edu.utah.ece.async.ibiosim.dataModels.ebiBiomodels;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.PrintWriter;
|
||||||
|
import java.io.StringWriter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Mihai Glon\u021b mglont@ebi.ac.uk>
|
||||||
|
*/
|
||||||
|
public class ModelFileResponse {
|
||||||
|
private String fileContent;
|
||||||
|
|
||||||
|
public static ModelFileResponse parse(BufferedReader reader) {
|
||||||
|
ModelFileResponse response = new ModelFileResponse();
|
||||||
|
|
||||||
|
StringWriter stringWriter = new StringWriter(8192);
|
||||||
|
try (PrintWriter writer = new PrintWriter(stringWriter)) {
|
||||||
|
String currentLine;
|
||||||
|
while ((currentLine = reader.readLine()) != null) {
|
||||||
|
writer.write(currentLine);
|
||||||
|
writer.println();
|
||||||
|
}
|
||||||
|
response.fileContent = stringWriter.toString();
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new IllegalStateException("Failed to read model file contents", e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFileContent() {
|
||||||
|
return fileContent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
package edu.utah.ece.async.ibiosim.dataModels.ebiBiomodels;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@SuppressWarnings("WeakerAccess,unused")
|
||||||
|
public class ModelFilesResponse {
|
||||||
|
@SuppressWarnings("MismatchedQueryAndUpdateOfCollection")
|
||||||
|
private List<RepositoryFile> main;
|
||||||
|
private List<RepositoryFile> additional;
|
||||||
|
|
||||||
|
public static final class RepositoryFile {
|
||||||
|
private String name;
|
||||||
|
private String description;
|
||||||
|
private int fileSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMainFileName() {
|
||||||
|
return main.get(0).name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,35 @@
|
||||||
|
package edu.utah.ece.async.ibiosim.dataModels.ebiBiomodels;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Mihai Glon\u021b mglont@ebi.ac.uk
|
||||||
|
*/
|
||||||
|
public class ModelResponse {
|
||||||
|
private String name;
|
||||||
|
private String submissionId;
|
||||||
|
private Publication publication;
|
||||||
|
|
||||||
|
private class Publication {
|
||||||
|
private String link;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPublicationLink() {
|
||||||
|
if (null == publication) return null;
|
||||||
|
|
||||||
|
return publication.link;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
final StringBuilder response = new StringBuilder();
|
||||||
|
|
||||||
|
response.append("Model id ")
|
||||||
|
.append(submissionId)
|
||||||
|
.append(" (")
|
||||||
|
.append(name)
|
||||||
|
.append(")");
|
||||||
|
|
||||||
|
return response.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
package edu.utah.ece.async.ibiosim.dataModels.ebiBiomodels;
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
public class ModelSummary implements Comparable<ModelSummary> {
|
||||||
|
private String id;
|
||||||
|
private String name;
|
||||||
|
private Publication publication;
|
||||||
|
|
||||||
|
public static class Publication {
|
||||||
|
private String link;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPublicationLink() {
|
||||||
|
return null == publication ? null : publication.link;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toString() {
|
||||||
|
return id + ' ' + name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int compareTo(ModelSummary o) {
|
||||||
|
return id.compareTo(o.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
return (o instanceof ModelSummary) && ((ModelSummary) o).getId().equals(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,56 @@
|
||||||
|
package edu.utah.ece.async.ibiosim.dataModels.ebiBiomodels;
|
||||||
|
|
||||||
|
import org.apache.http.client.methods.HttpGet;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Mihai Glon\u021b mglont@ebi.ac.uk
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("WeakerAccess")
|
||||||
|
public final class Requests {
|
||||||
|
// can also use the Caltech instance: http://biomodels.caltech.edu/
|
||||||
|
public static final String BIOMODELS_EBI_BASE = "https://www.ebi.ac.uk/biomodels/";
|
||||||
|
public static final String SEARCH_CMD =
|
||||||
|
"search?query=curationstatus%3AManually%20curated&sort=id-desc";
|
||||||
|
public static final String GET_FILES_CMD = "model/files/";
|
||||||
|
public static final String DLD_MODEL_CMD = "model/download/";
|
||||||
|
public static final int SEARCH_RESULTS_PER_PAGE = 100;
|
||||||
|
|
||||||
|
public static HttpGet newGetModelRequest(String model) {
|
||||||
|
final String url = String.format("%s%s", BIOMODELS_EBI_BASE,
|
||||||
|
Objects.requireNonNull(model, "Model identifier (e.g. BIOMD0000000001) required"));
|
||||||
|
return constructSignedJsonGetRequest(url);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static HttpGet newCuratedModelSearchRequest() {
|
||||||
|
return newCuratedModelSearchRequest(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static HttpGet newCuratedModelSearchRequest(int offset) {
|
||||||
|
String url = String.format("%s%s&offset=%d&numResults=%d", BIOMODELS_EBI_BASE,
|
||||||
|
SEARCH_CMD, offset, SEARCH_RESULTS_PER_PAGE);
|
||||||
|
return constructSignedJsonGetRequest(url);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static HttpGet newGetModelFileRequest(String modelId, String fileName) {
|
||||||
|
String url = String.format("%s%s%s?filename=%s", BIOMODELS_EBI_BASE, DLD_MODEL_CMD,
|
||||||
|
Objects.requireNonNull(modelId, "The model identifier is required"),
|
||||||
|
Objects.requireNonNull(fileName, "Model file name is required"));
|
||||||
|
return constructSignedJsonGetRequest(url);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static HttpGet newGetFilesRequest(String modelId) {
|
||||||
|
String getFilesUrl = String.format("%s%s%s", BIOMODELS_EBI_BASE, GET_FILES_CMD,
|
||||||
|
Objects.requireNonNull(modelId, "The model identifier is required"));
|
||||||
|
return constructSignedJsonGetRequest(getFilesUrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static HttpGet constructSignedJsonGetRequest(String uri) {
|
||||||
|
final HttpGet request = new HttpGet(uri);
|
||||||
|
request.setHeader("User-Agent", "iBioSim <https://github.com/MyersResearchGroup/iBioSim>");
|
||||||
|
request.setHeader("Accept", "application/json");
|
||||||
|
|
||||||
|
return request;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,80 @@
|
||||||
|
package edu.utah.ece.async.ibiosim.biomodels;
|
||||||
|
|
||||||
|
import org.apache.http.impl.client.HttpClients;
|
||||||
|
import org.junit.After;
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import edu.utah.ece.async.ibiosim.dataModels.ebiBiomodels.BioModelsConnectionService;
|
||||||
|
import edu.utah.ece.async.ibiosim.dataModels.ebiBiomodels.CuratedModelsResponse;
|
||||||
|
import edu.utah.ece.async.ibiosim.dataModels.ebiBiomodels.ModelFileResponse;
|
||||||
|
import edu.utah.ece.async.ibiosim.dataModels.ebiBiomodels.ModelResponse;
|
||||||
|
import edu.utah.ece.async.ibiosim.dataModels.ebiBiomodels.ModelSummary;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Mihai Glon\u021b mglont@ebi.ac.uk
|
||||||
|
*/
|
||||||
|
public class BioModelsConnectionServiceTest {
|
||||||
|
private BioModelsConnectionService service;
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void setUp() {
|
||||||
|
service = new BioModelsConnectionService(HttpClients.createMinimal());
|
||||||
|
}
|
||||||
|
|
||||||
|
@After
|
||||||
|
public void tearDown() throws Exception {
|
||||||
|
Optional.ofNullable(service).ifPresent(BioModelsConnectionService::close);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void shouldRetrieveAModel() {
|
||||||
|
String expected = "Model id MODEL6615119181 (Kholodenko2000 - " +
|
||||||
|
"Ultrasensitivity and negative feedback bring oscillations in MAPK cascade)";
|
||||||
|
ModelResponse response = service.getModel("MODEL6615119181");
|
||||||
|
|
||||||
|
assertEquals("the correct model is retrieved", expected, response.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void shouldGetCuratedModelSet() {
|
||||||
|
CuratedModelsResponse response = service.getCuratedModelSet();
|
||||||
|
assertNotNull("the response object is defined", response);
|
||||||
|
assertTrue("Have at least 700 models", response.getMatches() > 700);
|
||||||
|
assertTrue(response.getModels().size() == response.getMatches());
|
||||||
|
|
||||||
|
String biomd738 = "BIOMD0000000738 Mouse Iron Distribution - Rich iron diet (No Tracer)";
|
||||||
|
Optional<ModelSummary> match = response.getModelsStream()
|
||||||
|
.filter(summary -> summary.toString().equals(biomd738))
|
||||||
|
.findAny();
|
||||||
|
assertTrue("BIOMD0000000738 is in the search results", match.isPresent());
|
||||||
|
|
||||||
|
/*response.getModelsStream()
|
||||||
|
.map(ModelSummary::getId)
|
||||||
|
.forEachOrdered(System.out::println);*/
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void shouldRetrieveModelFileNameForAKnownModel() {
|
||||||
|
String name = service.getModelFileName("BIOMD0000000044");
|
||||||
|
assertEquals("BIOMD0000000044_url.xml is the model file name", "BIOMD0000000044_url.xml", name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void shouldRetrieveModelFileContents() {
|
||||||
|
ModelFileResponse response = service.getModelFile("BIOMD0000000044");
|
||||||
|
|
||||||
|
assertNotNull(response);
|
||||||
|
String content = response.getFileContent();
|
||||||
|
assertNotNull(content);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test(expected = NullPointerException.class)
|
||||||
|
public void shouldThrowExceptionWhenRetrievingFilesForUndefinedModel() {
|
||||||
|
service.getModelFileName(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -104,6 +104,7 @@ import javax.xml.xpath.XPathExpressionException;
|
||||||
import org.antlr.runtime.ANTLRFileStream;
|
import org.antlr.runtime.ANTLRFileStream;
|
||||||
import org.antlr.runtime.CommonTokenStream;
|
import org.antlr.runtime.CommonTokenStream;
|
||||||
import org.antlr.runtime.TokenStream;
|
import org.antlr.runtime.TokenStream;
|
||||||
|
import org.apache.http.impl.client.HttpClients;
|
||||||
import org.jdom2.JDOMException;
|
import org.jdom2.JDOMException;
|
||||||
import org.jlibsedml.AbstractTask;
|
import org.jlibsedml.AbstractTask;
|
||||||
import org.jlibsedml.ArchiveComponents;
|
import org.jlibsedml.ArchiveComponents;
|
||||||
|
|
@ -175,7 +176,6 @@ import edu.utah.ece.async.sboldesigner.sbol.editor.SBOLEditorPreferences;
|
||||||
import edu.utah.ece.async.sboldesigner.sbol.editor.SynBioHubFrontends;
|
import edu.utah.ece.async.sboldesigner.sbol.editor.SynBioHubFrontends;
|
||||||
import edu.utah.ece.async.sboldesigner.sbol.editor.dialog.RegistryInputDialog;
|
import edu.utah.ece.async.sboldesigner.sbol.editor.dialog.RegistryInputDialog;
|
||||||
import uk.ac.ebi.biomodels.ws.BioModelsWSClient;
|
import uk.ac.ebi.biomodels.ws.BioModelsWSClient;
|
||||||
import uk.ac.ebi.biomodels.ws.BioModelsWSException;
|
|
||||||
import de.unirostock.sems.cbarchive.ArchiveEntry;
|
import de.unirostock.sems.cbarchive.ArchiveEntry;
|
||||||
import de.unirostock.sems.cbarchive.CombineArchive;
|
import de.unirostock.sems.cbarchive.CombineArchive;
|
||||||
import de.unirostock.sems.cbarchive.CombineArchiveException;
|
import de.unirostock.sems.cbarchive.CombineArchiveException;
|
||||||
|
|
@ -200,6 +200,7 @@ import edu.utah.ece.async.ibiosim.dataModels.util.Message;
|
||||||
import edu.utah.ece.async.ibiosim.dataModels.util.SEDMLutilities;
|
import edu.utah.ece.async.ibiosim.dataModels.util.SEDMLutilities;
|
||||||
import edu.utah.ece.async.ibiosim.dataModels.util.exceptions.BioSimException;
|
import edu.utah.ece.async.ibiosim.dataModels.util.exceptions.BioSimException;
|
||||||
import edu.utah.ece.async.ibiosim.dataModels.util.observe.BioObserver;
|
import edu.utah.ece.async.ibiosim.dataModels.util.observe.BioObserver;
|
||||||
|
import edu.utah.ece.async.ibiosim.dataModels.ebiBiomodels.*;
|
||||||
import edu.utah.ece.async.ibiosim.dataModels.util.exceptions.SBOLException;
|
import edu.utah.ece.async.ibiosim.dataModels.util.exceptions.SBOLException;
|
||||||
import edu.utah.ece.async.ibiosim.gui.analysisView.AnalysisView;
|
import edu.utah.ece.async.ibiosim.gui.analysisView.AnalysisView;
|
||||||
import edu.utah.ece.async.ibiosim.gui.graphEditor.Graph;
|
import edu.utah.ece.async.ibiosim.gui.graphEditor.Graph;
|
||||||
|
|
@ -306,13 +307,11 @@ public class Gui implements BioObserver, MouseListener, ActionListener, MouseMot
|
||||||
|
|
||||||
protected String viewer;
|
protected String viewer;
|
||||||
|
|
||||||
protected boolean runGetNames;
|
|
||||||
|
|
||||||
// protected boolean showParts = false;
|
// protected boolean showParts = false;
|
||||||
|
|
||||||
// protected Thread getPartsThread = null;
|
// protected Thread getPartsThread = null;
|
||||||
|
|
||||||
private String[] BioModelIds = null;
|
private ModelSummary[] BioModelIds = null;
|
||||||
|
|
||||||
// protected Parts allVirtualParts = null;
|
// protected Parts allVirtualParts = null;
|
||||||
|
|
||||||
|
|
@ -2758,20 +2757,44 @@ public class Gui implements BioObserver, MouseListener, ActionListener, MouseMot
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ModelSummary[] retrieveCuratedBioModels() {
|
||||||
|
try(BioModelsConnectionService service = new BioModelsConnectionService()) {
|
||||||
|
CuratedModelsResponse response = service.getCuratedModelSet();
|
||||||
|
Set<ModelSummary> summaries = response.getModels();
|
||||||
|
return summaries.toArray(new ModelSummary[summaries.size()]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getBioModelsModelFile(String modelId) {
|
||||||
|
try(BioModelsConnectionService service = new BioModelsConnectionService()) {
|
||||||
|
ModelFileResponse response = service.getModelFile(modelId);
|
||||||
|
return response.getFileContent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getPublicationLinkForModel(String modelId) {
|
||||||
|
try (BioModelsConnectionService service = new BioModelsConnectionService()) {
|
||||||
|
ModelResponse modelInformation = service.getModel(modelId);
|
||||||
|
if (null == modelInformation) {
|
||||||
|
System.err.println("No entry found in BioModels for " + modelId);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return modelInformation.getPublicationLink();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void downloadBioModel() {
|
private void downloadBioModel() {
|
||||||
final BioModelsWSClient client = new BioModelsWSClient();
|
|
||||||
if (BioModelIds == null) {
|
if (BioModelIds == null) {
|
||||||
try {
|
try {
|
||||||
BioModelIds = client.getAllCuratedModelsId();
|
BioModelIds = retrieveCuratedBioModels();
|
||||||
} catch (BioModelsWSException e2) {
|
} catch (Exception e2) {
|
||||||
JOptionPane.showMessageDialog(frame, "Error Contacting BioModels Database", "Error",
|
JOptionPane.showMessageDialog(frame, "Error Contacting BioModels", "Error",
|
||||||
JOptionPane.ERROR_MESSAGE);
|
JOptionPane.ERROR_MESSAGE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
final JPanel BioModelsPanel = new JPanel(new BorderLayout());
|
final JPanel BioModelsPanel = new JPanel(new BorderLayout());
|
||||||
final JList ListOfBioModels = new JList();
|
final JList<ModelSummary> ListOfBioModels = new JList<>();
|
||||||
edu.utah.ece.async.ibiosim.dataModels.biomodel.util.Utility.sort(BioModelIds);
|
|
||||||
ListOfBioModels.setListData(BioModelIds);
|
ListOfBioModels.setListData(BioModelIds);
|
||||||
ListOfBioModels.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
ListOfBioModels.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
||||||
JLabel TextBioModels = new JLabel("List of BioModels");
|
JLabel TextBioModels = new JLabel("List of BioModels");
|
||||||
|
|
@ -2780,65 +2803,28 @@ public class Gui implements BioObserver, MouseListener, ActionListener, MouseMot
|
||||||
ScrollBioModels.setPreferredSize(new Dimension(552, 250));
|
ScrollBioModels.setPreferredSize(new Dimension(552, 250));
|
||||||
ScrollBioModels.setViewportView(ListOfBioModels);
|
ScrollBioModels.setViewportView(ListOfBioModels);
|
||||||
JPanel GetButtons = new JPanel();
|
JPanel GetButtons = new JPanel();
|
||||||
JButton GetNames = new JButton("Get Names");
|
|
||||||
JButton GetDescription = new JButton("Get Description");
|
JButton GetDescription = new JButton("Get Description");
|
||||||
JButton GetReference = new JButton("Get Reference");
|
JButton GetReference = new JButton("Get Reference");
|
||||||
final JProgressBar progressBar = new JProgressBar(0, 100);
|
final JProgressBar progressBar = new JProgressBar(0, 100);
|
||||||
progressBar.setStringPainted(true);
|
progressBar.setStringPainted(true);
|
||||||
progressBar.setValue(0);
|
progressBar.setValue(0);
|
||||||
runGetNames = true;
|
|
||||||
final Thread getNamesThread = new Thread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
Preferences biosimrc = Preferences.userRoot();
|
|
||||||
for (int i = 0; i < BioModelIds.length && runGetNames; i++) {
|
|
||||||
try {
|
|
||||||
progressBar.setValue(100 * i / BioModelIds.length);
|
|
||||||
if (!BioModelIds[i].contains(" ")) {
|
|
||||||
if (!biosimrc.get(BioModelIds[i], "").equals("")) {
|
|
||||||
BioModelIds[i] += " " + biosimrc.get(BioModelIds[i], "");
|
|
||||||
} else {
|
|
||||||
String name = client.getModelNameById(BioModelIds[i]);
|
|
||||||
biosimrc.put(BioModelIds[i], name);
|
|
||||||
BioModelIds[i] += " " + name;
|
|
||||||
}
|
|
||||||
ListOfBioModels.setListData(BioModelIds);
|
|
||||||
ListOfBioModels.revalidate();
|
|
||||||
ListOfBioModels.repaint();
|
|
||||||
}
|
|
||||||
} catch (BioModelsWSException e1) {
|
|
||||||
JOptionPane.showMessageDialog(frame, "Error Contacting BioModels Database", "Error",
|
|
||||||
JOptionPane.ERROR_MESSAGE);
|
|
||||||
runGetNames = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
progressBar.setValue(100);
|
|
||||||
ListOfBioModels.setListData(BioModelIds);
|
|
||||||
runGetNames = false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
GetNames.addActionListener(new ActionListener() {
|
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
if (runGetNames && !getNamesThread.isAlive()) {
|
|
||||||
getNamesThread.start();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
GetDescription.addActionListener(new ActionListener() {
|
GetDescription.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
if (ListOfBioModels.isSelectionEmpty()) {
|
if (ListOfBioModels.isSelectionEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String SelectedModel = ((String) ListOfBioModels.getSelectedValue()).split(" ")[0];
|
String selectedModel = ListOfBioModels.getSelectedValue().getId();
|
||||||
Preferences biosimrc = Preferences.userRoot();
|
Preferences biosimrc = Preferences.userRoot();
|
||||||
String command = biosimrc.get("biosim.general.browser", "");
|
String command = biosimrc.get("biosim.general.browser", "");
|
||||||
command = command + " http://www.ebi.ac.uk/compneur-srv/biomodels-main/" + SelectedModel;
|
command = command + " http://identifiers.org/biomodels.db/" + selectedModel;
|
||||||
|
progressBar.setValue(25);
|
||||||
log.addText("Executing:\n" + command + "\n");
|
log.addText("Executing:\n" + command + "\n");
|
||||||
Runtime exec = Runtime.getRuntime();
|
Runtime exec = Runtime.getRuntime();
|
||||||
try {
|
try {
|
||||||
exec.exec(command);
|
exec.exec(command);
|
||||||
|
progressBar.setValue(100);
|
||||||
} catch (IOException e1) {
|
} catch (IOException e1) {
|
||||||
JOptionPane.showMessageDialog(frame, "Unable to open model description.", "Error",
|
JOptionPane.showMessageDialog(frame, "Unable to open model description.", "Error",
|
||||||
JOptionPane.ERROR_MESSAGE);
|
JOptionPane.ERROR_MESSAGE);
|
||||||
|
|
@ -2851,25 +2837,31 @@ public class Gui implements BioObserver, MouseListener, ActionListener, MouseMot
|
||||||
if (ListOfBioModels.isSelectionEmpty()) {
|
if (ListOfBioModels.isSelectionEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String SelectedModel = ((String) ListOfBioModels.getSelectedValue()).split(" ")[0];
|
ModelSummary model = ListOfBioModels.getSelectedValue();
|
||||||
|
String modelId = model.getId();
|
||||||
try {
|
try {
|
||||||
String Pub = (client.getSimpleModelById(SelectedModel)).getPublicationId();
|
String pub = getPublicationLinkForModel(modelId);
|
||||||
|
progressBar.setValue(25);
|
||||||
|
progressBar.repaint();
|
||||||
|
if (null == pub) {
|
||||||
|
JOptionPane.showMessageDialog(frame,
|
||||||
|
"Could not find publication information in BioModels for " + modelId,
|
||||||
|
"Warning", JOptionPane.WARNING_MESSAGE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
Preferences biosimrc = Preferences.userRoot();
|
Preferences biosimrc = Preferences.userRoot();
|
||||||
String command = biosimrc.get("biosim.general.browser", "");
|
String command = biosimrc.get("biosim.general.browser", "");
|
||||||
command = command + " http://www.ncbi.nlm.nih.gov/pubmed/?term=" + Pub;
|
command = command + ' ' + pub;
|
||||||
log.addText("Executing:\n" + command + "\n");
|
log.addText("Executing:\n" + command + "\n");
|
||||||
Runtime exec = Runtime.getRuntime();
|
Runtime exec = Runtime.getRuntime();
|
||||||
exec.exec(command);
|
exec.exec(command);
|
||||||
} catch (BioModelsWSException e2) {
|
progressBar.setValue(100);
|
||||||
JOptionPane.showMessageDialog(frame, "Error Contacting BioModels Database", "Error",
|
|
||||||
JOptionPane.ERROR_MESSAGE);
|
|
||||||
} catch (IOException e1) {
|
} catch (IOException e1) {
|
||||||
JOptionPane.showMessageDialog(frame, "Unable to open model description.", "Error",
|
JOptionPane.showMessageDialog(frame, "Unable to open model description.", "Error",
|
||||||
JOptionPane.ERROR_MESSAGE);
|
JOptionPane.ERROR_MESSAGE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
GetButtons.add(GetNames);
|
|
||||||
GetButtons.add(GetDescription);
|
GetButtons.add(GetDescription);
|
||||||
GetButtons.add(GetReference);
|
GetButtons.add(GetReference);
|
||||||
GetButtons.add(progressBar);
|
GetButtons.add(progressBar);
|
||||||
|
|
@ -2879,17 +2871,16 @@ public class Gui implements BioObserver, MouseListener, ActionListener, MouseMot
|
||||||
Object[] options = { "OK", "Cancel" };
|
Object[] options = { "OK", "Cancel" };
|
||||||
int value = JOptionPane.showOptionDialog(frame, BioModelsPanel, "List of BioModels", JOptionPane.YES_NO_OPTION,
|
int value = JOptionPane.showOptionDialog(frame, BioModelsPanel, "List of BioModels", JOptionPane.YES_NO_OPTION,
|
||||||
JOptionPane.PLAIN_MESSAGE, null, options, options[0]);
|
JOptionPane.PLAIN_MESSAGE, null, options, options[0]);
|
||||||
runGetNames = false;
|
|
||||||
if (value == JOptionPane.YES_OPTION && ListOfBioModels.getSelectedValue() != null) {
|
if (value == JOptionPane.YES_OPTION && ListOfBioModels.getSelectedValue() != null) {
|
||||||
String ModelId = ((String) ListOfBioModels.getSelectedValue()).split(" ")[0];
|
String modelId = ListOfBioModels.getSelectedValue().getId();
|
||||||
String filename = ModelId + ".xml";
|
String filename = modelId + ".xml";
|
||||||
try {
|
try {
|
||||||
if (overwrite(root + File.separator + filename, filename)) {
|
if (overwrite(root + File.separator + filename, filename)) {
|
||||||
String model = client.getModelSBMLById(ModelId);
|
String model = getBioModelsModelFile(modelId);
|
||||||
Writer out = new BufferedWriter(new OutputStreamWriter(
|
try (Writer out = new BufferedWriter(new OutputStreamWriter(
|
||||||
new FileOutputStream(root + File.separator + filename), "UTF-8"));
|
new FileOutputStream(root + File.separator + filename), "UTF-8"))) {
|
||||||
out.write(model);
|
out.write(model);
|
||||||
out.close();
|
}
|
||||||
String[] file = GlobalConstants.splitPath(filename.trim());
|
String[] file = GlobalConstants.splitPath(filename.trim());
|
||||||
SBMLDocument document = SBMLutilities.readSBML(root + File.separator + filename.trim(), null, this);
|
SBMLDocument document = SBMLutilities.readSBML(root + File.separator + filename.trim(), null, this);
|
||||||
Utils.check(root + File.separator + filename.trim(), document, false, null, this);
|
Utils.check(root + File.separator + filename.trim(), document, false, null, this);
|
||||||
|
|
@ -6147,7 +6138,7 @@ public class Gui implements BioObserver, MouseListener, ActionListener, MouseMot
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ComponentDefinition cd = getSBOLDocument().createComponentDefinition(partId, "1",
|
ComponentDefinition cd = getSBOLDocument().createComponentDefinition(partId, "1",
|
||||||
ComponentDefinition.DNA);
|
ComponentDefinition.DNA_REGION);
|
||||||
cd.addRole(SequenceOntology.ENGINEERED_REGION);
|
cd.addRole(SequenceOntology.ENGINEERED_REGION);
|
||||||
writeSBOLDocument();
|
writeSBOLDocument();
|
||||||
Set<ComponentDefinition> selectedDesign = new HashSet<ComponentDefinition>();
|
Set<ComponentDefinition> selectedDesign = new HashSet<ComponentDefinition>();
|
||||||
|
|
|
||||||
|
|
@ -304,11 +304,11 @@ public class SBOLField2 extends JPanel implements ActionListener {
|
||||||
*/
|
*/
|
||||||
private String getSpeciesSBOTerm(URI sbolSBOTerm)
|
private String getSpeciesSBOTerm(URI sbolSBOTerm)
|
||||||
{
|
{
|
||||||
if(sbolSBOTerm.equals(ComponentDefinition.DNA))
|
if(sbolSBOTerm.equals(ComponentDefinition.DNA_REGION))
|
||||||
{
|
{
|
||||||
return GlobalConstants.SBO_DNA_SEGMENT;
|
return GlobalConstants.SBO_DNA_SEGMENT;
|
||||||
}
|
}
|
||||||
else if(sbolSBOTerm.equals(ComponentDefinition.RNA))
|
else if(sbolSBOTerm.equals(ComponentDefinition.RNA_REGION))
|
||||||
{
|
{
|
||||||
return GlobalConstants.SBO_RNA_SEGMENT;
|
return GlobalConstants.SBO_RNA_SEGMENT;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -107,7 +107,7 @@ public class Assembler2
|
||||||
// assembledComp.setDnaSequence(synthSeq);
|
// assembledComp.setDnaSequence(synthSeq);
|
||||||
|
|
||||||
// ComponentDefinition assembledComp = new ComponentDefinition(GlobalConstants.SBOL_AUTHORITY_DEFAULT, "assembledComp", "", new HashSet<URI>(Arrays.asList(ComponentDefinition.DNA)));
|
// ComponentDefinition assembledComp = new ComponentDefinition(GlobalConstants.SBOL_AUTHORITY_DEFAULT, "assembledComp", "", new HashSet<URI>(Arrays.asList(ComponentDefinition.DNA)));
|
||||||
ComponentDefinition assembledComp = sbolDoc.createComponentDefinition(defaultURIPrefix, "assembledComp", "", new HashSet<URI>(Arrays.asList(ComponentDefinition.DNA)));
|
ComponentDefinition assembledComp = sbolDoc.createComponentDefinition(defaultURIPrefix, "assembledComp", "", new HashSet<URI>(Arrays.asList(ComponentDefinition.DNA_REGION)));
|
||||||
assembledComp.addRole(SequenceOntology.ENGINEERED_REGION);
|
assembledComp.addRole(SequenceOntology.ENGINEERED_REGION);
|
||||||
Sequence synthSeq = sbolDoc.createSequence(defaultURIPrefix, "synthSeq", "", "", Sequence.IUPAC_DNA);
|
Sequence synthSeq = sbolDoc.createSequence(defaultURIPrefix, "synthSeq", "", "", Sequence.IUPAC_DNA);
|
||||||
assembledComp.addSequence(synthSeq);
|
assembledComp.addSequence(synthSeq);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue