-
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(docs): generate correct URLs for nucleotide sequences endpoints …
…in multi-segmented case #521
- Loading branch information
1 parent
305e91c
commit 6058b99
Showing
16 changed files
with
162 additions
and
31 deletions.
There are no files selected for viewing
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,3 +1,4 @@ | ||
# Create a .env file with this input might NOT work. You might need to properly set CONFIG_FILE as an | ||
# environment variable. | ||
CONFIG_FILE=../lapis2/src/test/resources/config/testDatabaseConfig.yaml | ||
CONFIG_FILE=../siloLapisTests/testData/testDatabaseConfig.yaml | ||
REFERENCE_GENOMES_FILE=../siloLapisTests/testData/reference_genomes.json |
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import fs from 'fs'; | ||
import { z } from 'zod'; | ||
|
||
const referenceSequenceSchema = z.object({ | ||
name: z.string(), | ||
sequence: z.string(), | ||
}); | ||
|
||
const referenceGenomesSchema = z.object({ | ||
nucleotideSequences: z.array(referenceSequenceSchema), | ||
genes: z.array(referenceSequenceSchema), | ||
}); | ||
|
||
export type ReferenceGenomes = z.infer<typeof referenceGenomesSchema>; | ||
|
||
let _referenceGenomes: ReferenceGenomes | null = null; | ||
|
||
export function getReferenceGenomes(): ReferenceGenomes { | ||
if (_referenceGenomes === null) { | ||
const configFilePath = process.env.REFERENCE_GENOMES_FILE; | ||
if (configFilePath === undefined) { | ||
throw new Error('Please set the environment variable REFERENCE_GENOMES_FILE.'); | ||
} | ||
_referenceGenomes = referenceGenomesSchema.parse(JSON.parse(fs.readFileSync(configFilePath, 'utf8'))); | ||
} | ||
return _referenceGenomes; | ||
} | ||
|
||
export function isMultiSegmented(referenceGenomes: ReferenceGenomes): boolean { | ||
return referenceGenomes.nucleotideSequences.length > 1; | ||
} |
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
Oops, something went wrong.