Skip to content

Commit

Permalink
Fix content type issue, move genomic processor service to hpds repo
Browse files Browse the repository at this point in the history
  • Loading branch information
ramari16 committed Dec 7, 2023
1 parent 8fe8024 commit ef3f480
Show file tree
Hide file tree
Showing 9 changed files with 171 additions and 1 deletion.
60 changes: 60 additions & 0 deletions genomic-processor/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?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">
<parent>
<artifactId>pic-sure-hpds</artifactId>
<groupId>edu.harvard.hms.dbmi.avillach.hpds</groupId>
<version>3.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>genomic-processor</artifactId>

<properties>
<maven.compiler.source>18</maven.compiler.source>
<maven.compiler.target>18</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>


<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webflux</artifactId>
</dependency>

<dependency>
<groupId>edu.harvard.hms.dbmi.avillach.hpds</groupId>
<artifactId>service</artifactId>
</dependency>
<dependency>
<groupId>edu.harvard.hms.dbmi.avillach.hpds</groupId>
<artifactId>etl</artifactId>
</dependency>
<dependency>
<groupId>edu.harvard.hms.dbmi.avillach.hpds</groupId>
<artifactId>data</artifactId>
</dependency>
</dependencies>


<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
@@ -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<BigInteger> queryForPatientMask(@RequestBody DistributableQuery distributableQuery) throws InterruptedException {
return genomicProcessor.getPatientMask(distributableQuery);
}

@PostMapping("/variants")
public Mono<Collection<String>> queryForVariants(@RequestBody DistributableQuery distributableQuery) {
return genomicProcessor.getVariantList(distributableQuery);
}

@GetMapping("/patients/ids")
public List<String> getPatientIds() {
return genomicProcessor.getPatientIds();
}

@GetMapping("/info/meta")
public List<InfoColumnMeta> getInfoMetadata() {
return genomicProcessor.getInfoColumnMeta();
}
}
Original file line number Diff line number Diff line change
@@ -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);
}

}
Original file line number Diff line number Diff line change
@@ -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);
}

}
Original file line number Diff line number Diff line change
@@ -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);
}
}
2 changes: 2 additions & 0 deletions genomic-processor/src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
hpds.genomicDataDirectory = /opt/local/hpds/orchestration/1040/20/all/
server.port=8090
Original file line number Diff line number Diff line change
@@ -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() {
}

}
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<module>processing</module>
<module>war</module>
<module>client-api</module>
<module>genomic-processor</module>
</modules>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ private ResponseEntity _querySync(QueryRequest resultRequest) throws IOException

case INFO_COLUMN_LISTING:
List<InfoColumnMeta> infoColumnMeta = abstractProcessor.getInfoStoreMeta();
return ResponseEntity.ok(infoColumnMeta);
return ResponseEntity.ok().contentType(MediaType.APPLICATION_JSON).body(infoColumnMeta);

case DATAFRAME:
case SECRET_ADMIN_DATAFRAME:
Expand Down

0 comments on commit ef3f480

Please sign in to comment.