use of ca.corefacility.bioinformatics.irida.model.sequenceFile.SequenceConcatenation in project irida by phac-nml.
the class SequencingObjectServiceImpl method concatenateSequences.
/**
* {@inheritDoc}
*/
@Override
@PreAuthorize("hasPermission(#toJoin, 'canReadSequencingObject') and hasPermission(#targetSample, 'canUpdateSample')")
@Transactional
public SampleSequencingObjectJoin concatenateSequences(List<SequencingObject> toJoin, String filename, Sample targetSample, boolean removeOriginals) throws ConcatenateException {
SequencingObjectConcatenator<? extends SequencingObject> concatenator = SequencingObjectConcatenatorFactory.getConcatenator(toJoin);
SequencingObject concatenated = concatenator.concatenateFiles(toJoin, filename);
SampleSequencingObjectJoin created = createSequencingObjectInSample(concatenated, targetSample);
concatenationRepository.save(new SequenceConcatenation(created.getObject(), toJoin));
if (removeOriginals) {
for (SequencingObject obj : toJoin) {
SampleSequencingObjectJoin sampleForSequencingObject = ssoRepository.getSampleForSequencingObject(obj);
ssoRepository.delete(sampleForSequencingObject);
}
}
return created;
}
Aggregations