Skip to content

Commit

Permalink
Cleans up messy rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
scourgemancer committed Apr 6, 2020
1 parent 9448a2f commit d7f45a2
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions src/services/v1.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import {Errors, GET, Path, QueryParam, Return, ContextResponse} from "typescript-rest";
import {AnnotationStatus, Aspect, makeAnnotationIndex} from "../ingest";
import {QueryOption, Segment, Strategy} from "../queries";
import {GeneProductTypeFilter, Query, queryDataset, QueryOption, Segment, Strategy} from "../queries";
import {AnnotationStatus, Aspect, makeAnnotationIndex, StructuredData} from "../ingest";
import {annotationsToGAF, genesToCSV, buildGenesMetadata, buildAnnotationMetadata} from '../export';
import { getDataset } from '../data_fetcher';
import express from "express";
import { getDataset } from '../data_fetcher';

const dataset: StructuredData = getDataset();

type Format = "gaf" | "gene-csv" | "json";

Expand Down Expand Up @@ -63,15 +65,8 @@ export class V1Service {
segments_meta.strategy = strategy;
}

const dataset = getDataset();

// TODO include unannotated genes
const queriedDataset = queryAnnotated(dataset, query);

// TODO include unannotated genes
const format = validateFormat(maybeFormat);

const filters_meta = {filters: segments.map(f=>`${f.aspect}-${f.annotationStatus}`).join(", ")};
const query: Query = { filter, option: option };
const queriedDataset = queryDataset(dataset, query);

switch (format) {
case "gaf":
Expand Down Expand Up @@ -100,9 +95,17 @@ export class V1Service {

@Path("/wgs_segments")
@GET
get_wgs() {
const dataset = getDataset();
const totalGeneCount = Object.keys(dataset.genes.index).length;
get_wgs(
/**
* ?filter=""
* This filter describes which subset of Genes will be used for querying.
* The option for filter are "all" | "include_protein" | "exclude_pseudogene".
*/
@QueryParam("filter") maybeFilter: string = "exclude_pseudogene",
) {
const filter = validateFilter(maybeFilter);
const query: Query = { filter, option: {tag: "QueryGetAll"} };
let queryResult = queryDataset(dataset, query);

const totalGeneCount = Object.keys(queryResult.genes.index).length;
const result = Object.entries(queryResult.annotations.index)
Expand Down

0 comments on commit d7f45a2

Please sign in to comment.