diff --git a/genomic-processor/pom.xml b/genomic-processor/pom.xml new file mode 100644 index 00000000..4ffabd57 --- /dev/null +++ b/genomic-processor/pom.xml @@ -0,0 +1,60 @@ + + + + pic-sure-hpds + edu.harvard.hms.dbmi.avillach.hpds + 3.0.0-SNAPSHOT + + 4.0.0 + + genomic-processor + + + 18 + 18 + UTF-8 + + + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + org.springframework + spring-webflux + + + + edu.harvard.hms.dbmi.avillach.hpds + service + + + edu.harvard.hms.dbmi.avillach.hpds + etl + + + edu.harvard.hms.dbmi.avillach.hpds + data + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + \ No newline at end of file diff --git a/genomic-processor/src/main/java/edu/harvard/hms/dbmi/avillach/hpds/genomic/GenomicProcessorController.java b/genomic-processor/src/main/java/edu/harvard/hms/dbmi/avillach/hpds/genomic/GenomicProcessorController.java new file mode 100644 index 00000000..ae94f18f --- /dev/null +++ b/genomic-processor/src/main/java/edu/harvard/hms/dbmi/avillach/hpds/genomic/GenomicProcessorController.java @@ -0,0 +1,47 @@ +package edu.harvard.hms.dbmi.avillach.hpds.genomic; + +import edu.harvard.hms.dbmi.avillach.hpds.data.genotype.InfoColumnMeta; +import edu.harvard.hms.dbmi.avillach.hpds.processing.DistributableQuery; +import edu.harvard.hms.dbmi.avillach.hpds.processing.GenomicProcessor; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RestController; +import reactor.core.publisher.Mono; + +import java.math.BigInteger; +import java.util.Collection; +import java.util.List; + + +@RestController +public class GenomicProcessorController { + + private GenomicProcessor genomicProcessor; + + @Autowired + public GenomicProcessorController(GenomicProcessor genomicProcessor) { + this.genomicProcessor = genomicProcessor; + } + + @PostMapping("/patients") + public Mono queryForPatientMask(@RequestBody DistributableQuery distributableQuery) throws InterruptedException { + return genomicProcessor.getPatientMask(distributableQuery); + } + + @PostMapping("/variants") + public Mono> queryForVariants(@RequestBody DistributableQuery distributableQuery) { + return genomicProcessor.getVariantList(distributableQuery); + } + + @GetMapping("/patients/ids") + public List getPatientIds() { + return genomicProcessor.getPatientIds(); + } + + @GetMapping("/info/meta") + public List getInfoMetadata() { + return genomicProcessor.getInfoColumnMeta(); + } +} diff --git a/genomic-processor/src/main/java/edu/harvard/hms/dbmi/avillach/hpds/genomic/HpdsGenomicProcessorApplication.java b/genomic-processor/src/main/java/edu/harvard/hms/dbmi/avillach/hpds/genomic/HpdsGenomicProcessorApplication.java new file mode 100644 index 00000000..2bfa1a0b --- /dev/null +++ b/genomic-processor/src/main/java/edu/harvard/hms/dbmi/avillach/hpds/genomic/HpdsGenomicProcessorApplication.java @@ -0,0 +1,13 @@ +package edu.harvard.hms.dbmi.avillach.hpds.genomic; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class HpdsGenomicProcessorApplication { + + public static void main(String[] args) { + SpringApplication.run(HpdsGenomicProcessorApplication.class, args); + } + +} diff --git a/genomic-processor/src/main/java/edu/harvard/hms/dbmi/avillach/hpds/genomic/ServletInitializer.java b/genomic-processor/src/main/java/edu/harvard/hms/dbmi/avillach/hpds/genomic/ServletInitializer.java new file mode 100644 index 00000000..83040e11 --- /dev/null +++ b/genomic-processor/src/main/java/edu/harvard/hms/dbmi/avillach/hpds/genomic/ServletInitializer.java @@ -0,0 +1,13 @@ +package edu.harvard.hms.dbmi.avillach.hpds.genomic; + +import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; + +public class ServletInitializer extends SpringBootServletInitializer { + + @Override + protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { + return application.sources(HpdsGenomicProcessorApplication.class); + } + +} diff --git a/genomic-processor/src/main/java/edu/harvard/hms/dbmi/avillach/hpds/genomic/config/ApplicationConfig.java b/genomic-processor/src/main/java/edu/harvard/hms/dbmi/avillach/hpds/genomic/config/ApplicationConfig.java new file mode 100644 index 00000000..740cd9d6 --- /dev/null +++ b/genomic-processor/src/main/java/edu/harvard/hms/dbmi/avillach/hpds/genomic/config/ApplicationConfig.java @@ -0,0 +1,21 @@ +package edu.harvard.hms.dbmi.avillach.hpds.genomic.config; + +import edu.harvard.hms.dbmi.avillach.hpds.processing.GenomicProcessor; +import edu.harvard.hms.dbmi.avillach.hpds.processing.GenomicProcessorNodeImpl; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.PropertySource; + +@SpringBootApplication +@PropertySource("classpath:application.properties") +public class ApplicationConfig { + + @Value( "${hpds.genomicDataDirectory}" ) + private String genomicDataDirectory; + + @Bean + public GenomicProcessor genomicProcessor() { + return new GenomicProcessorNodeImpl(genomicDataDirectory); + } +} diff --git a/genomic-processor/src/main/resources/application.properties b/genomic-processor/src/main/resources/application.properties new file mode 100644 index 00000000..3bda4e51 --- /dev/null +++ b/genomic-processor/src/main/resources/application.properties @@ -0,0 +1,2 @@ +hpds.genomicDataDirectory = /opt/local/hpds/orchestration/1040/20/all/ +server.port=8090 \ No newline at end of file diff --git a/genomic-processor/src/test/java/edu/harvard/hms/dbmi/avillach/hpds/genomic/HpdsGenomicProcessorApplicationTests.java b/genomic-processor/src/test/java/edu/harvard/hms/dbmi/avillach/hpds/genomic/HpdsGenomicProcessorApplicationTests.java new file mode 100644 index 00000000..a339615a --- /dev/null +++ b/genomic-processor/src/test/java/edu/harvard/hms/dbmi/avillach/hpds/genomic/HpdsGenomicProcessorApplicationTests.java @@ -0,0 +1,13 @@ +package edu.harvard.hms.dbmi.avillach.hpds.genomic; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +class HpdsGenomicProcessorApplicationTests { + + @Test + void contextLoads() { + } + +} diff --git a/pom.xml b/pom.xml index d3da6087..3382067a 100644 --- a/pom.xml +++ b/pom.xml @@ -23,6 +23,7 @@ processing war client-api + genomic-processor UTF-8 diff --git a/service/src/main/java/edu/harvard/hms/dbmi/avillach/hpds/service/PicSureService.java b/service/src/main/java/edu/harvard/hms/dbmi/avillach/hpds/service/PicSureService.java index 56e348c8..011ed131 100644 --- a/service/src/main/java/edu/harvard/hms/dbmi/avillach/hpds/service/PicSureService.java +++ b/service/src/main/java/edu/harvard/hms/dbmi/avillach/hpds/service/PicSureService.java @@ -280,7 +280,7 @@ private ResponseEntity _querySync(QueryRequest resultRequest) throws IOException case INFO_COLUMN_LISTING: List infoColumnMeta = abstractProcessor.getInfoStoreMeta(); - return ResponseEntity.ok(infoColumnMeta); + return ResponseEntity.ok().contentType(MediaType.APPLICATION_JSON).body(infoColumnMeta); case DATAFRAME: case SECRET_ADMIN_DATAFRAME: