Skip to content

Commit

Permalink
rename to groupby, move path for distinct endpoint so it better match…
Browse files Browse the repository at this point in the history
…es the standard pattern. remove merge param. change pathparam geneId to be genes. rename snp to be variant. #522
  • Loading branch information
julie-sullivan committed Feb 4, 2020
1 parent 053c8fa commit ebea718
Show file tree
Hide file tree
Showing 7 changed files with 225 additions and 286 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,14 @@ public class ParamConstants {

// ---------------------------------------------


public static final String TRANSCRIPT_IDS = "Comma separated list of transcript IDs, e.g. ENST00000342992. Other transcript symbols "
+ "such as HGNC symbols are allowed as well, e.g.: BRCA2-001";
public static final String TRANSCRIPT_BIOTYPES = "Comma separated list of transcript gencode biotypes, "
+ "e.g. protein_coding,miRNA,lincRNA. Exact text matches will be returned";
public static final String TRANSCRIPT_XREFS = "Comma separated list transcript xrefs ids, "
+ "e.g. ENSG00000145113,35912_at,GO:0002020. Exact text matches will be returned";
public static final String TRANSCRIPT_IDS = "Comma separated list of ENSEMBL transcript ids, "
public static final String TRANSCRIPT_ENSEMBL_IDS = "Comma separated list of ENSEMBL transcript ids, "
+ "e.g. ENST00000342992,ENST00000380152,ENST00000544455. Exact text matches will be returned";
public static final String TRANSCRIPT_NAMES = "Comma separated list of transcript names, e.g. BRCA2-201,TTN-003."
+ " Exact text matches will be returned";
Expand Down Expand Up @@ -91,17 +94,13 @@ public class ParamConstants {

// ---------------------------------------------

public static final String SNP_REFERENCE = "Comma separated list of possible reference to be queried, e.g. A,T";
public static final String SNP_ALTERNATE = "Comma separated list of possible alternate to be queried, e.g. A,T";
public static final String SNP_CONSEQUENCE_TYPE = "Comma separated list of possible SO names describing consequence"
public static final String REFERENCE = "Comma separated list of possible reference to be queried, e.g. A,T";
public static final String ALTERNATE = "Comma separated list of possible alternate to be queried, e.g. A,T";
public static final String CONSEQUENCE_TYPE = "Comma separated list of possible SO names describing consequence"
+ " types to be queried, e.g. missense_variant,downstream_variant. Exact text matches will be retrieved.";
public static final String SNP_MERGE = "Return variants for a gene per CellBaseDataResult or all of them merged"
+ " into the same CellBaseDataResult object.";

// ---------------------------------------------

public static final String TFBS_MERGE = "Return one TFBs per CellBaseDataResult or all of them merged"
+ " into the same CellBaseDataResult object.";
public static final String TFBS_IDS = "String containing a comma separated list of TF names to search, e.g. CTCF";

// ---------------------------------------------
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,15 @@ public Response getModel() {
}

@GET
@Path("/{proteinId}/info")
@Path("/{proteins}/info")
@ApiOperation(httpMethod = "GET", value = "Get the protein info", response = Entry.class,
responseContainer = "QueryResponse")
@ApiImplicitParams({
@ApiImplicitParam(name = "keyword", value = ParamConstants.PROTEIN_KEYWORD,
required = false, dataType = "java.util.List", paramType = "query")
})
public Response getInfoByEnsemblId(@PathParam("proteinId")
@ApiParam(name = "proteinId", value = ParamConstants.PROTEIN_XREF_IDS,
public Response getInfoByEnsemblId(@PathParam("proteins")
@ApiParam(name = "proteins", value = ParamConstants.PROTEIN_XREF_IDS,
required = true) String id,
@QueryParam("exclude")
@ApiParam(value = ParamConstants.EXCLUDE_DESCRIPTION) String exclude,
Expand Down Expand Up @@ -137,7 +137,7 @@ public Response getAll(@QueryParam("exclude")
}

@GET
@Path("/{proteinId}/substitutionScores")
@Path("/{proteins}/substitutionScores")
@ApiOperation(httpMethod = "GET", value = "Get the gene corresponding substitution scores for the input protein",
notes = "Schema of returned objects will vary depending on provided query parameters. If the amino acid "
+ " position is provided, all scores will be returned for every possible amino acid"
Expand All @@ -156,8 +156,8 @@ public Response getAll(@QueryParam("exclude")
+ " of aminoacid names, e.g.: CYS",
required = false, dataType = "String", paramType = "query")
})
public Response getSubstitutionScores(@PathParam("proteinId")
@ApiParam(name = "proteinId",
public Response getSubstitutionScores(@PathParam("proteins")
@ApiParam(name = "proteins",
value = "String indicating one xref id, e.g.: Q9UL59, Exact text "
+ "matches will be returned",
required = true) String id,
Expand Down Expand Up @@ -203,10 +203,10 @@ public Response getSubstitutionScores(@PathParam("proteinId")
}

@GET
@Path("/{proteinId}/name")
@Path("/{proteins}/name")
@ApiOperation(httpMethod = "GET", value = "Deprecated", hidden = true)
@Deprecated
public Response getproteinByName(@PathParam("proteinId") String id) {
public Response getproteinByName(@PathParam("proteins") String id) {
try {
parseQueryParams();
ProteinDBAdaptor geneDBAdaptor = dbAdaptorFactory.getProteinDBAdaptor(this.species, this.assembly);
Expand All @@ -217,35 +217,35 @@ public Response getproteinByName(@PathParam("proteinId") String id) {
}

@GET
@Path("/{proteinId}/gene")
@Path("/{proteins}/gene")
@ApiOperation(httpMethod = "GET", value = "Get the gene corresponding to the input protein", hidden = true)
public Response getGene(@PathParam("proteinId") String query) {
public Response getGene(@PathParam("proteins") String query) {
return null;
}

@GET
@Path("/{proteinId}/transcript")
@Path("/{proteins}/transcript")
@ApiOperation(httpMethod = "GET", value = "To be implemented", hidden = true)
public Response getTranscript(@PathParam("proteinId") String query) {
public Response getTranscript(@PathParam("proteins") String query) {
return null;
}

@GET
@Path("/{proteinId}/sequence")
@Path("/{proteins}/sequence")
@ApiOperation(httpMethod = "GET", value = "Get the aa sequence for the given protein", response = String.class,
responseContainer = "QueryResponse")
public Response getSequence(@PathParam("proteinId")
@ApiParam (name = "proteinId", value = "UniProt accession id, e.g: Q9UL59",
required = true) String proteinId) {
public Response getSequence(@PathParam("proteins")
@ApiParam (name = "proteins", value = "UniProt accession id, e.g: Q9UL59",
required = true) String proteins) {
ProteinDBAdaptor proteinDBAdaptor = dbAdaptorFactory.getProteinDBAdaptor(this.species, this.assembly);
query.put(ProteinDBAdaptor.QueryParams.ACCESSION.key(), proteinId);
query.put(ProteinDBAdaptor.QueryParams.ACCESSION.key(), proteins);
queryOptions.put("include", "sequence.value");
// split by comma
CellBaseDataResult<Entry> queryResult = proteinDBAdaptor.get(query, queryOptions);
CellBaseDataResult<String> queryResult1 = new CellBaseDataResult<>(queryResult.getId(), queryResult.getTime(),
queryResult.getEvents(), queryResult.getNumResults(), Collections.emptyList(), 1);
queryResult1.setResults(Collections.singletonList(queryResult.first().getSequence().getValue()));
queryResult1.setId(proteinId);
queryResult1.setId(proteins);
return createOkResponse(queryResult1);
}

Expand Down
Loading

0 comments on commit ebea718

Please sign in to comment.