text
stringlengths
81
112k
Call this method before importing a ga4gh module in the scripts dir. Otherwise, you will be using the installed package instead of the development package. Assumes a certain directory structure. def ga4ghImportGlue(): """ Call this method before importing a ga4gh module in the scripts dir. Othe...
Update the priority of the file handle. The element is first removed and then added to the left of the deque. def _update(self, dataFile, handle): """ Update the priority of the file handle. The element is first removed and then added to the left of the deque. """ self._...
Remove the least recently used file handle from the cache. The pop method removes an element from the right of the deque. Returns the name of the file that has been removed. def _removeLru(self): """ Remove the least recently used file handle from the cache. The pop method remov...
Returns handle associated to the filename. If the file is already opened, update its priority in the cache and return its handle. Otherwise, open the file using openMethod, store it in the cache and return the corresponding handle. def getFileHandle(self, dataFile, openMethod): """ ...
Join an array of ids into a compound id string def join(cls, splits): """ Join an array of ids into a compound id string """ segments = [] for split in splits: segments.append('"{}",'.format(split)) if len(segments) > 0: segments[-1] = segments[-1...
Parses the specified compoundId string and returns an instance of this CompoundId class. :raises: An ObjectWithIdNotFoundException if parsing fails. This is because this method is a client-facing method, and if a malformed identifier (under our internal rules) is provided, the response ...
Mildly obfuscates the specified ID string in an easily reversible fashion. This is not intended for security purposes, but rather to dissuade users from depending on our internal ID structures. def obfuscate(cls, idStr): """ Mildly obfuscates the specified ID string in an easily reversi...
Reverses the obfuscation done by the :meth:`obfuscate` method. If an identifier arrives without correct base64 padding this function will append it to the end. def deobfuscate(cls, data): """ Reverses the obfuscation done by the :meth:`obfuscate` method. If an identifier arrives...
Sets the attrbutes of a message during serialization. def serializeAttributes(self, msg): """ Sets the attrbutes of a message during serialization. """ attributes = self.getAttributes() for key in attributes: protocol.setAttribute( msg.attributes.attr...
Scans the specified directory for files with the specified globbing pattern and calls self._addDataFile for each. Raises an EmptyDirException if no data files are found. def _scanDataFiles(self, dataDir, patterns): """ Scans the specified directory for files with the specified globbing ...
Attempts to get a list of peers from a file specified in configuration. This file has one URL per line and can contain newlines and comments. # Main ga4gh node http://1kgenomes.ga4gh.org # Local intranet peer https://192.168.1.1 The server will attempt to add URLs in this file...
Takes the datarepository, a url, and an optional logger and attempts to add the peer into the repository. def insertInitialPeer(dataRepository, url, logger=None): """ Takes the datarepository, a url, and an optional logger and attempts to add the peer into the repository. """ insertPeer = dataR...
Attempts to return whether a given URL string is valid by checking for the presence of the URL scheme and netloc using the urlparse module, and then using a regex. From http://stackoverflow.com/questions/7160737/ def isUrl(urlString): """ Attempts to return whether a given URL string is valid by c...
Attempt to safely set the URL by string. def setUrl(self, url): """ Attempt to safely set the URL by string. """ if isUrl(url): self._url = url else: raise exceptions.BadUrlException(url) return self
Sets the attributes dictionary from a JSON string. def setAttributesJson(self, attributesJson): """ Sets the attributes dictionary from a JSON string. """ try: self._attributes = json.loads(attributesJson) except: raise exceptions.InvalidJsonException(att...
This method accepts a model record and sets class variables. def populateFromRow(self, peerRecord): """ This method accepts a model record and sets class variables. """ self.setUrl(peerRecord.url) \ .setAttributesJson(peerRecord.attributes) return self
Returns a generator over the results for the specified request, which is over a set of objects of the specified size. The objects are returned by call to the specified method, which must take a single integer as an argument. The returned generator yields a sequence of (object, nextPageTo...
Returns a generator over the results for the specified request, from a set of protocol objects of the specified size. The objects are returned by call to the specified method, which must take a single integer as an argument. The returned generator yields a sequence of (object, nextPageTo...
Returns a generator over the objects in the specified list using _protocolObjectGenerator to generate page tokens. def _protocolListGenerator(self, request, objectList): """ Returns a generator over the objects in the specified list using _protocolObjectGenerator to generate page tokens...
Returns a generator over the objects in the specified list using _topLevelObjectGenerator to generate page tokens. def _objectListGenerator(self, request, objectList): """ Returns a generator over the objects in the specified list using _topLevelObjectGenerator to generate page tokens. ...
Returns a generator over the (dataset, nextPageToken) pairs defined by the specified request def datasetsGenerator(self, request): """ Returns a generator over the (dataset, nextPageToken) pairs defined by the specified request """ return self._topLevelObjectGenerator( ...
Returns a generator over the (phenotypeAssociationSet, nextPageToken) pairs defined by the specified request def phenotypeAssociationSetsGenerator(self, request): """ Returns a generator over the (phenotypeAssociationSet, nextPageToken) pairs defined by the specified request """...
Returns a generator over the (readGroupSet, nextPageToken) pairs defined by the specified request. def readGroupSetsGenerator(self, request): """ Returns a generator over the (readGroupSet, nextPageToken) pairs defined by the specified request. """ dataset = self.getData...
Returns a generator over the results for the specified request, which is over a set of objects of the specified size. The objects are returned by call to the specified method, which must take a single integer as an argument. The returned generator yields a sequence of (object, nextPageTo...
Returns a generator over the (referenceSet, nextPageToken) pairs defined by the specified request. def referenceSetsGenerator(self, request): """ Returns a generator over the (referenceSet, nextPageToken) pairs defined by the specified request. """ results = [] f...
Returns a generator over the (reference, nextPageToken) pairs defined by the specified request. def referencesGenerator(self, request): """ Returns a generator over the (reference, nextPageToken) pairs defined by the specified request. """ referenceSet = self.getDataRepo...
Returns a generator over the (variantSet, nextPageToken) pairs defined by the specified request. def variantSetsGenerator(self, request): """ Returns a generator over the (variantSet, nextPageToken) pairs defined by the specified request. """ dataset = self.getDataReposi...
Returns a generator over the (variantAnnotationSet, nextPageToken) pairs defined by the specified request. def variantAnnotationSetsGenerator(self, request): """ Returns a generator over the (variantAnnotationSet, nextPageToken) pairs defined by the specified request. """ ...
Returns a generator over the (read, nextPageToken) pairs defined by the specified request def readsGenerator(self, request): """ Returns a generator over the (read, nextPageToken) pairs defined by the specified request """ if not request.reference_id: raise e...
Returns a generator over the (variant, nextPageToken) pairs defined by the specified request. def variantsGenerator(self, request): """ Returns a generator over the (variant, nextPageToken) pairs defined by the specified request. """ compoundId = datamodel.VariantSetComp...
Returns a generator over the (variantAnnotaitons, nextPageToken) pairs defined by the specified request. def variantAnnotationsGenerator(self, request): """ Returns a generator over the (variantAnnotaitons, nextPageToken) pairs defined by the specified request. """ compo...
Returns a generator over the (features, nextPageToken) pairs defined by the (JSON string) request. def featuresGenerator(self, request): """ Returns a generator over the (features, nextPageToken) pairs defined by the (JSON string) request. """ compoundId = None p...
Returns a generator over the (continuous, nextPageToken) pairs defined by the (JSON string) request. def continuousGenerator(self, request): """ Returns a generator over the (continuous, nextPageToken) pairs defined by the (JSON string) request. """ compoundId = None ...
Returns a generator over the (phenotypes, nextPageToken) pairs defined by the (JSON string) request def phenotypesGenerator(self, request): """ Returns a generator over the (phenotypes, nextPageToken) pairs defined by the (JSON string) request """ # TODO make paging work...
Returns a generator over the (phenotypes, nextPageToken) pairs defined by the (JSON string) request def genotypesPhenotypesGenerator(self, request): """ Returns a generator over the (phenotypes, nextPageToken) pairs defined by the (JSON string) request """ # TODO make pa...
Returns a generator over the (callSet, nextPageToken) pairs defined by the specified request. def callSetsGenerator(self, request): """ Returns a generator over the (callSet, nextPageToken) pairs defined by the specified request. """ compoundId = datamodel.VariantSetComp...
Returns a generator over the (featureSet, nextPageToken) pairs defined by the specified request. def featureSetsGenerator(self, request): """ Returns a generator over the (featureSet, nextPageToken) pairs defined by the specified request. """ dataset = self.getDataReposi...
Returns a generator over the (continuousSet, nextPageToken) pairs defined by the specified request. def continuousSetsGenerator(self, request): """ Returns a generator over the (continuousSet, nextPageToken) pairs defined by the specified request. """ dataset = self.getD...
Returns a generator over the (rnaQuantificationSet, nextPageToken) pairs defined by the specified request. def rnaQuantificationSetsGenerator(self, request): """ Returns a generator over the (rnaQuantificationSet, nextPageToken) pairs defined by the specified request. """ ...
Returns a generator over the (rnaQuantification, nextPageToken) pairs defined by the specified request. def rnaQuantificationsGenerator(self, request): """ Returns a generator over the (rnaQuantification, nextPageToken) pairs defined by the specified request. """ if len(...
Returns a generator over the (expressionLevel, nextPageToken) pairs defined by the specified request. Currently only supports searching over a specified rnaQuantification def expressionLevelsGenerator(self, request): """ Returns a generator over the (expressionLevel, nextPageToken) pai...
Runs a get request by converting the specified datamodel object into its protocol representation. def runGetRequest(self, obj): """ Runs a get request by converting the specified datamodel object into its protocol representation. """ protocolElement = obj.toProtocolEleme...
Runs the specified request. The request is a string containing a JSON representation of an instance of the specified requestClass. We return a string representation of an instance of the specified responseClass in JSON format. Objects are filled into the page list using the specified obj...
Runs a listReferenceBases request for the specified ID and request arguments. def runListReferenceBases(self, requestJson): """ Runs a listReferenceBases request for the specified ID and request arguments. """ # In the case when an empty post request is made to the endpo...
Returns a callset with the given id def runGetCallSet(self, id_): """ Returns a callset with the given id """ compoundId = datamodel.CallSetCompoundId.parse(id_) dataset = self.getDataRepository().getDataset(compoundId.dataset_id) variantSet = dataset.getVariantSet(compo...
Returns information about the service including protocol version. def runGetInfo(self, request): """ Returns information about the service including protocol version. """ return protocol.toJson(protocol.GetInfoResponse( protocol_version=protocol.version))
Takes a flask request from the frontend and attempts to parse into an AnnouncePeerRequest. If successful, it will log the announcement to the `announcement` table with some other metadata gathered from the request. def runAddAnnouncement(self, flaskrequest): """ Takes a flask re...
Takes a ListPeersRequest and returns a ListPeersResponse using a page_token and page_size if provided. def runListPeers(self, request): """ Takes a ListPeersRequest and returns a ListPeersResponse using a page_token and page_size if provided. """ return self.runSearchReq...
Returns a variant with the given id def runGetVariant(self, id_): """ Returns a variant with the given id """ compoundId = datamodel.VariantCompoundId.parse(id_) dataset = self.getDataRepository().getDataset(compoundId.dataset_id) variantSet = dataset.getVariantSet(compo...
Runs a getBiosample request for the specified ID. def runGetBiosample(self, id_): """ Runs a getBiosample request for the specified ID. """ compoundId = datamodel.BiosampleCompoundId.parse(id_) dataset = self.getDataRepository().getDataset(compoundId.dataset_id) biosampl...
Runs a getIndividual request for the specified ID. def runGetIndividual(self, id_): """ Runs a getIndividual request for the specified ID. """ compoundId = datamodel.BiosampleCompoundId.parse(id_) dataset = self.getDataRepository().getDataset(compoundId.dataset_id) indiv...
Returns JSON string of the feature object corresponding to the feature compoundID passed in. def runGetFeature(self, id_): """ Returns JSON string of the feature object corresponding to the feature compoundID passed in. """ compoundId = datamodel.FeatureCompoundId.parse(...
Returns a readGroupSet with the given id_ def runGetReadGroupSet(self, id_): """ Returns a readGroupSet with the given id_ """ compoundId = datamodel.ReadGroupSetCompoundId.parse(id_) dataset = self.getDataRepository().getDataset(compoundId.dataset_id) readGroupSet = dat...
Returns a read group with the given id_ def runGetReadGroup(self, id_): """ Returns a read group with the given id_ """ compoundId = datamodel.ReadGroupCompoundId.parse(id_) dataset = self.getDataRepository().getDataset(compoundId.dataset_id) readGroupSet = dataset.getRe...
Runs a getReference request for the specified ID. def runGetReference(self, id_): """ Runs a getReference request for the specified ID. """ compoundId = datamodel.ReferenceCompoundId.parse(id_) referenceSet = self.getDataRepository().getReferenceSet( compoundId.refer...
Runs a getReferenceSet request for the specified ID. def runGetReferenceSet(self, id_): """ Runs a getReferenceSet request for the specified ID. """ referenceSet = self.getDataRepository().getReferenceSet(id_) return self.runGetRequest(referenceSet)
Runs a getVariantSet request for the specified ID. def runGetVariantSet(self, id_): """ Runs a getVariantSet request for the specified ID. """ compoundId = datamodel.VariantSetCompoundId.parse(id_) dataset = self.getDataRepository().getDataset(compoundId.dataset_id) vari...
Runs a getFeatureSet request for the specified ID. def runGetFeatureSet(self, id_): """ Runs a getFeatureSet request for the specified ID. """ compoundId = datamodel.FeatureSetCompoundId.parse(id_) dataset = self.getDataRepository().getDataset(compoundId.dataset_id) feat...
Runs a getContinuousSet request for the specified ID. def runGetContinuousSet(self, id_): """ Runs a getContinuousSet request for the specified ID. """ compoundId = datamodel.ContinuousSetCompoundId.parse(id_) dataset = self.getDataRepository().getDataset(compoundId.dataset_id) ...
Runs a getDataset request for the specified ID. def runGetDataset(self, id_): """ Runs a getDataset request for the specified ID. """ dataset = self.getDataRepository().getDataset(id_) return self.runGetRequest(dataset)
Runs a getVariantSet request for the specified ID. def runGetVariantAnnotationSet(self, id_): """ Runs a getVariantSet request for the specified ID. """ compoundId = datamodel.VariantAnnotationSetCompoundId.parse(id_) dataset = self.getDataRepository().getDataset(compoundId.data...
Runs a getRnaQuantification request for the specified ID. def runGetRnaQuantification(self, id_): """ Runs a getRnaQuantification request for the specified ID. """ compoundId = datamodel.RnaQuantificationCompoundId.parse(id_) dataset = self.getDataRepository().getDataset(compoun...
Runs a getRnaQuantificationSet request for the specified ID. def runGetRnaQuantificationSet(self, id_): """ Runs a getRnaQuantificationSet request for the specified ID. """ compoundId = datamodel.RnaQuantificationSetCompoundId.parse(id_) dataset = self.getDataRepository().getDat...
Runs a getExpressionLevel request for the specified ID. def runGetExpressionLevel(self, id_): """ Runs a getExpressionLevel request for the specified ID. """ compoundId = datamodel.ExpressionLevelCompoundId.parse(id_) dataset = self.getDataRepository().getDataset(compoundId.data...
Runs the specified SearchReadGroupSetsRequest. def runSearchReadGroupSets(self, request): """ Runs the specified SearchReadGroupSetsRequest. """ return self.runSearchRequest( request, protocol.SearchReadGroupSetsRequest, protocol.SearchReadGroupSetsResponse, ...
Runs the specified search SearchIndividualsRequest. def runSearchIndividuals(self, request): """ Runs the specified search SearchIndividualsRequest. """ return self.runSearchRequest( request, protocol.SearchIndividualsRequest, protocol.SearchIndividualsResponse, ...
Runs the specified SearchBiosamplesRequest. def runSearchBiosamples(self, request): """ Runs the specified SearchBiosamplesRequest. """ return self.runSearchRequest( request, protocol.SearchBiosamplesRequest, protocol.SearchBiosamplesResponse, self.bi...
Runs the specified SearchReadsRequest. def runSearchReads(self, request): """ Runs the specified SearchReadsRequest. """ return self.runSearchRequest( request, protocol.SearchReadsRequest, protocol.SearchReadsResponse, self.readsGenerator)
Runs the specified SearchReferenceSetsRequest. def runSearchReferenceSets(self, request): """ Runs the specified SearchReferenceSetsRequest. """ return self.runSearchRequest( request, protocol.SearchReferenceSetsRequest, protocol.SearchReferenceSetsResponse, ...
Runs the specified SearchReferenceRequest. def runSearchReferences(self, request): """ Runs the specified SearchReferenceRequest. """ return self.runSearchRequest( request, protocol.SearchReferencesRequest, protocol.SearchReferencesResponse, self.refe...
Runs the specified SearchVariantSetsRequest. def runSearchVariantSets(self, request): """ Runs the specified SearchVariantSetsRequest. """ return self.runSearchRequest( request, protocol.SearchVariantSetsRequest, protocol.SearchVariantSetsResponse, se...
Runs the specified SearchVariantAnnotationSetsRequest. def runSearchVariantAnnotationSets(self, request): """ Runs the specified SearchVariantAnnotationSetsRequest. """ return self.runSearchRequest( request, protocol.SearchVariantAnnotationSetsRequest, protocol.S...
Runs the specified SearchVariantRequest. def runSearchVariants(self, request): """ Runs the specified SearchVariantRequest. """ return self.runSearchRequest( request, protocol.SearchVariantsRequest, protocol.SearchVariantsResponse, self.variantsGenera...
Runs the specified SearchVariantAnnotationsRequest. def runSearchVariantAnnotations(self, request): """ Runs the specified SearchVariantAnnotationsRequest. """ return self.runSearchRequest( request, protocol.SearchVariantAnnotationsRequest, protocol.SearchVariant...
Runs the specified SearchCallSetsRequest. def runSearchCallSets(self, request): """ Runs the specified SearchCallSetsRequest. """ return self.runSearchRequest( request, protocol.SearchCallSetsRequest, protocol.SearchCallSetsResponse, self.callSetsGene...
Runs the specified SearchDatasetsRequest. def runSearchDatasets(self, request): """ Runs the specified SearchDatasetsRequest. """ return self.runSearchRequest( request, protocol.SearchDatasetsRequest, protocol.SearchDatasetsResponse, self.datasetsGene...
Returns a SearchFeatureSetsResponse for the specified SearchFeatureSetsRequest object. def runSearchFeatureSets(self, request): """ Returns a SearchFeatureSetsResponse for the specified SearchFeatureSetsRequest object. """ return self.runSearchRequest( reques...
Returns a SearchFeaturesResponse for the specified SearchFeaturesRequest object. :param request: JSON string representing searchFeaturesRequest :return: JSON string representing searchFeatureResponse def runSearchFeatures(self, request): """ Returns a SearchFeaturesResponse for...
Returns a SearchContinuousSetsResponse for the specified SearchContinuousSetsRequest object. def runSearchContinuousSets(self, request): """ Returns a SearchContinuousSetsResponse for the specified SearchContinuousSetsRequest object. """ return self.runSearchRequest( ...
Returns a SearchContinuousResponse for the specified SearchContinuousRequest object. :param request: JSON string representing searchContinuousRequest :return: JSON string representing searchContinuousResponse def runSearchContinuous(self, request): """ Returns a SearchContinuou...
Returns a SearchRnaQuantificationSetsResponse for the specified SearchRnaQuantificationSetsRequest object. def runSearchRnaQuantificationSets(self, request): """ Returns a SearchRnaQuantificationSetsResponse for the specified SearchRnaQuantificationSetsRequest object. """ ...
Returns a SearchRnaQuantificationResponse for the specified SearchRnaQuantificationRequest object. def runSearchRnaQuantifications(self, request): """ Returns a SearchRnaQuantificationResponse for the specified SearchRnaQuantificationRequest object. """ return self.runSe...
Returns a SearchExpressionLevelResponse for the specified SearchExpressionLevelRequest object. def runSearchExpressionLevels(self, request): """ Returns a SearchExpressionLevelResponse for the specified SearchExpressionLevelRequest object. """ return self.runSearchReques...
Populates the instance variables of this Dataset from the specified database row. def populateFromRow(self, dataset): """ Populates the instance variables of this Dataset from the specified database row. """ self._description = dataset.description self.setAttribu...
Adds the specified variantSet to this dataset. def addVariantSet(self, variantSet): """ Adds the specified variantSet to this dataset. """ id_ = variantSet.getId() self._variantSetIdMap[id_] = variantSet self._variantSetNameMap[variantSet.getLocalId()] = variantSet ...
Adds the specified biosample to this dataset. def addBiosample(self, biosample): """ Adds the specified biosample to this dataset. """ id_ = biosample.getId() self._biosampleIdMap[id_] = biosample self._biosampleIds.append(id_) self._biosampleNameMap[biosample.ge...
Adds the specified individual to this dataset. def addIndividual(self, individual): """ Adds the specified individual to this dataset. """ id_ = individual.getId() self._individualIdMap[id_] = individual self._individualIds.append(id_) self._individualNameMap[ind...
Adds the specified featureSet to this dataset. def addFeatureSet(self, featureSet): """ Adds the specified featureSet to this dataset. """ id_ = featureSet.getId() self._featureSetIdMap[id_] = featureSet self._featureSetIds.append(id_) name = featureSet.getLocalI...
Adds the specified continuousSet to this dataset. def addContinuousSet(self, continuousSet): """ Adds the specified continuousSet to this dataset. """ id_ = continuousSet.getId() self._continuousSetIdMap[id_] = continuousSet self._continuousSetIds.append(id_) nam...
Adds the specified readGroupSet to this dataset. def addReadGroupSet(self, readGroupSet): """ Adds the specified readGroupSet to this dataset. """ id_ = readGroupSet.getId() self._readGroupSetIdMap[id_] = readGroupSet self._readGroupSetNameMap[readGroupSet.getLocalId()] ...
Adds the specified rnaQuantification set to this dataset. def addRnaQuantificationSet(self, rnaQuantSet): """ Adds the specified rnaQuantification set to this dataset. """ id_ = rnaQuantSet.getId() self._rnaQuantificationSetIdMap[id_] = rnaQuantSet self._rnaQuantificatio...
Returns the VariantSet with the specified name, or raises a VariantSetNotFoundException otherwise. def getVariantSet(self, id_): """ Returns the VariantSet with the specified name, or raises a VariantSetNotFoundException otherwise. """ if id_ not in self._variantSetIdMap...
Returns a VariantSet with the specified name, or raises a VariantSetNameNotFoundException if it does not exist. def getVariantSetByName(self, name): """ Returns a VariantSet with the specified name, or raises a VariantSetNameNotFoundException if it does not exist. """ if...
Adds the specified g2p association set to this backend. def addPhenotypeAssociationSet(self, phenotypeAssociationSet): """ Adds the specified g2p association set to this backend. """ id_ = phenotypeAssociationSet.getId() self._phenotypeAssociationSetIdMap[id_] = phenotypeAssocia...
Returns the FeatureSet with the specified id, or raises a FeatureSetNotFoundException otherwise. def getFeatureSet(self, id_): """ Returns the FeatureSet with the specified id, or raises a FeatureSetNotFoundException otherwise. """ if id_ not in self._featureSetIdMap: ...
Returns the FeatureSet with the specified name, or raises an exception otherwise. def getFeatureSetByName(self, name): """ Returns the FeatureSet with the specified name, or raises an exception otherwise. """ if name not in self._featureSetNameMap: raise exce...
Returns the ContinuousSet with the specified id, or raises a ContinuousSetNotFoundException otherwise. def getContinuousSet(self, id_): """ Returns the ContinuousSet with the specified id, or raises a ContinuousSetNotFoundException otherwise. """ if id_ not in self._cont...
Returns the ContinuousSet with the specified name, or raises an exception otherwise. def getContinuousSetByName(self, name): """ Returns the ContinuousSet with the specified name, or raises an exception otherwise. """ if name not in self._continuousSetNameMap: ...
Returns a Biosample with the specified name, or raises a BiosampleNameNotFoundException if it does not exist. def getBiosampleByName(self, name): """ Returns a Biosample with the specified name, or raises a BiosampleNameNotFoundException if it does not exist. """ if name...
Returns the Biosample with the specified id, or raises a BiosampleNotFoundException otherwise. def getBiosample(self, id_): """ Returns the Biosample with the specified id, or raises a BiosampleNotFoundException otherwise. """ if id_ not in self._biosampleIdMap: ...