Skip to content
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

Optional websummary download #31

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -190,17 +190,25 @@ public Map<String, Object> getCellRangerSample(@RequestParam("project") String p
public Map<String, Object> getCellRangerFile( @RequestParam("project") String project,
@RequestParam("run") String run,
@RequestParam("sample") String sample,
@RequestParam("type") String type) {
@RequestParam("type") String type,
@RequestParam(required = false, defaultValue = "true") Boolean download) {
log.info(String.format("Retrieving cell ranger output file for run: %s, project: %s, sample: %s, type: %s",
run, project, sample, type));
final String webSummaryPath = getCellRangerOutputPath(run, sample, project, type, WEB_SUMMARY_PATH);
final String data = readFile(webSummaryPath);
String status = String.format("File not found: %s", webSummaryPath);
if(data != null){
status = String.format("Retrieved data from %s", webSummaryPath);

File f = new File(webSummaryPath);
if(!f.exists() || f.isDirectory()) {
String errMessage = String.format("File not found: %s (run=%s project=%s sample=%s type=%s)",
webSummaryPath, run, project, sample, type);
return createErrorResponse(errMessage, true);
}

String status = String.format("Retrieved data from %s", webSummaryPath);
Map<String, Object> resp = createSuccessResponse(status);
resp.put(API_DATA, data);
if(download){
final String data = readFile(webSummaryPath);
resp.put(API_DATA, data);
}
return resp;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public void getCellRangerFile_success() {
log.error(String.format("Failed to test %s. Error: %s", type, e.getMessage()));
}

Map<String,Object> response = cellRangerController.getCellRangerFile(PROJECT, RUN, SAMPLE, type.toString());
Map<String,Object> response = cellRangerController.getCellRangerFile(PROJECT, RUN, SAMPLE, type.toString(), true);
assertNotNull(response.get("data"));
}
}
Expand Down