Skip to content

Commit

Permalink
Merge pull request #196 from biomage-ltd/download-raw-seurat
Browse files Browse the repository at this point in the history
[BIOMAGE-1226] Implement the backend for download of the raw Seurat object
  • Loading branch information
StefanBabukov authored Aug 5, 2021
2 parents d793a38 + 1499e64 commit 8bdb402
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
20 changes: 15 additions & 5 deletions src/api/route-services/experiment.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ class ExperimentService {
this.experimentsTableName = `experiments-${config.clusterEnv}`;
this.cellSetsBucketName = `cell-sets-${config.clusterEnv}`;
this.processedMatrixBucketName = `processed-matrix-${config.clusterEnv}`;
this.rawSeuratBucketName = `biomage-source-${config.clusterEnv}`;

mockData.matrixPath = mockData.matrixPath.replace('BUCKET_NAME', `biomage-source-${config.clusterEnv}`);
mockData.matrixPath = mockData.matrixPath.replace('BUCKET_NAME', this.rawSeuratBucketName);
this.mockData = convertToDynamoDbRecord(mockData);
}

Expand Down Expand Up @@ -347,12 +348,21 @@ class ExperimentService {
const filenamePrefix = projectId.split('-')[0];

// Also defined in UI repo in utils/downloadTypes
if (downloadType === downloadTypes.PROCESSED_SEURAT_OBJECT) {
bucket = this.processedMatrixBucketName;
objectKey = `${experimentId}/r.rds`;
downloadedFileName = `${filenamePrefix}_processed_matrix.rds`;
// eslint-disable-next-line default-case
switch (downloadType) {
case downloadTypes.PROCESSED_SEURAT_OBJECT:
bucket = this.processedMatrixBucketName;
objectKey = `${experimentId}/r.rds`;
downloadedFileName = `${filenamePrefix}_processed_matrix.rds`;
break;
case downloadTypes.RAW_SEURAT_OBJECT:
bucket = this.rawSeuratBucketName;
objectKey = `${experimentId}/r.rds`;
downloadedFileName = `${filenamePrefix}_raw_matrix.rds`;
break;
}


const s3 = new AWS.S3();

const params = {
Expand Down
1 change: 1 addition & 0 deletions src/utils/downloadTypes.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const downloadTypes = {
PROCESSED_SEURAT_OBJECT: 'processed_seurat_object',
RAW_SEURAT_OBJECT: 'raw_seurat_object',
};

module.exports = downloadTypes;

0 comments on commit 8bdb402

Please sign in to comment.