Skip to content

Commit

Permalink
genome preparing embedded driver
Browse files Browse the repository at this point in the history
  • Loading branch information
arcuri82 committed Sep 12, 2022
1 parent a5bc917 commit 94f6802
Show file tree
Hide file tree
Showing 7 changed files with 262 additions and 1 deletion.
2 changes: 1 addition & 1 deletion jdk_8_maven/cs/rest-gui/genome-nexus/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pom.xml.next
release.properties
dependency-reduced-pom.xml
buildNumber.properties
application.properties
#application.properties
*.iml
.idea/
*.ipr
Expand Down
4 changes: 4 additions & 0 deletions jdk_8_maven/cs/rest-gui/genome-nexus/web/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@
<goal>build-info</goal>
<goal>repackage</goal>
</goals>
<configuration>
<finalName>genome-nexus</finalName>
<classifier>sut</classifier>
</configuration>
</execution>
</executions>
</plugin>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# VEP web API URL with additional parameters. Note that "VARIANT" field will be replaced with
# the actual variant value before each VEP request.
vep.url=http://grch37.rest.ensembl.org/vep/human/hgvs/VARIANT?content-type=application/json&xref_refseq=1&ccds=1&canonical=1&domains=1&hgvs=1&numbers=1&protein=1

# 200 is the max page size allowed by the public VEP service, it might be possible to increase this for a private instance
vep.max_page_size=200

# response timeout arg when sending requests to own VEP
# should only be turned on when pointing to own VEP
# 300 seconds is recommended with vep.max_page_size set to 5000
# gn_vep.timeout.seconds=300

# it is possible to use your own VEP instance by running https://github.com/genome-nexus/genome-nexus-vep
# This is only the VEP part of the Ensembl REST API.
# e.g. when running on port 6060:
# gn_vep.region.url=http://localhost:6060/vep/human/region/VARIANT
# gn_vep.cache.version=
# gn_vep.server.version=
# Note that this overrides vep.url
# To get the full advantage of running your own VEP, several optimizations are
# required, please read documentation in
# https://github.com/genome-nexus/genome-nexus-vep

# the gene external references URL
genexrefs.url=http://grch37.rest.ensembl.org/xrefs/id/ACCESSION?content-type=application/json

# Mutation Assessor web API URL
#"VARIANT" will be replaced with actual variant upon each request.
mutationAssessor.url=http://mutationassessor.org/r3/?cm=var&var=VARIANT&frm=json&fts=input,rgaa,rgvt,msa,pdb,F_impact,F_score,vc_score,vs_score,info,var,gene,uprot,rsprot,gaps,msa_height,chr,rs_pos,rs_res,up_pos,up_res,cnt_cosmic,cnt_snps
# mutationAssessor url for GRCh38
# mutationAssessor.url=http://mutationassessor.org/r3/?cm=var&var=hg38,VARIANT&frm=json&fts=input,rgaa,rgvt,msa,pdb,F_impact,F_score,vc_score,vs_score,info,var,gene,uprot,rsprot,gaps,msa_height,chr,rs_pos,rs_res,up_pos,up_res,cnt_cosmic,cnt_snps

# my variant info web API URL
#"VARIANT" will be replaced with actual variant upon each request.
myvariantinfo.url=https://myvariant.info/v1/variant/VARIANT
myvariantinfo.max_page_size=200
# myvariantinfo url for GRCh38
# myvariantinfo.url=https://myvariant.info/v1/variant/VARIANT?assembly=hg38

# PDB header web service URL
pdb.header_service_url=http://files.rcsb.org/header/PDB_ID.pdb

# MongoDB URI in the form of mongodb://<USERNAME>:<PASSWORD>@<HOST>:<PORT>/<DB>
spring.data.mongodb.uri=mongodb://127.0.0.1:27017/annotator

# Server port number for the embedded tomcat. This property is required only when building
# a jar file, and ignored when building a war file.
server.port=38080
genomenexus.server.version=1.0.2

# For testing use same embeded mongo version as genome-nexus-importer
# https://github.com/genome-nexus/genome-nexus-importer/blob/master/Dockerfile#L1
spring.mongodb.embedded.version=3.6.2

# enable compression when running embedded tomcat
server.compression.enabled=true
server.compression.min-response-size=2048
server.compression.mime-types=application/json,application/xml,text/html,text/xml,text/plain,application/javascript,text/css

# increase the header size limitation
server.max-http-header-size=10000000

# include full git info in /actuator/info endpoint
management.info.git.mode=full

# oncokb
oncokb.url=https://www.oncokb.org/api/v1/annotate/mutations/byProteinChange?PROTEINCHANGE

# For testing use same embeded mongo version as genome-nexus-importer
# https://github.com/genome-nexus/genome-nexus-importer/blob/master/Dockerfile#L1
spring.mongodb.embedded.version=3.6.2
1 change: 1 addition & 0 deletions jdk_8_maven/cs/rest-gui/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<modules>
<module>ocvn</module>
<module>gestaohospital</module>
<module>genome-nexus</module>
</modules>


Expand Down
51 changes: 51 additions & 0 deletions jdk_8_maven/em/embedded/rest/genome-nexus/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<properties>
<mongo.version>3.6.2</mongo.version>
</properties>

<artifactId>evomaster-benchmark-em-embedded-rest-genome-nexus</artifactId>
<packaging>jar</packaging>

<parent>
<groupId>org.evomaster</groupId>
<artifactId>evomaster-benchmark-em-embedded-rest</artifactId>
<version>1.5.1-SNAPSHOT</version>
</parent>


<dependencies>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongo-java-driver</artifactId>
<version>${mongo.version}</version>
</dependency>
<dependency>
<groupId>org.cbioportal.genome_nexus</groupId>
<artifactId>web</artifactId>
<version>1.1.49</version>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>compile</scope>
<version>4.11</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>5.3.9</version>
</dependency>
</dependencies>


</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
package org.cbioportal.genome_nexus;

import com.mongodb.MongoClient;
import org.evomaster.client.java.controller.EmbeddedSutController;
import org.evomaster.client.java.controller.InstrumentedSutStarter;
import org.evomaster.client.java.controller.api.dto.AuthenticationDto;
import org.evomaster.client.java.controller.api.dto.SutInfoDto;
import org.evomaster.client.java.controller.internal.db.DbSpecification;
import org.evomaster.client.java.controller.problem.ProblemInfo;
import org.evomaster.client.java.controller.problem.RestProblem;
import org.springframework.boot.SpringApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.testcontainers.containers.GenericContainer;

import java.util.List;
import java.util.Map;


/**
* Class used to start/stop the SUT. This will be controller by the EvoMaster process
*/
public class EmbeddedEvoMasterController extends EmbeddedSutController {

public static void main(String[] args) {

int port = 40100;
if (args.length > 0) {
port = Integer.parseInt(args[0]);
}

EmbeddedEvoMasterController controller = new EmbeddedEvoMasterController(port);
InstrumentedSutStarter starter = new InstrumentedSutStarter(controller);

starter.start();
}


private ConfigurableApplicationContext ctx;

private static final int MONGODB_PORT = 27017;

private static final String MONGODB_VERSION = "3.6.2";

private static final String MONGODB_DATABASE_NAME = "genome";

private static final GenericContainer mongodbContainer = new GenericContainer("mongo:" + MONGODB_VERSION)
.withExposedPorts(MONGODB_PORT);


public EmbeddedEvoMasterController() {
this(0);
}

public EmbeddedEvoMasterController(int port) {
setControllerPort(port);
}


@Override
public String startSut() {

mongodbContainer.start();

ctx = SpringApplication.run(GenomeNexusAnnotation.class,
new String[]{"--server.port=0",
"--spring.data.mongodb.uri=mongodb://" + mongodbContainer.getContainerIpAddress() + ":" + mongodbContainer.getMappedPort(MONGODB_PORT) + "/" + MONGODB_DATABASE_NAME,
"--spring.cache.type=NONE"
});

return "http://localhost:" + getSutPort();
}

protected int getSutPort() {
return (Integer) ((Map) ctx.getEnvironment()
.getPropertySources().get("server.ports").getSource())
.get("local.server.port");
}


@Override
public boolean isSutRunning() {
return ctx != null && ctx.isRunning();
}

@Override
public void stopSut() {
ctx.stop();
ctx.close();

mongodbContainer.stop();
}

@Override
public String getPackagePrefixesToCover() {
return "org.cbioportal.genome_nexus.";
}

@Override
public void resetStateOfSUT() {
MongoClient mongoClient = new MongoClient(mongodbContainer.getContainerIpAddress(),
mongodbContainer.getMappedPort(MONGODB_PORT));

mongoClient.getDatabase(MONGODB_DATABASE_NAME).drop();
}


@Override
public List<DbSpecification> getDbSpecifications() {
return null;
}


@Override
public List<AuthenticationDto> getInfoForAuthentication() {
return null;
}


@Override
public ProblemInfo getProblemInfo() {
return new RestProblem(
"http://localhost:" + getSutPort() + "/v2/api-docs",
null
);
}

@Override
public SutInfoDto.OutputFormat getPreferredOutputFormat() {
return SutInfoDto.OutputFormat.JAVA_JUNIT_4;
}


}
1 change: 1 addition & 0 deletions jdk_8_maven/em/embedded/rest/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
<module>languagetool</module>
<module>restcountries</module>
<module>gestaohospital</module>
<module>genome-nexus</module>
</modules>

</project>

0 comments on commit 94f6802

Please sign in to comment.