Beispiel #1
0
 def getVariants(self,
                 referenceName,
                 startPosition,
                 endPosition,
                 callSetIds=None):
     """
     Returns an iterator over the specified variants. The parameters
     correspond to the attributes of a GASearchVariantsRequest object.
     """
     if callSetIds is None:
         callSetIds = self._callSetIds
     else:
         for callSetId in callSetIds:
             if callSetId not in self._callSetIds:
                 raise exceptions.CallSetNotInVariantSetException(
                     callSetId, self.getId())
     if referenceName in self._chromFileMap:
         varFileName = self._chromFileMap[referenceName]
         referenceName, startPosition, endPosition = \
             self.sanitizeVariantFileFetch(
                 referenceName, startPosition, endPosition)
         cursor = self.getFileHandle(varFileName).fetch(
             referenceName, startPosition, endPosition)
         for record in cursor:
             yield self.convertVariant(record, callSetIds)
Beispiel #2
0
 def testCallSetNotInVariantSetException(self):
     exception = exceptions.CallSetNotInVariantSetException('csId', 'vsId')
     response = frontend.handleException(exception)
     self.assertEquals(response.status_code, 404)
     gaException = self.getGa4ghException(response.data)
     self.assertGreater(len(gaException.message), 0)
     self.assertFalse(frontend.app.log_exception.called)
Beispiel #3
0
 def getVariants(self, referenceName, startPosition, endPosition,
                 variantName=None, callSetIds=None):
     """
     Returns an iterator over the specified variants. The parameters
     correspond to the attributes of a GASearchVariantsRequest object.
     """
     if variantName is not None:
         raise exceptions.NotImplementedException(
             "Searching by variantName is not supported")
     # For v0.5.1, callSetIds=[] actually means return all callSets.
     # In v0.6+, callSetIds=[] means return no call sets, and
     # callSetIds=None means return all call sets. For forward
     # compatibility, we use the 0.6 interface for this function but
     # we translate back to the 0.5 interface while we support this.
     # TODO Remove this comment and workaround once we transition to
     # protocol version 0.6
     if callSetIds is None:
         callSetIds = []
     else:
         for callSetId in callSetIds:
             if callSetId not in self._callSetIds:
                 raise exceptions.CallSetNotInVariantSetException(
                     callSetId, self.getId())
     if len(callSetIds) == 0:
         callSetIds = self._callSetIds
     if referenceName in self._chromFileMap:
         varFileName = self._chromFileMap[referenceName]
         referenceName, startPosition, endPosition = \
             self.sanitizeVariantFileFetch(
                 referenceName, startPosition, endPosition)
         cursor = self.getFileHandle(varFileName).fetch(
             referenceName, startPosition, endPosition)
         for record in cursor:
             yield self.convertVariant(record, callSetIds)