sentence1
stringlengths
52
3.87M
sentence2
stringlengths
1
47.2k
label
stringclasses
1 value
def runSearchContinuousSets(self, request): """ Returns a SearchContinuousSetsResponse for the specified SearchContinuousSetsRequest object. """ return self.runSearchRequest( request, protocol.SearchContinuousSetsRequest, protocol.SearchContinuousSetsRespo...
Returns a SearchContinuousSetsResponse for the specified SearchContinuousSetsRequest object.
entailment
def runSearchContinuous(self, request): """ Returns a SearchContinuousResponse for the specified SearchContinuousRequest object. :param request: JSON string representing searchContinuousRequest :return: JSON string representing searchContinuousResponse """ return...
Returns a SearchContinuousResponse for the specified SearchContinuousRequest object. :param request: JSON string representing searchContinuousRequest :return: JSON string representing searchContinuousResponse
entailment
def runSearchRnaQuantificationSets(self, request): """ Returns a SearchRnaQuantificationSetsResponse for the specified SearchRnaQuantificationSetsRequest object. """ return self.runSearchRequest( request, protocol.SearchRnaQuantificationSetsRequest, protoc...
Returns a SearchRnaQuantificationSetsResponse for the specified SearchRnaQuantificationSetsRequest object.
entailment
def runSearchRnaQuantifications(self, request): """ Returns a SearchRnaQuantificationResponse for the specified SearchRnaQuantificationRequest object. """ return self.runSearchRequest( request, protocol.SearchRnaQuantificationsRequest, protocol.SearchRnaQu...
Returns a SearchRnaQuantificationResponse for the specified SearchRnaQuantificationRequest object.
entailment
def runSearchExpressionLevels(self, request): """ Returns a SearchExpressionLevelResponse for the specified SearchExpressionLevelRequest object. """ return self.runSearchRequest( request, protocol.SearchExpressionLevelsRequest, protocol.SearchExpressionLev...
Returns a SearchExpressionLevelResponse for the specified SearchExpressionLevelRequest object.
entailment
def populateFromRow(self, dataset): """ Populates the instance variables of this Dataset from the specified database row. """ self._description = dataset.description self.setAttributesJson(dataset.attributes)
Populates the instance variables of this Dataset from the specified database row.
entailment
def addVariantSet(self, variantSet): """ Adds the specified variantSet to this dataset. """ id_ = variantSet.getId() self._variantSetIdMap[id_] = variantSet self._variantSetNameMap[variantSet.getLocalId()] = variantSet self._variantSetIds.append(id_)
Adds the specified variantSet to this dataset.
entailment
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.getName()] = biosample
Adds the specified biosample to this dataset.
entailment
def addIndividual(self, individual): """ Adds the specified individual to this dataset. """ id_ = individual.getId() self._individualIdMap[id_] = individual self._individualIds.append(id_) self._individualNameMap[individual.getName()] = individual
Adds the specified individual to this dataset.
entailment
def addFeatureSet(self, featureSet): """ Adds the specified featureSet to this dataset. """ id_ = featureSet.getId() self._featureSetIdMap[id_] = featureSet self._featureSetIds.append(id_) name = featureSet.getLocalId() self._featureSetNameMap[name] = feat...
Adds the specified featureSet to this dataset.
entailment
def addContinuousSet(self, continuousSet): """ Adds the specified continuousSet to this dataset. """ id_ = continuousSet.getId() self._continuousSetIdMap[id_] = continuousSet self._continuousSetIds.append(id_) name = continuousSet.getLocalId() self._contin...
Adds the specified continuousSet to this dataset.
entailment
def addReadGroupSet(self, readGroupSet): """ Adds the specified readGroupSet to this dataset. """ id_ = readGroupSet.getId() self._readGroupSetIdMap[id_] = readGroupSet self._readGroupSetNameMap[readGroupSet.getLocalId()] = readGroupSet self._readGroupSetIds.appen...
Adds the specified readGroupSet to this dataset.
entailment
def addRnaQuantificationSet(self, rnaQuantSet): """ Adds the specified rnaQuantification set to this dataset. """ id_ = rnaQuantSet.getId() self._rnaQuantificationSetIdMap[id_] = rnaQuantSet self._rnaQuantificationSetIds.append(id_) name = rnaQuantSet.getLocalId()...
Adds the specified rnaQuantification set to this dataset.
entailment
def getVariantSet(self, id_): """ Returns the VariantSet with the specified name, or raises a VariantSetNotFoundException otherwise. """ if id_ not in self._variantSetIdMap: raise exceptions.VariantSetNotFoundException(id_) return self._variantSetIdMap[id_]
Returns the VariantSet with the specified name, or raises a VariantSetNotFoundException otherwise.
entailment
def getVariantSetByName(self, name): """ Returns a VariantSet with the specified name, or raises a VariantSetNameNotFoundException if it does not exist. """ if name not in self._variantSetNameMap: raise exceptions.VariantSetNameNotFoundException(name) return s...
Returns a VariantSet with the specified name, or raises a VariantSetNameNotFoundException if it does not exist.
entailment
def addPhenotypeAssociationSet(self, phenotypeAssociationSet): """ Adds the specified g2p association set to this backend. """ id_ = phenotypeAssociationSet.getId() self._phenotypeAssociationSetIdMap[id_] = phenotypeAssociationSet self._phenotypeAssociationSetNameMap[ ...
Adds the specified g2p association set to this backend.
entailment
def getFeatureSet(self, id_): """ Returns the FeatureSet with the specified id, or raises a FeatureSetNotFoundException otherwise. """ if id_ not in self._featureSetIdMap: raise exceptions.FeatureSetNotFoundException(id_) return self._featureSetIdMap[id_]
Returns the FeatureSet with the specified id, or raises a FeatureSetNotFoundException otherwise.
entailment
def getFeatureSetByName(self, name): """ Returns the FeatureSet with the specified name, or raises an exception otherwise. """ if name not in self._featureSetNameMap: raise exceptions.FeatureSetNameNotFoundException(name) return self._featureSetNameMap[name]
Returns the FeatureSet with the specified name, or raises an exception otherwise.
entailment
def getContinuousSet(self, id_): """ Returns the ContinuousSet with the specified id, or raises a ContinuousSetNotFoundException otherwise. """ if id_ not in self._continuousSetIdMap: raise exceptions.ContinuousSetNotFoundException(id_) return self._continuous...
Returns the ContinuousSet with the specified id, or raises a ContinuousSetNotFoundException otherwise.
entailment
def getContinuousSetByName(self, name): """ Returns the ContinuousSet with the specified name, or raises an exception otherwise. """ if name not in self._continuousSetNameMap: raise exceptions.ContinuousSetNameNotFoundException(name) return self._continuousSet...
Returns the ContinuousSet with the specified name, or raises an exception otherwise.
entailment
def getBiosampleByName(self, name): """ Returns a Biosample with the specified name, or raises a BiosampleNameNotFoundException if it does not exist. """ if name not in self._biosampleNameMap: raise exceptions.BiosampleNameNotFoundException(name) return self._...
Returns a Biosample with the specified name, or raises a BiosampleNameNotFoundException if it does not exist.
entailment
def getBiosample(self, id_): """ Returns the Biosample with the specified id, or raises a BiosampleNotFoundException otherwise. """ if id_ not in self._biosampleIdMap: raise exceptions.BiosampleNotFoundException(id_) return self._biosampleIdMap[id_]
Returns the Biosample with the specified id, or raises a BiosampleNotFoundException otherwise.
entailment
def getIndividualByName(self, name): """ Returns an individual with the specified name, or raises a IndividualNameNotFoundException if it does not exist. """ if name not in self._individualNameMap: raise exceptions.IndividualNameNotFoundException(name) return ...
Returns an individual with the specified name, or raises a IndividualNameNotFoundException if it does not exist.
entailment
def getIndividual(self, id_): """ Returns the Individual with the specified id, or raises a IndividualNotFoundException otherwise. """ if id_ not in self._individualIdMap: raise exceptions.IndividualNotFoundException(id_) return self._individualIdMap[id_]
Returns the Individual with the specified id, or raises a IndividualNotFoundException otherwise.
entailment
def getReadGroupSetByName(self, name): """ Returns a ReadGroupSet with the specified name, or raises a ReadGroupSetNameNotFoundException if it does not exist. """ if name not in self._readGroupSetNameMap: raise exceptions.ReadGroupSetNameNotFoundException(name) ...
Returns a ReadGroupSet with the specified name, or raises a ReadGroupSetNameNotFoundException if it does not exist.
entailment
def getReadGroupSet(self, id_): """ Returns the ReadGroupSet with the specified name, or raises a ReadGroupSetNotFoundException otherwise. """ if id_ not in self._readGroupSetIdMap: raise exceptions.ReadGroupNotFoundException(id_) return self._readGroupSetIdMa...
Returns the ReadGroupSet with the specified name, or raises a ReadGroupSetNotFoundException otherwise.
entailment
def getRnaQuantificationSetByName(self, name): """ Returns the RnaQuantification set with the specified name, or raises an exception otherwise. """ if name not in self._rnaQuantificationSetNameMap: raise exceptions.RnaQuantificationSetNameNotFoundException(name) ...
Returns the RnaQuantification set with the specified name, or raises an exception otherwise.
entailment
def getRnaQuantificationSet(self, id_): """ Returns the RnaQuantification set with the specified name, or raises a RnaQuantificationSetNotFoundException otherwise. """ if id_ not in self._rnaQuantificationSetIdMap: raise exceptions.RnaQuantificationSetNotFoundExceptio...
Returns the RnaQuantification set with the specified name, or raises a RnaQuantificationSetNotFoundException otherwise.
entailment
def parseMalformedBamHeader(headerDict): """ Parses the (probably) intended values out of the specified BAM header dictionary, which is incompletely parsed by pysam. This is caused by some tools incorrectly using spaces instead of tabs as a seperator. """ headerString = " ".join( "{}...
Parses the (probably) intended values out of the specified BAM header dictionary, which is incompletely parsed by pysam. This is caused by some tools incorrectly using spaces instead of tabs as a seperator.
entailment
def _getReadAlignments( self, reference, start, end, readGroupSet, readGroup): """ Returns an iterator over the specified reads """ # TODO If reference is None, return against all references, # including unmapped reads. samFile = self.getFileHandle(self._dataU...
Returns an iterator over the specified reads
entailment
def convertReadAlignment(self, read, readGroupSet, readGroupId): """ Convert a pysam ReadAlignment to a GA4GH ReadAlignment """ samFile = self.getFileHandle(self._dataUrl) # TODO fill out remaining fields # TODO refine in tandem with code in converters module ret ...
Convert a pysam ReadAlignment to a GA4GH ReadAlignment
entailment
def addReadGroup(self, readGroup): """ Adds the specified ReadGroup to this ReadGroupSet. """ id_ = readGroup.getId() self._readGroupIdMap[id_] = readGroup self._readGroupIds.append(id_)
Adds the specified ReadGroup to this ReadGroupSet.
entailment
def getReadGroup(self, id_): """ Returns the ReadGroup with the specified id if it exists in this ReadGroupSet, or raises a ReadGroupNotFoundException otherwise. """ if id_ not in self._readGroupIdMap: raise exceptions.ReadGroupNotFoundException(id_) return se...
Returns the ReadGroup with the specified id if it exists in this ReadGroupSet, or raises a ReadGroupNotFoundException otherwise.
entailment
def toProtocolElement(self): """ Returns the GA4GH protocol representation of this ReadGroupSet. """ readGroupSet = protocol.ReadGroupSet() readGroupSet.id = self.getId() readGroupSet.read_groups.extend( [readGroup.toProtocolElement() for readGrou...
Returns the GA4GH protocol representation of this ReadGroupSet.
entailment
def getReadAlignmentId(self, gaAlignment): """ Returns a string ID suitable for use in the specified GA ReadAlignment object in this ReadGroupSet. """ compoundId = datamodel.ReadAlignmentCompoundId( self.getCompoundId(), gaAlignment.fragment_name) return str(c...
Returns a string ID suitable for use in the specified GA ReadAlignment object in this ReadGroupSet.
entailment
def getStats(self): """ Returns the GA4GH protocol representation of this read group set's ReadStats. """ stats = protocol.ReadStats() stats.aligned_read_count = self._numAlignedReads stats.unaligned_read_count = self._numUnalignedReads return stats
Returns the GA4GH protocol representation of this read group set's ReadStats.
entailment
def getReadAlignments(self, reference, start=None, end=None): """ Returns an iterator over the specified reads """ return self._getReadAlignments(reference, start, end, self, None)
Returns an iterator over the specified reads
entailment
def populateFromRow(self, readGroupSetRecord): """ Populates the instance variables of this ReadGroupSet from the specified database row. """ self._dataUrl = readGroupSetRecord.dataurl self._indexFile = readGroupSetRecord.indexfile self._programs = [] for ...
Populates the instance variables of this ReadGroupSet from the specified database row.
entailment
def populateFromFile(self, dataUrl, indexFile=None): """ Populates the instance variables of this ReadGroupSet from the specified dataUrl and indexFile. If indexFile is not specified guess usual form. """ self._dataUrl = dataUrl self._indexFile = indexFile ...
Populates the instance variables of this ReadGroupSet from the specified dataUrl and indexFile. If indexFile is not specified guess usual form.
entailment
def toProtocolElement(self): """ Returns the GA4GH protocol representation of this ReadGroup. """ # TODO this is very incomplete, but we don't have the # implementation to fill out the rest of the fields currently readGroup = protocol.ReadGroup() readGroup.id = se...
Returns the GA4GH protocol representation of this ReadGroup.
entailment
def getStats(self): """ Returns the GA4GH protocol representation of this read group's ReadStats. """ stats = protocol.ReadStats() stats.aligned_read_count = self.getNumAlignedReads() stats.unaligned_read_count = self.getNumUnalignedReads() # TODO base_cou...
Returns the GA4GH protocol representation of this read group's ReadStats.
entailment
def getExperiment(self): """ Returns the GA4GH protocol representation of this read group's Experiment. """ experiment = protocol.Experiment() experiment.id = self.getExperimentId() experiment.instrument_model = pb.string(self.getInstrumentModel()) experim...
Returns the GA4GH protocol representation of this read group's Experiment.
entailment
def populateFromHeader(self, readGroupHeader): """ Populate the instance variables using the specified SAM header. """ self._sampleName = readGroupHeader.get('SM', None) self._description = readGroupHeader.get('DS', None) if 'PI' in readGroupHeader: self._pred...
Populate the instance variables using the specified SAM header.
entailment
def populateFromRow(self, readGroupRecord): """ Populate the instance variables using the specified DB row. """ self._sampleName = readGroupRecord.samplename self._biosampleId = readGroupRecord.biosampleid self._description = readGroupRecord.description self._pred...
Populate the instance variables using the specified DB row.
entailment
def getNameFromPath(filePath): """ Returns the filename of the specified path without its extensions. This is usually how we derive the default name for a given object. """ if len(filePath) == 0: raise ValueError("Cannot have empty path for name") fileName = os.path.split(os.path.normpat...
Returns the filename of the specified path without its extensions. This is usually how we derive the default name for a given object.
entailment
def repoExitError(message): """ Exits the repo manager with error status. """ wrapper = textwrap.TextWrapper( break_on_hyphens=False, break_long_words=False) formatted = wrapper.fill("{}: error: {}".format(sys.argv[0], message)) sys.exit(formatted)
Exits the repo manager with error status.
entailment
def _updateRepo(self, func, *args, **kwargs): """ Runs the specified function that updates the repo with the specified arguments. This method ensures that all updates are transactional, so that if any part of the update fails no changes are made to the repo. """ #...
Runs the specified function that updates the repo with the specified arguments. This method ensures that all updates are transactional, so that if any part of the update fails no changes are made to the repo.
entailment
def addOntology(self): """ Adds a new Ontology to this repo. """ self._openRepo() name = self._args.name filePath = self._getFilePath(self._args.filePath, self._args.relativePath) if name is None: name = getNameFrom...
Adds a new Ontology to this repo.
entailment
def addDataset(self): """ Adds a new dataset into this repo. """ self._openRepo() dataset = datasets.Dataset(self._args.datasetName) dataset.setDescription(self._args.description) dataset.setAttributes(json.loads(self._args.attributes)) self._updateRepo(se...
Adds a new dataset into this repo.
entailment
def addReferenceSet(self): """ Adds a new reference set into this repo. """ self._openRepo() name = self._args.name filePath = self._getFilePath(self._args.filePath, self._args.relativePath) if name is None: name = ...
Adds a new reference set into this repo.
entailment
def addReadGroupSet(self): """ Adds a new ReadGroupSet into this repo. """ self._openRepo() dataset = self._repo.getDatasetByName(self._args.datasetName) dataUrl = self._args.dataFile indexFile = self._args.indexFile parsed = urlparse.urlparse(dataUrl) ...
Adds a new ReadGroupSet into this repo.
entailment
def addVariantSet(self): """ Adds a new VariantSet into this repo. """ self._openRepo() dataset = self._repo.getDatasetByName(self._args.datasetName) dataUrls = self._args.dataFiles name = self._args.name if len(dataUrls) == 1: if self._args.na...
Adds a new VariantSet into this repo.
entailment
def addPhenotypeAssociationSet(self): """ Adds a new phenotype association set to this repo. """ self._openRepo() name = self._args.name if name is None: name = getNameFromPath(self._args.dirPath) dataset = self._repo.getDatasetByName(self._args.datase...
Adds a new phenotype association set to this repo.
entailment
def removePhenotypeAssociationSet(self): """ Removes a phenotype association set from the repo """ self._openRepo() dataset = self._repo.getDatasetByName(self._args.datasetName) phenotypeAssociationSet = dataset.getPhenotypeAssociationSetByName( self._args.nam...
Removes a phenotype association set from the repo
entailment
def removeReferenceSet(self): """ Removes a referenceSet from the repo. """ self._openRepo() referenceSet = self._repo.getReferenceSetByName( self._args.referenceSetName) def func(): self._updateRepo(self._repo.removeReferenceSet, referenceSet) ...
Removes a referenceSet from the repo.
entailment
def removeReadGroupSet(self): """ Removes a readGroupSet from the repo. """ self._openRepo() dataset = self._repo.getDatasetByName(self._args.datasetName) readGroupSet = dataset.getReadGroupSetByName( self._args.readGroupSetName) def func(): ...
Removes a readGroupSet from the repo.
entailment
def removeVariantSet(self): """ Removes a variantSet from the repo. """ self._openRepo() dataset = self._repo.getDatasetByName(self._args.datasetName) variantSet = dataset.getVariantSetByName(self._args.variantSetName) def func(): self._updateRepo(sel...
Removes a variantSet from the repo.
entailment
def removeDataset(self): """ Removes a dataset from the repo. """ self._openRepo() dataset = self._repo.getDatasetByName(self._args.datasetName) def func(): self._updateRepo(self._repo.removeDataset, dataset) self._confirmDelete("Dataset", dataset.get...
Removes a dataset from the repo.
entailment
def addFeatureSet(self): """ Adds a new feature set into this repo """ self._openRepo() dataset = self._repo.getDatasetByName(self._args.datasetName) filePath = self._getFilePath(self._args.filePath, self._args.relativePath) na...
Adds a new feature set into this repo
entailment
def removeFeatureSet(self): """ Removes a feature set from this repo """ self._openRepo() dataset = self._repo.getDatasetByName(self._args.datasetName) featureSet = dataset.getFeatureSetByName(self._args.featureSetName) def func(): self._updateRepo(se...
Removes a feature set from this repo
entailment
def addContinuousSet(self): """ Adds a new continuous set into this repo """ self._openRepo() dataset = self._repo.getDatasetByName(self._args.datasetName) filePath = self._getFilePath(self._args.filePath, self._args.relativePath) ...
Adds a new continuous set into this repo
entailment
def removeContinuousSet(self): """ Removes a continuous set from this repo """ self._openRepo() dataset = self._repo.getDatasetByName(self._args.datasetName) continuousSet = dataset.getContinuousSetByName( self._args.continuousSetName) ...
Removes a continuous set from this repo
entailment
def addBiosample(self): """ Adds a new biosample into this repo """ self._openRepo() dataset = self._repo.getDatasetByName(self._args.datasetName) biosample = bio_metadata.Biosample( dataset, self._args.biosampleName) biosample.populateFromJson(self._a...
Adds a new biosample into this repo
entailment
def removeBiosample(self): """ Removes a biosample from this repo """ self._openRepo() dataset = self._repo.getDatasetByName(self._args.datasetName) biosample = dataset.getBiosampleByName(self._args.biosampleName) def func(): self._updateRepo(self._re...
Removes a biosample from this repo
entailment
def addIndividual(self): """ Adds a new individual into this repo """ self._openRepo() dataset = self._repo.getDatasetByName(self._args.datasetName) individual = bio_metadata.Individual( dataset, self._args.individualName) individual.populateFromJson(s...
Adds a new individual into this repo
entailment
def removeIndividual(self): """ Removes an individual from this repo """ self._openRepo() dataset = self._repo.getDatasetByName(self._args.datasetName) individual = dataset.getIndividualByName(self._args.individualName) def func(): self._updateRepo(se...
Removes an individual from this repo
entailment
def addPeer(self): """ Adds a new peer into this repo """ self._openRepo() try: peer = peers.Peer( self._args.url, json.loads(self._args.attributes)) except exceptions.BadUrlException: raise exceptions.RepoManagerException("The URL ...
Adds a new peer into this repo
entailment
def removePeer(self): """ Removes a peer by URL from this repo """ self._openRepo() def func(): self._updateRepo(self._repo.removePeer, self._args.url) self._confirmDelete("Peer", self._args.url, func)
Removes a peer by URL from this repo
entailment
def removeOntology(self): """ Removes an ontology from the repo. """ self._openRepo() ontology = self._repo.getOntologyByName(self._args.ontologyName) def func(): self._updateRepo(self._repo.removeOntology, ontology) self._confirmDelete("Ontology", on...
Removes an ontology from the repo.
entailment
def addRnaQuantification(self): """ Adds an rnaQuantification into this repo """ self._openRepo() dataset = self._repo.getDatasetByName(self._args.datasetName) biosampleId = "" if self._args.biosampleName: biosample = dataset.getBiosampleByName(self._a...
Adds an rnaQuantification into this repo
entailment
def initRnaQuantificationSet(self): """ Initialize an empty RNA quantification set """ store = rnaseq2ga.RnaSqliteStore(self._args.filePath) store.createTables()
Initialize an empty RNA quantification set
entailment
def addRnaQuantificationSet(self): """ Adds an rnaQuantificationSet into this repo """ self._openRepo() dataset = self._repo.getDatasetByName(self._args.datasetName) if self._args.name is None: name = getNameFromPath(self._args.filePath) else: ...
Adds an rnaQuantificationSet into this repo
entailment
def removeRnaQuantificationSet(self): """ Removes an rnaQuantificationSet from this repo """ self._openRepo() dataset = self._repo.getDatasetByName(self._args.datasetName) rnaQuantSet = dataset.getRnaQuantificationSetByName( self._args.rnaQuantificationSetName...
Removes an rnaQuantificationSet from this repo
entailment
def rnaseq2ga(quantificationFilename, sqlFilename, localName, rnaType, dataset=None, featureType="gene", description="", programs="", featureSetNames="", readGroupSetNames="", biosampleId=""): """ Reads RNA Quantification data in one of several formats and stores the da...
Reads RNA Quantification data in one of several formats and stores the data in a sqlite database for use by the GA4GH reference server. Supports the following quantification output types: Cufflinks, kallisto, RSEM.
entailment
def addRNAQuantification(self, datafields): """ Adds an RNAQuantification to the db. Datafields is a tuple in the order: id, feature_set_ids, description, name, read_group_ids, programs, biosample_id """ self._rnaValueList.append(datafields) if len(self._...
Adds an RNAQuantification to the db. Datafields is a tuple in the order: id, feature_set_ids, description, name, read_group_ids, programs, biosample_id
entailment
def addExpression(self, datafields): """ Adds an Expression to the db. Datafields is a tuple in the order: id, rna_quantification_id, name, expression, is_normalized, raw_read_count, score, units, conf_low, conf_hi """ self._expressionValueList.append(datafields) ...
Adds an Expression to the db. Datafields is a tuple in the order: id, rna_quantification_id, name, expression, is_normalized, raw_read_count, score, units, conf_low, conf_hi
entailment
def createIndices(self): """ Index columns that are queried. The expression index can take a long time. """ sql = '''CREATE INDEX name_index ON Expression (name)''' self._cursor.execute(sql) self._dbConn.commit() sql = '''CREATE INDEX ex...
Index columns that are queried. The expression index can take a long time.
entailment
def writeExpression(self, rnaQuantificationId, quantfilename): """ Reads the quantification results file and adds entries to the specified database. """ isNormalized = self._isNormalized units = self._units with open(quantfilename, "r") as quantFile: q...
Reads the quantification results file and adds entries to the specified database.
entailment
def _fetchSequence(ac, startIndex=None, endIndex=None): """Fetch sequences from NCBI using the eself interface. An interbase interval may be optionally provided with startIndex and endIndex. NCBI eself will return just the requested subsequence, which might greatly reduce payload sizes (especially with...
Fetch sequences from NCBI using the eself interface. An interbase interval may be optionally provided with startIndex and endIndex. NCBI eself will return just the requested subsequence, which might greatly reduce payload sizes (especially with chromosome-scale sequences). When wrapped is True, return ...
entailment
def createBamHeader(self, baseHeader): """ Creates a new bam header based on the specified header from the parent BAM file. """ header = dict(baseHeader) newSequences = [] for index, referenceInfo in enumerate(header['SQ']): if index < self.numChromoso...
Creates a new bam header based on the specified header from the parent BAM file.
entailment
def createRepo(self): """ Creates the repository for all the data we've just downloaded. """ repo = datarepo.SqlDataRepository(self.repoPath) repo.open("w") repo.initialise() referenceSet = references.HtslibReferenceSet("GRCh37-subset") referenceSet.popul...
Creates the repository for all the data we've just downloaded.
entailment
def _configure_backend(app): """A helper function used just to help modularize the code a bit.""" # Allocate the backend # We use URLs to specify the backend. Currently we have file:// URLs (or # URLs with no scheme) for the SqlDataRepository, and special empty:// and # simulated:// URLs for empty o...
A helper function used just to help modularize the code a bit.
entailment
def configure(configFile=None, baseConfig="ProductionConfig", port=8000, extraConfig={}): """ TODO Document this critical function! What does it do? What does it assume? """ file_handler = StreamHandler() file_handler.setLevel(logging.WARNING) app.logger.addHandler(file_handler...
TODO Document this critical function! What does it do? What does it assume?
entailment
def getFlaskResponse(responseString, httpStatus=200): """ Returns a Flask response object for the specified data and HTTP status. """ return flask.Response(responseString, status=httpStatus, mimetype=MIMETYPE)
Returns a Flask response object for the specified data and HTTP status.
entailment
def handleHttpPost(request, endpoint): """ Handles the specified HTTP POST request, which maps to the specified protocol handler endpoint and protocol request class. """ if request.mimetype and request.mimetype != MIMETYPE: raise exceptions.UnsupportedMediaTypeException() request = reque...
Handles the specified HTTP POST request, which maps to the specified protocol handler endpoint and protocol request class.
entailment
def handleException(exception): """ Handles an exception that occurs somewhere in the process of handling a request. """ serverException = exception if not isinstance(exception, exceptions.BaseServerException): with app.test_request_context(): app.log_exception(exception) ...
Handles an exception that occurs somewhere in the process of handling a request.
entailment
def startLogin(): """ If we are not logged in, this generates the redirect URL to the OIDC provider and returns the redirect response :return: A redirect response to the OIDC provider """ flask.session["state"] = oic.oauth2.rndstr(SECRET_KEY_LENGTH) flask.session["nonce"] = oic.oauth2.rndstr...
If we are not logged in, this generates the redirect URL to the OIDC provider and returns the redirect response :return: A redirect response to the OIDC provider
entailment
def checkAuthentication(): """ The request will have a parameter 'key' if it came from the command line client, or have a session key of 'key' if it's the browser. If the token is not found, start the login process. If there is no oidcClient, we are running naked and we don't check. If we're be...
The request will have a parameter 'key' if it came from the command line client, or have a session key of 'key' if it's the browser. If the token is not found, start the login process. If there is no oidcClient, we are running naked and we don't check. If we're being redirected to the oidcCallback we d...
entailment
def handleFlaskGetRequest(id_, flaskRequest, endpoint): """ Handles the specified flask request for one of the GET URLs Invokes the specified endpoint to generate a response. """ if flaskRequest.method == "GET": return handleHttpGet(id_, endpoint) else: raise exceptions.MethodNot...
Handles the specified flask request for one of the GET URLs Invokes the specified endpoint to generate a response.
entailment
def handleFlaskPostRequest(flaskRequest, endpoint): """ Handles the specified flask request for one of the POST URLS Invokes the specified endpoint to generate a response. """ if flaskRequest.method == "POST": return handleHttpPost(flaskRequest, endpoint) elif flaskRequest.method == "OPT...
Handles the specified flask request for one of the POST URLS Invokes the specified endpoint to generate a response.
entailment
def getVariantAnnotationSets(self, datasetId): """ Returns the list of ReferenceSets for this server. """ # TODO this should be displayed per-variant set, not per dataset. variantAnnotationSets = [] dataset = app.backend.getDataRepository().getDataset(datasetId) f...
Returns the list of ReferenceSets for this server.
entailment
def auth_decorator(app=None): """ This decorator wraps a view function so that it is protected when Auth0 is enabled. This means that any request will be expected to have a signed token in the authorization header if the `AUTH0_ENABLED` configuration setting is True. The authorization header wi...
This decorator wraps a view function so that it is protected when Auth0 is enabled. This means that any request will be expected to have a signed token in the authorization header if the `AUTH0_ENABLED` configuration setting is True. The authorization header will have the form: "authorization: Bea...
entailment
def decode_header(auth_header, client_id, client_secret): """ A function that threads the header through decoding and returns a tuple of the token and payload if successful. This does not fully authenticate a request. :param auth_header: :param client_id: :param client_secret: :return: (...
A function that threads the header through decoding and returns a tuple of the token and payload if successful. This does not fully authenticate a request. :param auth_header: :param client_id: :param client_secret: :return: (token, profile)
entailment
def logout(cache): """ Logs out the current session by removing it from the cache. This is expected to only occur when a session has """ cache.set(flask.session['auth0_key'], None) flask.session.clear() return True
Logs out the current session by removing it from the cache. This is expected to only occur when a session has
entailment
def callback_maker( cache=None, domain='', client_id='', client_secret='', redirect_uri=''): """ This function will generate a view function that can be used to handle the return from Auth0. The "callback" is a redirected session from auth0 that includes the token we can use to authentic...
This function will generate a view function that can be used to handle the return from Auth0. The "callback" is a redirected session from auth0 that includes the token we can use to authenticate that session. If the session is properly authenticated Auth0 will provide a code so our application can iden...
entailment
def render_login( app=None, scopes='', redirect_uri='', domain='', client_id=''): """ This function will generate a view function that can be used to handle the return from Auth0. The "callback" is a redirected session from auth0 that includes the token we can use to authenticate that session. ...
This function will generate a view function that can be used to handle the return from Auth0. The "callback" is a redirected session from auth0 that includes the token we can use to authenticate that session. If the session is properly authenticated Auth0 will provide a code so our application can iden...
entailment
def render_key(app, key=""): """ Renders a view from the app and a key that lets the current session grab its token. :param app: :param key: :return: Rendered view """ return app.jinja_env.from_string(KEY_HTML).render( key=key)
Renders a view from the app and a key that lets the current session grab its token. :param app: :param key: :return: Rendered view
entailment
def _decode_header(auth_header, client_id, client_secret): """ Takes the header and tries to return an active token and decoded payload. :param auth_header: :param client_id: :param client_secret: :return: (token, profile) """ try: token = auth_header.split()[1] paylo...
Takes the header and tries to return an active token and decoded payload. :param auth_header: :param client_id: :param client_secret: :return: (token, profile)
entailment
def is_active(cache, token): """ Accepts the cache and ID token and checks to see if the profile is currently logged in. If so, return the token, otherwise throw a NotAuthenticatedException. :param cache: :param token: :return: """ profile = cache.get(token) if not profile: ...
Accepts the cache and ID token and checks to see if the profile is currently logged in. If so, return the token, otherwise throw a NotAuthenticatedException. :param cache: :param token: :return:
entailment
def addReference(self, reference): """ Adds the specified reference to this ReferenceSet. """ id_ = reference.getId() self._referenceIdMap[id_] = reference self._referenceNameMap[reference.getLocalId()] = reference self._referenceIds.append(id_)
Adds the specified reference to this ReferenceSet.
entailment