use of org.nextprot.api.commons.exception.NextProtException in project nextprot-api by calipho-sib.
the class ChromosomeReportController method exportChromosomeEntryWithUnconfirmedMsData.
@ApiMethod(path = "/chromosome-report/export/hpp/unconfirmed-ms-data-entries", verb = ApiVerb.GET, description = "Export list of unconfirmed MS data protein entries", produces = { MediaType.TEXT_PLAIN_VALUE })
@RequestMapping(value = "/chromosome-report/export/hpp/unconfirmed-ms-data-entries", method = { RequestMethod.GET })
public void exportChromosomeEntryWithUnconfirmedMsData(HttpServletResponse response) {
try (OutputStream os = response.getOutputStream()) {
response.setHeader("Content-Disposition", "attachment; filename=\"HPP_entries_with_unconfirmed_MS_data.txt\"");
chromosomeReportExportService.exportUnconfirmedMsEntries(os);
} catch (IOException e) {
throw new NextProtException(e.getMessage() + ": cannot export unconfirmed MS data protein entries");
}
}
use of org.nextprot.api.commons.exception.NextProtException in project nextprot-api by calipho-sib.
the class ChromosomeReportController method exportChromosomeEntryWithNAcetyl.
@ApiMethod(path = "/chromosome-report/export/hpp/nacetylated-entries", verb = ApiVerb.GET, description = "Export list of N-acetylated protein entries", produces = { NextprotMediaType.TSV_MEDIATYPE_VALUE })
@RequestMapping(value = "/chromosome-report/export/hpp/nacetylated-entries", method = { RequestMethod.GET })
public void exportChromosomeEntryWithNAcetyl(HttpServletResponse response) {
try (OutputStream os = response.getOutputStream()) {
response.setHeader("Content-Disposition", "attachment; filename=\"HPP_entries_with_nacetyl_by_chromosome.tsv\"");
chromosomeReportExportService.exportNAcetylatedEntries(os);
} catch (IOException e) {
throw new NextProtException(e.getMessage() + ": cannot export N-acetylated protein entries");
}
}
use of org.nextprot.api.commons.exception.NextProtException in project nextprot-api by calipho-sib.
the class ChromosomeReportController method exportChromosomeEntryWithPhospho.
@ApiMethod(path = "/chromosome-report/export/hpp/phosphorylated-entries", verb = ApiVerb.GET, description = "Export list of phosphorylated protein entries", produces = { NextprotMediaType.TSV_MEDIATYPE_VALUE })
@RequestMapping(value = "/chromosome-report/export/hpp/phosphorylated-entries", method = { RequestMethod.GET })
public void exportChromosomeEntryWithPhospho(HttpServletResponse response) {
try (OutputStream os = response.getOutputStream()) {
response.setHeader("Content-Disposition", "attachment; filename=\"HPP_entries_with_phospho_by_chromosome.tsv\"");
chromosomeReportExportService.exportPhosphorylatedEntries(os);
} catch (IOException e) {
throw new NextProtException(e.getMessage() + ": cannot export phosphorylated protein entries");
}
}
use of org.nextprot.api.commons.exception.NextProtException in project nextprot-api by calipho-sib.
the class ChromosomeReportController method exportChromosomeEntriesReportFile.
@ApiMethod(path = "/chromosome-report/export/{chromosome}", verb = ApiVerb.GET, description = "Export informations of neXtProt entries located on a given chromosome", produces = { MediaType.TEXT_PLAIN_VALUE, NextprotMediaType.TSV_MEDIATYPE_VALUE })
@RequestMapping(value = "/chromosome-report/export/{chromosome}", method = { RequestMethod.GET })
public void exportChromosomeEntriesReportFile(@ApiPathParam(name = "chromosome", description = "The chromosome number or name (X,Y..)", allowedvalues = { "Y" }) @PathVariable("chromosome") String chromosome, HttpServletRequest request, HttpServletResponse response) {
NextprotMediaType mediaType = NextprotMediaType.valueOf(request);
try (OutputStream os = response.getOutputStream()) {
String filename = "nextprot_chromosome_" + chromosome + "." + mediaType.getExtension();
response.setHeader("Content-Disposition", "attachment; filename=\"" + filename + "\"");
chromosomeReportExportService.exportChromosomeEntryReport(chromosome, NextprotMediaType.valueOf(request), os);
} catch (IOException e) {
throw new NextProtException(e.getMessage() + ": cannot export chromosome " + chromosome + " as " + mediaType);
}
}
use of org.nextprot.api.commons.exception.NextProtException in project nextprot-api by calipho-sib.
the class StatementRemoteServiceImpl method getGeneNamesAndEnvironmentForRelease.
Set<String> getGeneNamesAndEnvironmentForRelease(NextProtSource source, String release) {
Set<String> genes = new TreeSet<>();
String urlString = source.getStatementsUrl() + "/" + release;
LOGGER.info("Requesting " + urlString);
try {
String content = IOUtils.toString(getInputStreamFromUrl(urlString), "UTF8");
Pattern pattern = Pattern.compile("href\\=\\\"(.*).json\\\"", Pattern.MULTILINE);
Matcher matcher = pattern.matcher(content);
while (matcher.find()) {
genes.add(matcher.group(1));
}
} catch (IOException e) {
throw new NextProtException("Not possible to return gene names " + e.getLocalizedMessage());
}
return genes;
}
Aggregations