Skip to content

Commit

Permalink
Add another taxon corpus for annotated-taxa. Rename taxa corpus to ta…
Browse files Browse the repository at this point in the history
…xon-variation. (#579)
  • Loading branch information
balhoff authored Jul 10, 2022
1 parent f861de1 commit d628970
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 15 deletions.
18 changes: 9 additions & 9 deletions src/main/resources/swaggerDocs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,7 @@ paths:
format: IRI
- name: corpus
in: query
description: Name of corpus of items to count. A corpus is a particular type of item that can be associated with phenotypes. Allowed values are 'taxa' and 'states'.
description: Name of corpus of items to count. A corpus is a particular type of item that can be associated with phenotypes. Allowed values are 'annotated-taxa', 'taxon-variation', and 'states'.
required: true
type: string
responses:
Expand All @@ -770,7 +770,7 @@ paths:
format: IRI
- name: corpus
in: query
description: Name of corpus of items to count. A corpus is a particular type of item that can be associated with phenotypes. Allowed values are 'taxa' and 'states'.
description: Name of corpus of items to count. A corpus is a particular type of item that can be associated with phenotypes. Allowed values are 'annotated-taxa', 'taxon-variation', and 'states'.
required: true
type: string
responses:
Expand All @@ -790,7 +790,7 @@ paths:
parameters:
- name: corpus
in: query
description: Name of corpus of items to count. A corpus is a particular type of item that can be associated with phenotypes. Allowed values are 'taxa' and 'states'.
description: Name of corpus of items to count. A corpus is a particular type of item that can be associated with phenotypes. Allowed values are 'annotated-taxa', 'taxon-variation', and 'states'.
required: true
type: string
responses:
Expand Down Expand Up @@ -849,7 +849,7 @@ paths:
format: JSON
- name: corpus
in: query
description: Name of corpus of items to count. A corpus is a particular type of item that can be associated with phenotypes. Allowed values are 'taxa' and 'states'.
description: Name of corpus of items to count. A corpus is a particular type of item that can be associated with phenotypes. Allowed values are 'annotated-taxa', 'taxon-variation', and 'states'.
required: false
type: string
responses:
Expand Down Expand Up @@ -888,7 +888,7 @@ paths:
format: JSON
- name: corpus
in: query
description: Name of corpus of items to count. A corpus is a particular type of item that can be associated with phenotypes. Allowed values are 'taxa' and 'states'.
description: Name of corpus of items to count. A corpus is a particular type of item that can be associated with phenotypes. Allowed values are 'annotated-taxa', 'taxon-variation', and 'states'.
required: false
type: string
responses:
Expand Down Expand Up @@ -925,7 +925,7 @@ paths:
type: string
- name: corpus
in: query
description: Name of corpus of items to count. A corpus is a particular type of item that can be associated with phenotypes. Allowed values are 'taxa' and 'states'.
description: Name of corpus of items to count. A corpus is a particular type of item that can be associated with phenotypes. Allowed values are 'annotated-taxa', 'taxon-variation', and 'states'.
required: false
type: string
responses:
Expand Down Expand Up @@ -958,7 +958,7 @@ paths:
type: string
- name: corpus
in: formData
description: Name of corpus of items to count. A corpus is a particular type of item that can be associated with phenotypes. Allowed values are 'taxa' and 'states'.
description: Name of corpus of items to count. A corpus is a particular type of item that can be associated with phenotypes. Allowed values are 'annotated-taxa', 'taxon-variation', and 'states'.
required: false
type: string
responses:
Expand Down Expand Up @@ -990,7 +990,7 @@ paths:
type: string
- name: corpus
in: query
description: Name of corpus of items to count. A corpus is a particular type of item that can be associated with phenotypes. Allowed values are 'taxa' and 'states'.
description: Name of corpus of items to count. A corpus is a particular type of item that can be associated with phenotypes. Allowed values are 'annotated-taxa', 'taxon-variation', and 'states'.
required: true
type: string
- name: type
Expand Down Expand Up @@ -1021,7 +1021,7 @@ paths:
type: string
- name: corpus
in: formData
description: Name of corpus of items to count. A corpus is a particular type of item that can be associated with phenotypes. Allowed values are 'taxa' and 'states'.
description: Name of corpus of items to count. A corpus is a particular type of item that can be associated with phenotypes. Allowed values are 'annotated-taxa', 'taxon-variation', and 'states'.
required: true
type: string
- name: type
Expand Down
12 changes: 7 additions & 5 deletions src/main/scala/org/phenoscape/kb/Main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import akka.util.ByteString
import ch.megard.akka.http.cors.scaladsl.CorsDirectives._
import ch.megard.akka.http.cors.scaladsl.settings.CorsSettings
import org.apache.commons.io.IOUtils
import org.phenoscape.kb.Similarity.{AnatomyTerm, GenesCorpus, PhenotypeCorpus, PhenotypeTerm, SimilarityTermType, StatesCorpus, TaxaCorpus}
import org.phenoscape.kb.Similarity.{AnatomyTerm, AnnotatedTaxaCorpus, GenesCorpus, PhenotypeCorpus, PhenotypeTerm, SimilarityTermType, StatesCorpus, TaxonVariationCorpus}
import org.phenoscape.kb.queries.QueryUtil.{InferredAbsence, InferredPresence, PhenotypicQuality, QualitySpec}
import scalaz._
import spray.json._
Expand Down Expand Up @@ -77,10 +77,12 @@ object Main extends HttpApp with App {
}

implicit val PhenotypeCorpusUnmarshaller: Unmarshaller[String, PhenotypeCorpus] = Unmarshaller.strict {
case "taxa" => TaxaCorpus
case "states" => StatesCorpus
case "genes" => GenesCorpus
case _ => throw new Exception(s"Invalid phenotype corpus name")
case "taxa" => AnnotatedTaxaCorpus
case "annotated-taxa" => AnnotatedTaxaCorpus
case "taxon-variation" => TaxonVariationCorpus
case "states" => StatesCorpus
case "genes" => GenesCorpus
case _ => throw new Exception(s"Invalid phenotype corpus name")
}

implicit val OWLClassUnmarshaller: Unmarshaller[String, OWLClass] =
Expand Down
12 changes: 11 additions & 1 deletion src/main/scala/org/phenoscape/kb/Similarity.scala
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ object Similarity {

}

object TaxaCorpus extends PhenotypeCorpus {
object TaxonVariationCorpus extends PhenotypeCorpus {

val path: Path = PropertyPathParser
.parsePropertyPath(sparql"$has_phenotypic_profile/$rdfType".text)
Expand All @@ -333,6 +333,16 @@ object Similarity {

}

object AnnotatedTaxaCorpus extends PhenotypeCorpus {

val path: Path = PropertyPathParser
.parsePropertyPath(sparql"$exhibits_state/$describes_phenotype".text)
.getOrElse(throw new Exception("Invalid property path"))

def constraint(node: QueryText): QueryText = sparql"$node $rdfsIsDefinedBy $VTO ."

}

object GenesCorpus extends PhenotypeCorpus {

val path: Path = PropertyPathParser
Expand Down

0 comments on commit d628970

Please sign in to comment.