-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add alignedNucleotideSequence, aminoAcidSequence endpoints
- Loading branch information
1 parent
67a9aa9
commit 575070a
Showing
38 changed files
with
1,533 additions
and
248 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 4 additions & 1 deletion
5
lapis2/src/main/kotlin/org/genspectrum/lapis/LapisApplication.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
package org.genspectrum.lapis | ||
|
||
import org.genspectrum.lapis.config.ReferenceGenome | ||
import org.springframework.boot.autoconfigure.SpringBootApplication | ||
import org.springframework.boot.runApplication | ||
|
||
@SpringBootApplication | ||
class Lapisv2Application | ||
|
||
fun main(args: Array<String>) { | ||
runApplication<Lapisv2Application>(*args) | ||
val referenceGenomeArgs = ReferenceGenome.readFromFileFromProgramArgs(args).toSpringApplicationArgs() | ||
|
||
runApplication<Lapisv2Application>(*(args + referenceGenomeArgs)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
lapis2/src/main/kotlin/org/genspectrum/lapis/config/ReferenceGenome.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package org.genspectrum.lapis.config | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties | ||
import com.fasterxml.jackson.annotation.JsonProperty | ||
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper | ||
import com.fasterxml.jackson.module.kotlin.readValue | ||
import java.io.File | ||
|
||
const val REFERENCE_GENOME_APPLICATION_ARG_PREFIX = "referenceGenome.nucleotideSequences" | ||
|
||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
class ReferenceGenome( | ||
@JsonProperty("nucleotide_sequences") | ||
val nucleotideSequences: List<NucleotideSequence>, | ||
) { | ||
fun isSingleSegmented(): Boolean { | ||
return nucleotideSequences.size == 1 | ||
} | ||
|
||
companion object { | ||
fun readFromFile(filename: String): ReferenceGenome { | ||
return jacksonObjectMapper().readValue(File(filename)) | ||
} | ||
|
||
private fun readFilenameFromProgramArgs(args: Array<String>): String { | ||
val referenceGenomeArg = args.find { it.startsWith("--referenceGenomeFilename=") } | ||
return referenceGenomeArg?.substringAfter("=") ?: throw IllegalArgumentException( | ||
"No reference genome filename specified. Please specify a reference genome filename using the " + | ||
"--referenceGenomeFilename argument.", | ||
) | ||
} | ||
|
||
fun readFromFileFromProgramArgs(args: Array<String>): ReferenceGenome { | ||
return readFromFile(readFilenameFromProgramArgs(args)) | ||
} | ||
} | ||
|
||
fun toSpringApplicationArgs(): Array<String> { | ||
val nucleotideSequenceArgs = | ||
"--$REFERENCE_GENOME_APPLICATION_ARG_PREFIX=" + this.nucleotideSequences.joinToString( | ||
separator = ",", | ||
) { | ||
it.name | ||
} | ||
|
||
return arrayOf(nucleotideSequenceArgs) | ||
} | ||
} | ||
|
||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
data class NucleotideSequence( | ||
val name: String, | ||
) |
11 changes: 0 additions & 11 deletions
11
lapis2/src/main/kotlin/org/genspectrum/lapis/config/SingleSegmentedSequenceFeature.kt
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.