private S3ObjectReference getS3ReferenceWithIGPerFiles(ExperimentSearch experimentSearch) {
LOG.info("Started reading isotope groups from db...");
final List<IsotopeGroupPerFile> igList = isotopeGroupPerFileRepository.findAllByExperimentSearch(experimentSearch);
final List<IGPerFileWrapper> transformedResults = newLinkedList();
for (IsotopeGroupPerFile isotopeGroupPerFile : igList) {
final RawFile file = isotopeGroupPerFile.getSearchRun().getFile();
final long isotopeGroupId = isotopeGroupPerFile.getId();
final List<MS2Scan> allByIsotopeGroupPerFile = ms2ScanRepository.findAllByIsotopeGroupPerFile(isotopeGroupPerFile);
if (allByIsotopeGroupPerFile == null || allByIsotopeGroupPerFile.size() == 0) {
LOG.warn("Can't find any scan for isotopeGroupPerFile:" + isotopeGroupPerFile.getId());
continue;
}
final MS2Scan ms2Scan = allByIsotopeGroupPerFile.iterator().next();//todo performance!
final Long peptId = (isotopeGroupPerFile.getPeptide() == null) ? null : isotopeGroupPerFile.getPeptide().getId();
transformedResults.add(new IGPerFileWrapper(Long.valueOf(file.getProcessedDataID()), ms2Scan.getScanNumber(), peptId, isotopeGroupId));
}
LOG.info("Completed reading isotope groups from db...");
final Gson gson = new GsonBuilder().serializeSpecialFloatingPointValues().create();
final String s = gson.toJson(transformedResults);
final File tempFile = FileOperations.createTempFile(proteinInterfererTargetFolder + S3ObjectReference.S3_URL_SEPARATOR + "ProteinInterfererResults-" + System.currentTimeMillis());