-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from bento-platform/releases/v2.2.0
releases/v2.2.0
- Loading branch information
Showing
16 changed files
with
580 additions
and
167 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
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,25 @@ | ||
package middleware | ||
|
||
import ( | ||
"fmt" | ||
"net/http" | ||
|
||
gq "api/models/constants/genotype-query" | ||
|
||
"github.com/labstack/echo" | ||
) | ||
|
||
func ValidatePotentialGenotypeQueryParameter(next echo.HandlerFunc) echo.HandlerFunc { | ||
return func(c echo.Context) error { | ||
genotypeQP := c.QueryParam("genotype") | ||
|
||
if len(genotypeQP) > 0 { | ||
_, genotypeErr := gq.CastToGenoType(genotypeQP) | ||
if genotypeErr != nil { | ||
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid genotype query %s, %s", genotypeQP, genotypeErr)) | ||
} | ||
} | ||
|
||
return next(c) | ||
} | ||
} |
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,39 @@ | ||
package genotypeQuery | ||
|
||
import ( | ||
"api/models/constants" | ||
"errors" | ||
"strings" | ||
) | ||
|
||
const ( | ||
UNCALLED constants.GenotypeQuery = "" | ||
|
||
// # Haploid | ||
REFERENCE constants.GenotypeQuery = "REFERENCE" | ||
ALTERNATE constants.GenotypeQuery = "ALTERNATE" | ||
|
||
// # Diploid or higher | ||
HOMOZYGOUS_REFERENCE constants.GenotypeQuery = "HOMOZYGOUS_REFERENCE" | ||
HETEROZYGOUS constants.GenotypeQuery = "HETEROZYGOUS" | ||
HOMOZYGOUS_ALTERNATE constants.GenotypeQuery = "HOMOZYGOUS_ALTERNATE" | ||
) | ||
|
||
func CastToGenoType(text string) (constants.GenotypeQuery, error) { | ||
switch strings.ToLower(text) { | ||
case "": | ||
return UNCALLED, nil | ||
case "reference": | ||
return REFERENCE, nil | ||
case "alternate": | ||
return ALTERNATE, nil | ||
case "homozygous_reference": | ||
return HOMOZYGOUS_REFERENCE, nil | ||
case "heterozygous": | ||
return HETEROZYGOUS, nil | ||
case "homozygous_alternate": | ||
return HOMOZYGOUS_ALTERNATE, nil | ||
default: | ||
return UNCALLED, errors.New("unable to parse genotype query") | ||
} | ||
} |
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package constants | ||
|
||
type enumString string | ||
type enumInt int | ||
|
||
type GenotypeQuery enumString | ||
type SearchOperation enumString | ||
|
||
type Zygosity enumInt |
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package search | ||
|
||
import ( | ||
"api/models/constants" | ||
) | ||
|
||
const ( | ||
SEARCH_OP_EQ constants.SearchOperation = "eq" | ||
SEARCH_OP_LT constants.SearchOperation = "lt" | ||
SEARCH_OP_LE constants.SearchOperation = "le" | ||
SEARCH_OP_GT constants.SearchOperation = "gt" | ||
SEARCH_OP_GE constants.SearchOperation = "ge" | ||
|
||
SEARCH_OP_CO constants.SearchOperation = "co" | ||
) |
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,20 @@ | ||
package zygosity | ||
|
||
import ( | ||
"api/models/constants" | ||
) | ||
|
||
const ( | ||
Empty constants.Zygosity = iota - 1 | ||
Unknown | ||
Homozygous | ||
Heterozygous | ||
) | ||
|
||
func IsValid(value int) bool { | ||
return value <= int(Heterozygous) | ||
} | ||
|
||
func IsValidQuery(value int) bool { | ||
return value > int(Empty) && IsValid(value) | ||
} |
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.