def _readsGeneratorSingle(self, request): compoundId = datamodel.ReadGroupCompoundId.parse( request.read_group_ids[0]) dataset = self.getDataRepository().getDataset(compoundId.dataset_id) readGroupSet = dataset.getReadGroupSet(compoundId.read_group_set_id) referenceSet = readGroupSet.getReferenceSet() if referenceSet is None: raise exceptions.ReadGroupSetNotMappedToReferenceSetException( readGroupSet.getId()) reference = referenceSet.getReference(request.reference_id) readGroup = readGroupSet.getReadGroup(compoundId.read_group_id) intervalIterator = ReadsIntervalIterator(request, readGroup, reference) return intervalIterator
def _readsGeneratorMultiple(self, request): compoundId = datamodel.ReadGroupCompoundId.parse( request.read_group_ids[0]) dataset = self.getDataRepository().getDataset(compoundId.dataset_id) readGroupSet = dataset.getReadGroupSet(compoundId.read_group_set_id) referenceSet = readGroupSet.getReferenceSet() if referenceSet is None: raise exceptions.ReadGroupSetNotMappedToReferenceSetException( readGroupSet.getId()) reference = referenceSet.getReference(request.reference_id) readGroupIds = readGroupSet.getReadGroupIds() if set(readGroupIds) != set(request.read_group_ids): raise exceptions.BadRequestException( "If multiple readGroupIds are specified, " "they must be all of the readGroupIds in a ReadGroupSet") intervalIterator = ReadsIntervalIterator(request, readGroupSet, reference) return intervalIterator