Skip to content

Commit

Permalink
Allow calling of multiple tSNEs
Browse files Browse the repository at this point in the history
Default 'Embedding' is -1
  • Loading branch information
KrisDavie committed Feb 22, 2018
1 parent 86d2055 commit 0271c93
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 35 deletions.
1 change: 1 addition & 0 deletions scope-client/src/proto/s.proto
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ message FeatureReply {

message CoordinatesRequest {
string loomFilePath=1;
int32 coordinatesID=2;
}

message CoordinatesReply {
Expand Down
17 changes: 12 additions & 5 deletions scope-server/scopeserver/modules/gserver/GServer.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,18 @@ def get_features(self, loom_file_path, query):
return {'feature': res,
'featureType': resF}

def get_coordinates(self, loom_file_path, EmbeddingName='Embedding'):
def get_coordinates(self, loom_file_path, coordinatesID=-1):
loom = self.get_loom_connection(loom_file_path)
embedding = loom.ca[EmbeddingName]
return {"x": embedding["_X"],
"y": embedding["_Y"]}
if coordinatesID == -1:
embedding = loom.ca['Embedding']
x = embedding['_X']
y = embedding['_Y']
else:
x = loom.ca.Embeddings_X["coordinatesID"]
y = loom.ca.Embeddings_Y["coordinatesID"]
print(x, y)
return {"x": x,
"y": y}

def get_file_metadata(self, loom_file_path):
loom = self.get_loom_connection(loom_file_path)
Expand Down Expand Up @@ -218,7 +225,7 @@ def getFeatures(self, request, context):

def getCoordinates(self, request, context):
# request content
c = self.get_coordinates(self.get_loom_filepath(request.loomFilePath))
c = self.get_coordinates(self.get_loom_filepath(request.loomFilePath), coordinatesID=request.coordinatesID)
return s_pb2.CoordinatesReply(x=c["x"], y=c["y"])

def getMyLooms(self, request, context):
Expand Down
67 changes: 37 additions & 30 deletions scope-server/scopeserver/modules/gserver/s_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 0271c93

Please sign in to comment.