-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Gene ws server v2 #120
Gene ws server v2 #120
Conversation
public GeneWSServerV2() { | ||
} | ||
|
||
@GetMapping(value = "/{geneIds}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the idea is to return the variants in the specified genes instead of returning the gene's coordinates. So change this to /v2/genes/{geneIds}/variants
and return the variants using the coordinates
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed :)
b1f7f3e
to
85a48c2
Compare
MultiMongoDbFactory.setDatabaseNameForCurrentThread(DBAdaptorConnector.getDBName(species + "_" + assembly)); | ||
List<FeatureCoordinates> featureCoordinates = service.findAllByGeneIdsOrGeneNames(geneIds, geneIds); | ||
if (featureCoordinates.size() == 0) { | ||
return new ResponseEntity(featureCoordinates, HttpStatus.NOT_FOUND); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in my opinion, an empty list is more a "204 no content" than a "404 not found"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay :)
Fixed 👍
return new ResponseEntity(featureCoordinates, HttpStatus.NOT_FOUND); | ||
} | ||
String regions = ""; | ||
for (int i = 0; i < featureCoordinates.size(); i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of this loop, use
String regions = featureCoordinates.stream().map(this::getRegionString).collect(Collectors.joining(","));
I prefer the stream version not only for being shorter and with less redundancy, but also because conditions like if (i != featureCoordinates.size() - 1)
are confusing and prone to bugs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed 👍
eva-server/src/main/java/uk/ac/ebi/eva/server/ws/GeneWSServerV2.java
Outdated
Show resolved
Hide resolved
…2.java Co-Authored-By: andresfsilva <afsilva04@gmail.com>
7ee0bdd
to
57cf989
Compare
eva-server/src/test/java/uk/ac/ebi/eva/server/ws/GeneWSServerV2Test.java
Outdated
Show resolved
Hide resolved
eva-server/src/test/java/uk/ac/ebi/eva/server/ws/GeneWSServerV2Test.java
Outdated
Show resolved
Hide resolved
eva-server/src/test/java/uk/ac/ebi/eva/server/ws/GeneWSServerV2Test.java
Show resolved
Hide resolved
eva-server/src/test/java/uk/ac/ebi/eva/server/ws/GeneWSServerV2Test.java
Outdated
Show resolved
Hide resolved
variantList.forEach(variant -> { | ||
chromosomes.add(variant.getChromosome()); | ||
}); | ||
return chromosomes; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method is called testGetVariantsGeneHelper
but is returning chromosomes. This should return variants
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed :)
eva-server/src/test/java/uk/ac/ebi/eva/server/ws/GeneWSServerV2Test.java
Show resolved
Hide resolved
Co-Authored-By: andresfsilva <afsilva04@gmail.com>
The purpose of this PR is to add an endpoint "/v2/genes/{geneIds}" which retrieves a list of
FeatureCoordinates
for the given geneIds.