Search in sources :

Example 1 with SequenceConcatenation

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;
}
Also used : SequencingObject(ca.corefacility.bioinformatics.irida.model.sequenceFile.SequencingObject) SequenceConcatenation(ca.corefacility.bioinformatics.irida.model.sequenceFile.SequenceConcatenation) SampleSequencingObjectJoin(ca.corefacility.bioinformatics.irida.model.sample.SampleSequencingObjectJoin) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

SampleSequencingObjectJoin (ca.corefacility.bioinformatics.irida.model.sample.SampleSequencingObjectJoin)1 SequenceConcatenation (ca.corefacility.bioinformatics.irida.model.sequenceFile.SequenceConcatenation)1 SequencingObject (ca.corefacility.bioinformatics.irida.model.sequenceFile.SequencingObject)1 PreAuthorize (org.springframework.security.access.prepost.PreAuthorize)1 Transactional (org.springframework.transaction.annotation.Transactional)1