diff --git a/api/api/api.go b/api/api/api.go index 62bfa0d..96c205b 100644 --- a/api/api/api.go +++ b/api/api/api.go @@ -4,6 +4,7 @@ import ( "bytes" "context" "embed" + "encoding/base64" "encoding/json" "fmt" "html/template" @@ -358,12 +359,27 @@ func (app *App) LuaIoGenbankParse(L *lua.LState) int { } func (app *App) PostIoGenbankWrite(ctx context.Context, request gen.PostIoGenbankWriteRequestObject) (gen.PostIoGenbankWriteResponseObject, error) { - return nil, nil + var w bytes.Buffer + for _, genbankRecord := range *request.Body { + genbankStruct := ConvertGenbankRecordToGenbank(genbankRecord) + _, _ = genbankStruct.WriteTo(&w) + } + return gen.PostIoGenbankWrite200TextResponse(w.String()), nil } func (app *App) LuaIoGenbankWrite(L *lua.LState) int { return 0 } func (app *App) PostIoFastqParse(ctx context.Context, request gen.PostIoFastqParseRequestObject) (gen.PostIoFastqParseResponseObject, error) { - return nil, nil + fastqString := *request.Body + parser := bio.NewFastqParser(strings.NewReader(fastqString + "\n")) + fastqs, err := parser.Parse() + if err != nil { + return gen.PostIoFastqParse500TextResponse(fmt.Sprintf("Got error: %s", err)), nil + } + data := make([]gen.FastqRead, len(fastqs)) + for i, fastqRead := range fastqs { + data[i] = gen.FastqRead{Identifier: fastqRead.Identifier, Optionals: &fastqRead.Optionals, Sequence: fastqRead.Sequence, Quality: fastqRead.Quality} + } + return gen.PostIoFastqParse200JSONResponse(data), nil } func (app *App) LuaIoFastqParse(L *lua.LState) int { return 0 } @@ -378,7 +394,20 @@ func (app *App) PostIoFastqWrite(ctx context.Context, request gen.PostIoFastqWri func (app *App) LuaIoFastqWrite(L *lua.LState) int { return 0 } func (app *App) PostIoSlow5Parse(ctx context.Context, request gen.PostIoSlow5ParseRequestObject) (gen.PostIoSlow5ParseResponseObject, error) { - return nil, nil + slow5String := *request.Body + parser, err := bio.NewSlow5Parser(strings.NewReader(slow5String)) + if err != nil { + return gen.PostIoSlow5Parse500TextResponse(fmt.Sprintf("Got error: %s", err)), nil + } + reads, header, err := parser.ParseWithHeader() + if err != nil { + return gen.PostIoSlow5Parse500TextResponse(fmt.Sprintf("Got error: %s", err)), nil + } + data := make([]gen.Slow5Read, len(reads)) + for i, read := range reads { + data[i] = ConvertReadToSlow5Read(read) + } + return gen.PostIoSlow5Parse200JSONResponse(gen.PostIoSlow5WriteJSONBody{Header: ConvertToGenSlow5Header(header), Reads: data}), nil } func (app *App) LuaIoSlow5Parse(L *lua.LState) int { return 0 } @@ -392,7 +421,7 @@ func (app *App) PostIoSlow5Write(ctx context.Context, request gen.PostIoSlow5Wri header := slow5.Header{HeaderValues: headerValues} reads := request.Body.Reads _, _ = header.WriteTo(&w) - for _, read := range *reads { + for _, read := range reads { slow5Struct := ConvertSlow5ReadToRead(read) _, _ = slow5Struct.WriteTo(&w) } @@ -401,17 +430,52 @@ func (app *App) PostIoSlow5Write(ctx context.Context, request gen.PostIoSlow5Wri func (app *App) LuaIoSlow5Write(L *lua.LState) int { return 0 } func (app *App) PostIoSlow5SvbCompress(ctx context.Context, request gen.PostIoSlow5SvbCompressRequestObject) (gen.PostIoSlow5SvbCompressResponseObject, error) { - return nil, nil + input := *request.Body + rawSignal := make([]int16, len(input.RawSignal)) + for i, integer := range input.RawSignal { + rawSignal[i] = int16(integer) + } + mask, data := slow5.SvbCompressRawSignal(rawSignal) + encodedMask := base64.StdEncoding.EncodeToString(mask) + encodedData := base64.StdEncoding.EncodeToString(data) + + return gen.PostIoSlow5SvbCompress200JSONResponse{Mask: encodedMask, Data: encodedData, LenRawSignal: len(rawSignal)}, nil } func (app *App) LuaIoSlow5SvbCompress(L *lua.LState) int { return 0 } func (app *App) PostIoSlow5SvbDecompress(ctx context.Context, request gen.PostIoSlow5SvbDecompressRequestObject) (gen.PostIoSlow5SvbDecompressResponseObject, error) { - return nil, nil + input := *request.Body + decodedMask, err := base64.StdEncoding.DecodeString(input.Mask) + if err != nil { + return gen.PostIoSlow5SvbDecompress500TextResponse(fmt.Sprintf("Failed to base64 decode mask. Got err: %s", err)), nil + } + + decodedData, err := base64.StdEncoding.DecodeString(input.Data) + if err != nil { + return gen.PostIoSlow5SvbDecompress500TextResponse(fmt.Sprintf("Failed to base64 decode data. Got err: %s", err)), nil + } + + rawSignal := slow5.SvbDecompressRawSignal(input.LenRawSignal, decodedMask, decodedData) + intRawSignal := make([]int, len(rawSignal)) + for i, integer := range rawSignal { + intRawSignal[i] = int(integer) + } + return gen.PostIoSlow5SvbDecompress200JSONResponse{RawSignal: intRawSignal}, nil } func (app *App) LuaIoSlow5SvbDecompress(L *lua.LState) int { return 0 } func (app *App) PostIoPileupParse(ctx context.Context, request gen.PostIoPileupParseRequestObject) (gen.PostIoPileupParseResponseObject, error) { - return nil, nil + pileupString := *request.Body + parser := bio.NewPileupParser(strings.NewReader(pileupString)) + pileups, err := parser.Parse() + if err != nil { + return gen.PostIoPileupParse500TextResponse(fmt.Sprintf("Got error: %s", err)), nil + } + data := make([]gen.PileupLine, len(pileups)) + for i, pileupRead := range pileups { + data[i] = gen.PileupLine{Sequence: pileupRead.Sequence, Position: int(pileupRead.Position), ReferenceBase: pileupRead.ReferenceBase, ReadCount: int(pileupRead.ReadCount), ReadResults: pileupRead.ReadResults, Quality: pileupRead.Quality} + } + return gen.PostIoPileupParse200JSONResponse(data), nil } func (app *App) LuaIoPileupParse(L *lua.LState) int { return 0 } diff --git a/api/api/converters.go b/api/api/converters.go index 1e73bd5..1a27ff2 100644 --- a/api/api/converters.go +++ b/api/api/converters.go @@ -282,3 +282,33 @@ func convertMetaGenToGenbank(meta gen.Meta) genbank.Meta { Version: meta.Version, } } + +func ConvertToSlow5Header(genHeader gen.Slow5Header) slow5.Header { + var slow5HeaderValues []slow5.HeaderValue + for _, hv := range genHeader.HeaderValues { + slow5HV := slow5.HeaderValue{ + ReadGroupID: uint32(hv.ReadGroupID), + Slow5Version: hv.Slow5Version, + Attributes: hv.Attributes, + EndReasonHeaderMap: hv.EndReasonHeaderMap, + } + slow5HeaderValues = append(slow5HeaderValues, slow5HV) + } + + return slow5.Header{HeaderValues: slow5HeaderValues} +} + +func ConvertToGenSlow5Header(slow5Header slow5.Header) gen.Slow5Header { + var genHeaderValues []gen.HeaderValue + for _, hv := range slow5Header.HeaderValues { + genHV := gen.HeaderValue{ + ReadGroupID: int(hv.ReadGroupID), + Slow5Version: hv.Slow5Version, + Attributes: hv.Attributes, + EndReasonHeaderMap: hv.EndReasonHeaderMap, + } + genHeaderValues = append(genHeaderValues, genHV) + } + + return gen.Slow5Header{HeaderValues: genHeaderValues} +} diff --git a/api/gen/dnadesign-server.gen.go b/api/gen/dnadesign-server.gen.go index 5d17d2f..303fdd0 100644 --- a/api/gen/dnadesign-server.gen.go +++ b/api/gen/dnadesign-server.gen.go @@ -1957,6 +1957,16 @@ func (response PostIoFastqParse200JSONResponse) VisitPostIoFastqParseResponse(w return json.NewEncoder(w).Encode(response) } +type PostIoFastqParse500TextResponse string + +func (response PostIoFastqParse500TextResponse) VisitPostIoFastqParseResponse(w http.ResponseWriter) error { + w.Header().Set("Content-Type", "text/plain") + w.WriteHeader(500) + + _, err := w.Write([]byte(response)) + return err +} + type PostIoFastqWriteRequestObject struct { Body *PostIoFastqWriteJSONRequestBody } @@ -2010,16 +2020,18 @@ type PostIoGenbankWriteResponseObject interface { VisitPostIoGenbankWriteResponse(w http.ResponseWriter) error } -type PostIoGenbankWrite200Response struct { -} +type PostIoGenbankWrite200TextResponse string -func (response PostIoGenbankWrite200Response) VisitPostIoGenbankWriteResponse(w http.ResponseWriter) error { +func (response PostIoGenbankWrite200TextResponse) VisitPostIoGenbankWriteResponse(w http.ResponseWriter) error { + w.Header().Set("Content-Type", "text/plain") w.WriteHeader(200) - return nil + + _, err := w.Write([]byte(response)) + return err } type PostIoPileupParseRequestObject struct { - Body *PostIoPileupParseJSONRequestBody + Body *PostIoPileupParseTextRequestBody } type PostIoPileupParseResponseObject interface { @@ -2035,6 +2047,16 @@ func (response PostIoPileupParse200JSONResponse) VisitPostIoPileupParseResponse( return json.NewEncoder(w).Encode(response) } +type PostIoPileupParse500TextResponse string + +func (response PostIoPileupParse500TextResponse) VisitPostIoPileupParseResponse(w http.ResponseWriter) error { + w.Header().Set("Content-Type", "text/plain") + w.WriteHeader(500) + + _, err := w.Write([]byte(response)) + return err +} + type PostIoPileupWriteRequestObject struct { Body *PostIoPileupWriteJSONRequestBody } @@ -2054,7 +2076,7 @@ func (response PostIoPileupWrite200TextResponse) VisitPostIoPileupWriteResponse( } type PostIoSlow5ParseRequestObject struct { - Body *PostIoSlow5ParseJSONRequestBody + Body *PostIoSlow5ParseTextRequestBody } type PostIoSlow5ParseResponseObject interface { @@ -2062,8 +2084,8 @@ type PostIoSlow5ParseResponseObject interface { } type PostIoSlow5Parse200JSONResponse struct { - Header *Slow5Header `json:"header,omitempty"` - Reads *[]Slow5Read `json:"reads,omitempty"` + Header Slow5Header `json:"header"` + Reads []Slow5Read `json:"reads"` } func (response PostIoSlow5Parse200JSONResponse) VisitPostIoSlow5ParseResponse(w http.ResponseWriter) error { @@ -2073,6 +2095,16 @@ func (response PostIoSlow5Parse200JSONResponse) VisitPostIoSlow5ParseResponse(w return json.NewEncoder(w).Encode(response) } +type PostIoSlow5Parse500TextResponse string + +func (response PostIoSlow5Parse500TextResponse) VisitPostIoSlow5ParseResponse(w http.ResponseWriter) error { + w.Header().Set("Content-Type", "text/plain") + w.WriteHeader(500) + + _, err := w.Write([]byte(response)) + return err +} + type PostIoSlow5SvbCompressRequestObject struct { Body *PostIoSlow5SvbCompressJSONRequestBody } @@ -2082,8 +2114,9 @@ type PostIoSlow5SvbCompressResponseObject interface { } type PostIoSlow5SvbCompress200JSONResponse struct { - Data *string `json:"data,omitempty"` - Mask *string `json:"mask,omitempty"` + Data string `json:"data"` + LenRawSignal int `json:"lenRawSignal"` + Mask string `json:"mask"` } func (response PostIoSlow5SvbCompress200JSONResponse) VisitPostIoSlow5SvbCompressResponse(w http.ResponseWriter) error { @@ -2102,7 +2135,7 @@ type PostIoSlow5SvbDecompressResponseObject interface { } type PostIoSlow5SvbDecompress200JSONResponse struct { - RawSignal *[]int `json:"rawSignal,omitempty"` + RawSignal []int `json:"rawSignal"` } func (response PostIoSlow5SvbDecompress200JSONResponse) VisitPostIoSlow5SvbDecompressResponse(w http.ResponseWriter) error { @@ -2112,6 +2145,16 @@ func (response PostIoSlow5SvbDecompress200JSONResponse) VisitPostIoSlow5SvbDecom return json.NewEncoder(w).Encode(response) } +type PostIoSlow5SvbDecompress500TextResponse string + +func (response PostIoSlow5SvbDecompress500TextResponse) VisitPostIoSlow5SvbDecompressResponse(w http.ResponseWriter) error { + w.Header().Set("Content-Type", "text/plain") + w.WriteHeader(500) + + _, err := w.Write([]byte(response)) + return err +} + type PostIoSlow5WriteRequestObject struct { Body *PostIoSlow5WriteJSONRequestBody } @@ -3412,11 +3455,12 @@ func (sh *strictHandler) PostIoGenbankWrite(w http.ResponseWriter, r *http.Reque func (sh *strictHandler) PostIoPileupParse(w http.ResponseWriter, r *http.Request) { var request PostIoPileupParseRequestObject - var body PostIoPileupParseJSONRequestBody - if err := json.NewDecoder(r.Body).Decode(&body); err != nil { - sh.options.RequestErrorHandlerFunc(w, r, fmt.Errorf("can't decode JSON body: %w", err)) + data, err := io.ReadAll(r.Body) + if err != nil { + sh.options.RequestErrorHandlerFunc(w, r, fmt.Errorf("can't read body: %w", err)) return } + body := PostIoPileupParseTextRequestBody(data) request.Body = &body handler := func(ctx context.Context, w http.ResponseWriter, r *http.Request, request interface{}) (interface{}, error) { @@ -3474,11 +3518,12 @@ func (sh *strictHandler) PostIoPileupWrite(w http.ResponseWriter, r *http.Reques func (sh *strictHandler) PostIoSlow5Parse(w http.ResponseWriter, r *http.Request) { var request PostIoSlow5ParseRequestObject - var body PostIoSlow5ParseJSONRequestBody - if err := json.NewDecoder(r.Body).Decode(&body); err != nil { - sh.options.RequestErrorHandlerFunc(w, r, fmt.Errorf("can't decode JSON body: %w", err)) + data, err := io.ReadAll(r.Body) + if err != nil { + sh.options.RequestErrorHandlerFunc(w, r, fmt.Errorf("can't read body: %w", err)) return } + body := PostIoSlow5ParseTextRequestBody(data) request.Body = &body handler := func(ctx context.Context, w http.ResponseWriter, r *http.Request, request interface{}) (interface{}, error) { @@ -4079,28 +4124,28 @@ var swaggerSpec = []string{ "88fXz/Faom8h9wX25TG5XHGcXPecE3/MdobKzHYzQzfhaJsjRYS01a2bK+f2u/qGAKV4yalx956+/qi5", "51S7+5neQUGu9apODDevDf4n9tj1H48M4yE0vzxBlY+GofFneV1t/x9Dwf9qyu8+//p8rj2DKppejxM2", "WWMh8aTAXIzMBc6Zvi9hpimHXB48nB1sm+rgErpzyUPAzF53L0VvTxZXJ4hrtpdYxdVqVFqkWB8rtx4k", - "rOu8W05kmPN+15RP/dJi2OLjXn+wZY291iQDpGwigSJRl2DZfcfG2hhhNv4cHiCfv8UAMbeO7BcevzXh", - "0QPd38bNGgzdz88G3V5bPDFwf3sAcActXC2ThUG3WlL61sDbWSgMBrBdQXvpDG/1CHBjUKhU8p4lWEZt", - "H7aNoLLAfuAPsFuhj1eHod8cxR4H/161H5Y46Lg7ft4zPUMudY6kB8RS/b7bsCHF5x8NKoKzUW8FgdxI", - "exaMjxlkXx89OKVUFlRwQQ6UunExbmiRsdufw6JCn7b+WwdFW7ltfe59CBLuEXndPt7jJr7mAHvQRqye", - "0Uv70OQ+X7SZx6MYEDerpX6LD0IEQWFxs5pa+kMBgj/oSPqX55/J+4EbRzkW14GbiHZfFBljQoo4vkXC", - "2KG7qmdo0BzfImMpc6Jj8fF01Lsp7Ovfs4bjiUM+jrLRWxD2su1Tev+QKG1joDH4EAoaqr1xEDSiavc/", - "dkD9+pPps43WTYIOL2mHs3aR8Im5c+1uWSQjq7OzhE8N7Sw53PLs8F1rBSc58H1v48R8A3Ip89aS7n8f", - "efa2S8iLDEt4zN72Rkajr6vEU7yCfPgmo9l0/jVtqJ5N5w4wFQYbZFbGnKSw4iX5gy5XmCcsHdsUOEv4", - "zHCeVYynlu9QoF1hSiF96IUQVTeWWfdqPifnb5Il99+HneO75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tfZCsVxojkNZOccbCoKU", + "+ZTRBKjk/Zc7GsXH6QTOZADVQw4V+1TwNRj39euJEBKj9NcYpYsaKeIBkau9i7R7xyJXEDUrCZrALDTp", + "881fDjEgPWhCE/CLEJZyR8sdnZ56NjP+BuDrmrRgZCDXO3vhmKYsr/5bpnQkp801nfn3jB4unQ1NMOxd", + "L7TMMnNwQ5Vjo9vpK5HPX9rtecC2619jXHMbVn0VjH8O4ZAu3KrWONn41OvngjMJhIb7elYxfPf3U/m7", + "snCozy35fn7n+8T3/Ht8P6G/5+HxPQ+IbwGft6N3Fy8qouepKFJWrjJYSKVn67Yu96dfBi+WrR7a3x6x", + "vzpwdnkSxdFs/uHqzfllFEfzyxPPzwz0V6Mtuc4Pf+yo/PzYsj58AK4sQpCW0akH7LNfsdi2t0Vb4LRg", + "tAy7YanC08FvWFq3f56r+XmYNeM5liYp/BL57jzi7V/t2of1QTMbv6p9enxTgKrvEBJ7IEsf33QA4YdZ", + "KUkmJkQsC5wRmnKWk2QYav9WHOdi5tD/o05XkVbX/b9ZFbCZpRaBhMSy3JnubiG5RmRdDzeICNS2uXWo", + "dmHLnXYq1v61sRGXVr+yN3V/VOsf5NbH1hLVim5j8r6awlI2hkZs3TdzqH2rs6KaZao//xWVPIuOo62U", + "hTieTFKKzSuIVyvCJrgg0ZfYpTmeTDKW4GzLhDz+5eiXI0Pz6cv/BwAA//+r/Ue9DnkAAA==", } // GetSwagger returns the content of the embedded swagger specification file diff --git a/api/gen/dnadesign-types.gen.go b/api/gen/dnadesign-types.gen.go index 5429eb0..ac7d309 100644 --- a/api/gen/dnadesign-types.gen.go +++ b/api/gen/dnadesign-types.gen.go @@ -341,35 +341,31 @@ type PostIoGenbankParseTextBody = string // PostIoGenbankWriteJSONBody defines parameters for PostIoGenbankWrite. type PostIoGenbankWriteJSONBody = []GenbankRecord -// PostIoPileupParseJSONBody defines parameters for PostIoPileupParse. -type PostIoPileupParseJSONBody struct { - Data string `json:"data"` -} +// PostIoPileupParseTextBody defines parameters for PostIoPileupParse. +type PostIoPileupParseTextBody = string // PostIoPileupWriteJSONBody defines parameters for PostIoPileupWrite. type PostIoPileupWriteJSONBody = []PileupLine -// PostIoSlow5ParseJSONBody defines parameters for PostIoSlow5Parse. -type PostIoSlow5ParseJSONBody struct { - Data string `json:"data"` -} +// PostIoSlow5ParseTextBody defines parameters for PostIoSlow5Parse. +type PostIoSlow5ParseTextBody = string // PostIoSlow5SvbCompressJSONBody defines parameters for PostIoSlow5SvbCompress. type PostIoSlow5SvbCompressJSONBody struct { - RawSignal *[]int `json:"rawSignal,omitempty"` + RawSignal []int `json:"rawSignal"` } // PostIoSlow5SvbDecompressJSONBody defines parameters for PostIoSlow5SvbDecompress. type PostIoSlow5SvbDecompressJSONBody struct { - Data *string `json:"data,omitempty"` - LenRawSignal *int `json:"lenRawSignal,omitempty"` - Mask *string `json:"mask,omitempty"` + Data string `json:"data"` + LenRawSignal int `json:"lenRawSignal"` + Mask string `json:"mask"` } // PostIoSlow5WriteJSONBody defines parameters for PostIoSlow5Write. type PostIoSlow5WriteJSONBody struct { - Header *Slow5Header `json:"header,omitempty"` - Reads *[]Slow5Read `json:"reads,omitempty"` + Header Slow5Header `json:"header"` + Reads []Slow5Read `json:"reads"` } // PostPcrComplexPcrJSONBody defines parameters for PostPcrComplexPcr. @@ -550,14 +546,14 @@ type PostIoGenbankParseTextRequestBody = PostIoGenbankParseTextBody // PostIoGenbankWriteJSONRequestBody defines body for PostIoGenbankWrite for application/json ContentType. type PostIoGenbankWriteJSONRequestBody = PostIoGenbankWriteJSONBody -// PostIoPileupParseJSONRequestBody defines body for PostIoPileupParse for application/json ContentType. -type PostIoPileupParseJSONRequestBody PostIoPileupParseJSONBody +// PostIoPileupParseTextRequestBody defines body for PostIoPileupParse for text/plain ContentType. +type PostIoPileupParseTextRequestBody = PostIoPileupParseTextBody // PostIoPileupWriteJSONRequestBody defines body for PostIoPileupWrite for application/json ContentType. type PostIoPileupWriteJSONRequestBody = PostIoPileupWriteJSONBody -// PostIoSlow5ParseJSONRequestBody defines body for PostIoSlow5Parse for application/json ContentType. -type PostIoSlow5ParseJSONRequestBody PostIoSlow5ParseJSONBody +// PostIoSlow5ParseTextRequestBody defines body for PostIoSlow5Parse for text/plain ContentType. +type PostIoSlow5ParseTextRequestBody = PostIoSlow5ParseTextBody // PostIoSlow5SvbCompressJSONRequestBody defines body for PostIoSlow5SvbCompress for application/json ContentType. type PostIoSlow5SvbCompressJSONRequestBody PostIoSlow5SvbCompressJSONBody diff --git a/api/spec.yaml b/api/spec.yaml index b9ecd1e..ef6bc42 100644 --- a/api/spec.yaml +++ b/api/spec.yaml @@ -546,6 +546,10 @@ paths: responses: '200': description: Genbank file written successfully + content: + text/plain: + schema: + type: string /io/fastq/parse: post: tags: @@ -558,14 +562,19 @@ paths: type: string responses: '200': - description: Parsed FASTQ records + description: Parsed FASTA records content: application/json: schema: type: array items: $ref: '#/components/schemas/FastqRead' - + '500': + description: Internal server error + content: + text/plain: + schema: + type: string /io/fastq/write: post: tags: @@ -591,16 +600,10 @@ paths: tags: - io requestBody: - required: true content: - application/json: + text/plain: schema: - type: object - properties: - data: - type: string - required: - - data + type: string responses: '200': description: Array of Pileup Lines @@ -610,6 +613,12 @@ paths: type: array items: $ref: '#/components/schemas/PileupLine' + '500': + description: Internal server error + content: + text/plain: + schema: + type: string /io/pileup/write: post: summary: Write Pileup Data @@ -637,16 +646,10 @@ paths: tags: - io requestBody: - required: true content: - application/json: + text/plain: schema: - type: object - properties: - data: - type: string - required: - - data + type: string responses: '200': description: Parsed slow5 data @@ -661,6 +664,15 @@ paths: type: array items: $ref: '#/components/schemas/Slow5Read' + required: + - header + - reads + '500': + description: Internal server error + content: + text/plain: + schema: + type: string /io/slow5/write: post: summary: Write slow5 Data @@ -679,6 +691,9 @@ paths: type: array items: $ref: '#/components/schemas/Slow5Read' + required: + - header + - reads responses: '200': description: slow5 data written successfully @@ -702,6 +717,8 @@ paths: type: array items: type: integer + required: + - rawSignal responses: '200': description: Compressed raw signal @@ -714,6 +731,12 @@ paths: type: string data: type: string + lenRawSignal: + type: integer + required: + - mask + - data + - lenRawSignal /io/slow5/svb_decompress: post: summary: Decompress Raw Signal with SVB @@ -732,6 +755,10 @@ paths: type: string data: type: string + required: + - mask + - data + - lenRawSignal responses: '200': description: Decompressed raw signal @@ -744,7 +771,14 @@ paths: type: array items: type: integer - + required: + - rawSignal + '500': + description: Internal server error + content: + text/plain: + schema: + type: string /cds/fix: post: