partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
RepoManager._updateRepo
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.
ga4gh/server/cli/repomanager.py
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. """ #...
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", "...
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/cli/repomanager.py#L81-L94
[ "def", "_updateRepo", "(", "self", ",", "func", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# TODO how do we make this properly transactional?", "self", ".", "_repo", ".", "open", "(", "datarepo", ".", "MODE_WRITE", ")", "try", ":", "func", "(", ...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
RepoManager.addOntology
Adds a new Ontology to this repo.
ga4gh/server/cli/repomanager.py
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...
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", "." ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/cli/repomanager.py#L154-L166
[ "def", "addOntology", "(", "self", ")", ":", "self", ".", "_openRepo", "(", ")", "name", "=", "self", ".", "_args", ".", "name", "filePath", "=", "self", ".", "_getFilePath", "(", "self", ".", "_args", ".", "filePath", ",", "self", ".", "_args", ".",...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
RepoManager.addDataset
Adds a new dataset into this repo.
ga4gh/server/cli/repomanager.py
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...
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", "." ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/cli/repomanager.py#L168-L176
[ "def", "addDataset", "(", "self", ")", ":", "self", ".", "_openRepo", "(", ")", "dataset", "=", "datasets", ".", "Dataset", "(", "self", ".", "_args", ".", "datasetName", ")", "dataset", ".", "setDescription", "(", "self", ".", "_args", ".", "description...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
RepoManager.addReferenceSet
Adds a new reference set into this repo.
ga4gh/server/cli/repomanager.py
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 = ...
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", "." ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/cli/repomanager.py#L178-L201
[ "def", "addReferenceSet", "(", "self", ")", ":", "self", ".", "_openRepo", "(", ")", "name", "=", "self", ".", "_args", ".", "name", "filePath", "=", "self", ".", "_getFilePath", "(", "self", ".", "_args", ".", "filePath", ",", "self", ".", "_args", ...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
RepoManager.addReadGroupSet
Adds a new ReadGroupSet into this repo.
ga4gh/server/cli/repomanager.py
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) ...
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", "." ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/cli/repomanager.py#L203-L235
[ "def", "addReadGroupSet", "(", "self", ")", ":", "self", ".", "_openRepo", "(", ")", "dataset", "=", "self", ".", "_repo", ".", "getDatasetByName", "(", "self", ".", "_args", ".", "datasetName", ")", "dataUrl", "=", "self", ".", "_args", ".", "dataFile",...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
RepoManager.addVariantSet
Adds a new VariantSet into this repo.
ga4gh/server/cli/repomanager.py
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...
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", "." ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/cli/repomanager.py#L237-L322
[ "def", "addVariantSet", "(", "self", ")", ":", "self", ".", "_openRepo", "(", ")", "dataset", "=", "self", ".", "_repo", ".", "getDatasetByName", "(", "self", ".", "_args", ".", "datasetName", ")", "dataUrls", "=", "self", ".", "_args", ".", "dataFiles",...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
RepoManager.addPhenotypeAssociationSet
Adds a new phenotype association set to this repo.
ga4gh/server/cli/repomanager.py
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...
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", "." ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/cli/repomanager.py#L324-L340
[ "def", "addPhenotypeAssociationSet", "(", "self", ")", ":", "self", ".", "_openRepo", "(", ")", "name", "=", "self", ".", "_args", ".", "name", "if", "name", "is", "None", ":", "name", "=", "getNameFromPath", "(", "self", ".", "_args", ".", "dirPath", ...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
RepoManager.removePhenotypeAssociationSet
Removes a phenotype association set from the repo
ga4gh/server/cli/repomanager.py
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...
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" ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/cli/repomanager.py#L342-L358
[ "def", "removePhenotypeAssociationSet", "(", "self", ")", ":", "self", ".", "_openRepo", "(", ")", "dataset", "=", "self", ".", "_repo", ".", "getDatasetByName", "(", "self", ".", "_args", ".", "datasetName", ")", "phenotypeAssociationSet", "=", "dataset", "."...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
RepoManager.removeReferenceSet
Removes a referenceSet from the repo.
ga4gh/server/cli/repomanager.py
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) ...
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", "." ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/cli/repomanager.py#L360-L370
[ "def", "removeReferenceSet", "(", "self", ")", ":", "self", ".", "_openRepo", "(", ")", "referenceSet", "=", "self", ".", "_repo", ".", "getReferenceSetByName", "(", "self", ".", "_args", ".", "referenceSetName", ")", "def", "func", "(", ")", ":", "self", ...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
RepoManager.removeReadGroupSet
Removes a readGroupSet from the repo.
ga4gh/server/cli/repomanager.py
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(): ...
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", "." ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/cli/repomanager.py#L372-L383
[ "def", "removeReadGroupSet", "(", "self", ")", ":", "self", ".", "_openRepo", "(", ")", "dataset", "=", "self", ".", "_repo", ".", "getDatasetByName", "(", "self", ".", "_args", ".", "datasetName", ")", "readGroupSet", "=", "dataset", ".", "getReadGroupSetBy...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
RepoManager.removeVariantSet
Removes a variantSet from the repo.
ga4gh/server/cli/repomanager.py
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...
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", "." ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/cli/repomanager.py#L385-L395
[ "def", "removeVariantSet", "(", "self", ")", ":", "self", ".", "_openRepo", "(", ")", "dataset", "=", "self", ".", "_repo", ".", "getDatasetByName", "(", "self", ".", "_args", ".", "datasetName", ")", "variantSet", "=", "dataset", ".", "getVariantSetByName",...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
RepoManager.removeDataset
Removes a dataset from the repo.
ga4gh/server/cli/repomanager.py
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...
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", "." ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/cli/repomanager.py#L397-L406
[ "def", "removeDataset", "(", "self", ")", ":", "self", ".", "_openRepo", "(", ")", "dataset", "=", "self", ".", "_repo", ".", "getDatasetByName", "(", "self", ".", "_args", ".", "datasetName", ")", "def", "func", "(", ")", ":", "self", ".", "_updateRep...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
RepoManager.addFeatureSet
Adds a new feature set into this repo
ga4gh/server/cli/repomanager.py
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...
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" ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/cli/repomanager.py#L408-L434
[ "def", "addFeatureSet", "(", "self", ")", ":", "self", ".", "_openRepo", "(", ")", "dataset", "=", "self", ".", "_repo", ".", "getDatasetByName", "(", "self", ".", "_args", ".", "datasetName", ")", "filePath", "=", "self", ".", "_getFilePath", "(", "self...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
RepoManager.removeFeatureSet
Removes a feature set from this repo
ga4gh/server/cli/repomanager.py
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...
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" ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/cli/repomanager.py#L436-L446
[ "def", "removeFeatureSet", "(", "self", ")", ":", "self", ".", "_openRepo", "(", ")", "dataset", "=", "self", ".", "_repo", ".", "getDatasetByName", "(", "self", ".", "_args", ".", "datasetName", ")", "featureSet", "=", "dataset", ".", "getFeatureSetByName",...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
RepoManager.addContinuousSet
Adds a new continuous set into this repo
ga4gh/server/cli/repomanager.py
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) ...
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" ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/cli/repomanager.py#L448-L465
[ "def", "addContinuousSet", "(", "self", ")", ":", "self", ".", "_openRepo", "(", ")", "dataset", "=", "self", ".", "_repo", ".", "getDatasetByName", "(", "self", ".", "_args", ".", "datasetName", ")", "filePath", "=", "self", ".", "_getFilePath", "(", "s...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
RepoManager.removeContinuousSet
Removes a continuous set from this repo
ga4gh/server/cli/repomanager.py
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) ...
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" ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/cli/repomanager.py#L467-L478
[ "def", "removeContinuousSet", "(", "self", ")", ":", "self", ".", "_openRepo", "(", ")", "dataset", "=", "self", ".", "_repo", ".", "getDatasetByName", "(", "self", ".", "_args", ".", "datasetName", ")", "continuousSet", "=", "dataset", ".", "getContinuousSe...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
RepoManager.addBiosample
Adds a new biosample into this repo
ga4gh/server/cli/repomanager.py
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...
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" ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/cli/repomanager.py#L480-L489
[ "def", "addBiosample", "(", "self", ")", ":", "self", ".", "_openRepo", "(", ")", "dataset", "=", "self", ".", "_repo", ".", "getDatasetByName", "(", "self", ".", "_args", ".", "datasetName", ")", "biosample", "=", "bio_metadata", ".", "Biosample", "(", ...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
RepoManager.removeBiosample
Removes a biosample from this repo
ga4gh/server/cli/repomanager.py
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...
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" ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/cli/repomanager.py#L491-L501
[ "def", "removeBiosample", "(", "self", ")", ":", "self", ".", "_openRepo", "(", ")", "dataset", "=", "self", ".", "_repo", ".", "getDatasetByName", "(", "self", ".", "_args", ".", "datasetName", ")", "biosample", "=", "dataset", ".", "getBiosampleByName", ...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
RepoManager.addIndividual
Adds a new individual into this repo
ga4gh/server/cli/repomanager.py
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...
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" ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/cli/repomanager.py#L503-L512
[ "def", "addIndividual", "(", "self", ")", ":", "self", ".", "_openRepo", "(", ")", "dataset", "=", "self", ".", "_repo", ".", "getDatasetByName", "(", "self", ".", "_args", ".", "datasetName", ")", "individual", "=", "bio_metadata", ".", "Individual", "(",...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
RepoManager.removeIndividual
Removes an individual from this repo
ga4gh/server/cli/repomanager.py
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...
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" ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/cli/repomanager.py#L514-L524
[ "def", "removeIndividual", "(", "self", ")", ":", "self", ".", "_openRepo", "(", ")", "dataset", "=", "self", ".", "_repo", ".", "getDatasetByName", "(", "self", ".", "_args", ".", "datasetName", ")", "individual", "=", "dataset", ".", "getIndividualByName",...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
RepoManager.addPeer
Adds a new peer into this repo
ga4gh/server/cli/repomanager.py
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 ...
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" ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/cli/repomanager.py#L526-L541
[ "def", "addPeer", "(", "self", ")", ":", "self", ".", "_openRepo", "(", ")", "try", ":", "peer", "=", "peers", ".", "Peer", "(", "self", ".", "_args", ".", "url", ",", "json", ".", "loads", "(", "self", ".", "_args", ".", "attributes", ")", ")", ...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
RepoManager.removePeer
Removes a peer by URL from this repo
ga4gh/server/cli/repomanager.py
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)
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" ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/cli/repomanager.py#L543-L551
[ "def", "removePeer", "(", "self", ")", ":", "self", ".", "_openRepo", "(", ")", "def", "func", "(", ")", ":", "self", ".", "_updateRepo", "(", "self", ".", "_repo", ".", "removePeer", ",", "self", ".", "_args", ".", "url", ")", "self", ".", "_confi...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
RepoManager.removeOntology
Removes an ontology from the repo.
ga4gh/server/cli/repomanager.py
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...
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", "." ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/cli/repomanager.py#L553-L562
[ "def", "removeOntology", "(", "self", ")", ":", "self", ".", "_openRepo", "(", ")", "ontology", "=", "self", ".", "_repo", ".", "getOntologyByName", "(", "self", ".", "_args", ".", "ontologyName", ")", "def", "func", "(", ")", ":", "self", ".", "_updat...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
RepoManager.addRnaQuantification
Adds an rnaQuantification into this repo
ga4gh/server/cli/repomanager.py
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...
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" ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/cli/repomanager.py#L564-L589
[ "def", "addRnaQuantification", "(", "self", ")", ":", "self", ".", "_openRepo", "(", ")", "dataset", "=", "self", ".", "_repo", ".", "getDatasetByName", "(", "self", ".", "_args", ".", "datasetName", ")", "biosampleId", "=", "\"\"", "if", "self", ".", "_...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
RepoManager.initRnaQuantificationSet
Initialize an empty RNA quantification set
ga4gh/server/cli/repomanager.py
def initRnaQuantificationSet(self): """ Initialize an empty RNA quantification set """ store = rnaseq2ga.RnaSqliteStore(self._args.filePath) store.createTables()
def initRnaQuantificationSet(self): """ Initialize an empty RNA quantification set """ store = rnaseq2ga.RnaSqliteStore(self._args.filePath) store.createTables()
[ "Initialize", "an", "empty", "RNA", "quantification", "set" ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/cli/repomanager.py#L591-L596
[ "def", "initRnaQuantificationSet", "(", "self", ")", ":", "store", "=", "rnaseq2ga", ".", "RnaSqliteStore", "(", "self", ".", "_args", ".", "filePath", ")", "store", ".", "createTables", "(", ")" ]
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
RepoManager.addRnaQuantificationSet
Adds an rnaQuantificationSet into this repo
ga4gh/server/cli/repomanager.py
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: ...
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" ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/cli/repomanager.py#L598-L619
[ "def", "addRnaQuantificationSet", "(", "self", ")", ":", "self", ".", "_openRepo", "(", ")", "dataset", "=", "self", ".", "_repo", ".", "getDatasetByName", "(", "self", ".", "_args", ".", "datasetName", ")", "if", "self", ".", "_args", ".", "name", "is",...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
RepoManager.removeRnaQuantificationSet
Removes an rnaQuantificationSet from this repo
ga4gh/server/cli/repomanager.py
def removeRnaQuantificationSet(self): """ Removes an rnaQuantificationSet from this repo """ self._openRepo() dataset = self._repo.getDatasetByName(self._args.datasetName) rnaQuantSet = dataset.getRnaQuantificationSetByName( self._args.rnaQuantificationSetName...
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" ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/cli/repomanager.py#L621-L634
[ "def", "removeRnaQuantificationSet", "(", "self", ")", ":", "self", ".", "_openRepo", "(", ")", "dataset", "=", "self", ".", "_repo", ".", "getDatasetByName", "(", "self", ".", "_args", ".", "datasetName", ")", "rnaQuantSet", "=", "dataset", ".", "getRnaQuan...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
rnaseq2ga
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.
ga4gh/server/repo/rnaseq2ga.py
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...
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", "." ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/repo/rnaseq2ga.py#L267-L307
[ "def", "rnaseq2ga", "(", "quantificationFilename", ",", "sqlFilename", ",", "localName", ",", "rnaType", ",", "dataset", "=", "None", ",", "featureType", "=", "\"gene\"", ",", "description", "=", "\"\"", ",", "programs", "=", "\"\"", ",", "featureSetNames", "=...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
RnaSqliteStore.addRNAQuantification
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
ga4gh/server/repo/rnaseq2ga.py
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._...
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" ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/repo/rnaseq2ga.py#L50-L59
[ "def", "addRNAQuantification", "(", "self", ",", "datafields", ")", ":", "self", ".", "_rnaValueList", ".", "append", "(", "datafields", ")", "if", "len", "(", "self", ".", "_rnaValueList", ")", ">=", "self", ".", "_batchSize", ":", "self", ".", "batchaddR...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
RnaSqliteStore.addExpression
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
ga4gh/server/repo/rnaseq2ga.py
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) ...
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" ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/repo/rnaseq2ga.py#L68-L76
[ "def", "addExpression", "(", "self", ",", "datafields", ")", ":", "self", ".", "_expressionValueList", ".", "append", "(", "datafields", ")", "if", "len", "(", "self", ".", "_expressionValueList", ")", ">=", "self", ".", "_batchSize", ":", "self", ".", "ba...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
RnaSqliteStore.createIndices
Index columns that are queried. The expression index can take a long time.
ga4gh/server/repo/rnaseq2ga.py
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...
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", "." ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/repo/rnaseq2ga.py#L85-L99
[ "def", "createIndices", "(", "self", ")", ":", "sql", "=", "'''CREATE INDEX name_index\n ON Expression (name)'''", "self", ".", "_cursor", ".", "execute", "(", "sql", ")", "self", ".", "_dbConn", ".", "commit", "(", ")", "sql", "=", "'''CREATE INDE...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
AbstractWriter.writeExpression
Reads the quantification results file and adds entries to the specified database.
ga4gh/server/repo/rnaseq2ga.py
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...
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", "." ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/repo/rnaseq2ga.py#L136-L172
[ "def", "writeExpression", "(", "self", ",", "rnaQuantificationId", ",", "quantfilename", ")", ":", "isNormalized", "=", "self", ".", "_isNormalized", "units", "=", "self", ".", "_units", "with", "open", "(", "quantfilename", ",", "\"r\"", ")", "as", "quantFile...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
_fetchSequence
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 ...
scripts/download_example_data.py
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...
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", "." ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/scripts/download_example_data.py#L67-L103
[ "def", "_fetchSequence", "(", "ac", ",", "startIndex", "=", "None", ",", "endIndex", "=", "None", ")", ":", "urlFmt", "=", "(", "\"http://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?\"", "\"db=nucleotide&id={ac}&rettype=fasta&retmode=text\"", ")", "if", "startIndex", ...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
AbstractFileDownloader.createBamHeader
Creates a new bam header based on the specified header from the parent BAM file.
scripts/download_example_data.py
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...
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", "." ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/scripts/download_example_data.py#L235-L259
[ "def", "createBamHeader", "(", "self", ",", "baseHeader", ")", ":", "header", "=", "dict", "(", "baseHeader", ")", "newSequences", "=", "[", "]", "for", "index", ",", "referenceInfo", "in", "enumerate", "(", "header", "[", "'SQ'", "]", ")", ":", "if", ...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
AbstractFileDownloader.createRepo
Creates the repository for all the data we've just downloaded.
scripts/download_example_data.py
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...
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", "." ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/scripts/download_example_data.py#L338-L383
[ "def", "createRepo", "(", "self", ")", ":", "repo", "=", "datarepo", ".", "SqlDataRepository", "(", "self", ".", "repoPath", ")", "repo", ".", "open", "(", "\"w\"", ")", "repo", ".", "initialise", "(", ")", "referenceSet", "=", "references", ".", "Htslib...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
_configure_backend
A helper function used just to help modularize the code a bit.
ga4gh/server/frontend.py
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...
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", "." ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/frontend.py#L212-L267
[ "def", "_configure_backend", "(", "app", ")", ":", "# 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 or simulated data sources.", "data...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
configure
TODO Document this critical function! What does it do? What does it assume?
ga4gh/server/frontend.py
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...
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?" ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/frontend.py#L270-L358
[ "def", "configure", "(", "configFile", "=", "None", ",", "baseConfig", "=", "\"ProductionConfig\"", ",", "port", "=", "8000", ",", "extraConfig", "=", "{", "}", ")", ":", "file_handler", "=", "StreamHandler", "(", ")", "file_handler", ".", "setLevel", "(", ...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
getFlaskResponse
Returns a Flask response object for the specified data and HTTP status.
ga4gh/server/frontend.py
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)
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", "." ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/frontend.py#L361-L365
[ "def", "getFlaskResponse", "(", "responseString", ",", "httpStatus", "=", "200", ")", ":", "return", "flask", ".", "Response", "(", "responseString", ",", "status", "=", "httpStatus", ",", "mimetype", "=", "MIMETYPE", ")" ]
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
handleHttpPost
Handles the specified HTTP POST request, which maps to the specified protocol handler endpoint and protocol request class.
ga4gh/server/frontend.py
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...
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", "." ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/frontend.py#L368-L379
[ "def", "handleHttpPost", "(", "request", ",", "endpoint", ")", ":", "if", "request", ".", "mimetype", "and", "request", ".", "mimetype", "!=", "MIMETYPE", ":", "raise", "exceptions", ".", "UnsupportedMediaTypeException", "(", ")", "request", "=", "request", "....
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
handleException
Handles an exception that occurs somewhere in the process of handling a request.
ga4gh/server/frontend.py
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) ...
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", "." ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/frontend.py#L409-L433
[ "def", "handleException", "(", "exception", ")", ":", "serverException", "=", "exception", "if", "not", "isinstance", "(", "exception", ",", "exceptions", ".", "BaseServerException", ")", ":", "with", "app", ".", "test_request_context", "(", ")", ":", "app", "...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
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
ga4gh/server/frontend.py
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...
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" ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/frontend.py#L436-L455
[ "def", "startLogin", "(", ")", ":", "flask", ".", "session", "[", "\"state\"", "]", "=", "oic", ".", "oauth2", ".", "rndstr", "(", "SECRET_KEY_LENGTH", ")", "flask", ".", "session", "[", "\"nonce\"", "]", "=", "oic", ".", "oauth2", ".", "rndstr", "(", ...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
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 being redirected to the oidcCallback we d...
ga4gh/server/frontend.py
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...
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", "f...
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/frontend.py#L459-L483
[ "def", "checkAuthentication", "(", ")", ":", "if", "app", ".", "oidcClient", "is", "None", ":", "return", "if", "flask", ".", "request", ".", "endpoint", "==", "'oidcCallback'", ":", "return", "key", "=", "flask", ".", "session", ".", "get", "(", "'key'"...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
handleFlaskGetRequest
Handles the specified flask request for one of the GET URLs Invokes the specified endpoint to generate a response.
ga4gh/server/frontend.py
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...
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", "." ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/frontend.py#L486-L494
[ "def", "handleFlaskGetRequest", "(", "id_", ",", "flaskRequest", ",", "endpoint", ")", ":", "if", "flaskRequest", ".", "method", "==", "\"GET\"", ":", "return", "handleHttpGet", "(", "id_", ",", "endpoint", ")", "else", ":", "raise", "exceptions", ".", "Meth...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
handleFlaskPostRequest
Handles the specified flask request for one of the POST URLS Invokes the specified endpoint to generate a response.
ga4gh/server/frontend.py
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...
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", "." ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/frontend.py#L506-L516
[ "def", "handleFlaskPostRequest", "(", "flaskRequest", ",", "endpoint", ")", ":", "if", "flaskRequest", ".", "method", "==", "\"POST\"", ":", "return", "handleHttpPost", "(", "flaskRequest", ",", "endpoint", ")", "elif", "flaskRequest", ".", "method", "==", "\"OP...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
ServerStatus.getVariantAnnotationSets
Returns the list of ReferenceSets for this server.
ga4gh/server/frontend.py
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...
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", "." ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/frontend.py#L179-L189
[ "def", "getVariantAnnotationSets", "(", "self", ",", "datasetId", ")", ":", "# TODO this should be displayed per-variant set, not per dataset.", "variantAnnotationSets", "=", "[", "]", "dataset", "=", "app", ".", "backend", ".", "getDataRepository", "(", ")", ".", "getD...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
auth_decorator
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...
ga4gh/server/auth/__init__.py
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...
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", "...
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/auth/__init__.py#L18-L62
[ "def", "auth_decorator", "(", "app", "=", "None", ")", ":", "def", "requires_auth", "(", "f", ")", ":", "@", "functools", ".", "wraps", "(", "f", ")", "def", "decorated", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# This decorator will only ...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
decode_header
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)
ga4gh/server/auth/__init__.py
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: (...
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", ...
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/auth/__init__.py#L65-L78
[ "def", "decode_header", "(", "auth_header", ",", "client_id", ",", "client_secret", ")", ":", "return", "_decode_header", "(", "_well_formed", "(", "_has_token", "(", "_has_bearer", "(", "_has_header", "(", "auth_header", ")", ")", ")", ")", ",", "client_id", ...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
logout
Logs out the current session by removing it from the cache. This is expected to only occur when a session has
ga4gh/server/auth/__init__.py
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
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" ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/auth/__init__.py#L81-L88
[ "def", "logout", "(", "cache", ")", ":", "cache", ".", "set", "(", "flask", ".", "session", "[", "'auth0_key'", "]", ",", "None", ")", "flask", ".", "session", ".", "clear", "(", ")", "return", "True" ]
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
callback_maker
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...
ga4gh/server/auth/__init__.py
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...
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", ...
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/auth/__init__.py#L91-L159
[ "def", "callback_maker", "(", "cache", "=", "None", ",", "domain", "=", "''", ",", "client_id", "=", "''", ",", "client_secret", "=", "''", ",", "redirect_uri", "=", "''", ")", ":", "def", "callback_handling", "(", ")", ":", "code", "=", "flask", ".", ...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
render_login
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...
ga4gh/server/auth/__init__.py
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. ...
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", ...
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/auth/__init__.py#L162-L189
[ "def", "render_login", "(", "app", "=", "None", ",", "scopes", "=", "''", ",", "redirect_uri", "=", "''", ",", "domain", "=", "''", ",", "client_id", "=", "''", ")", ":", "return", "app", ".", "jinja_env", ".", "from_string", "(", "LOGIN_HTML", ")", ...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
render_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
ga4gh/server/auth/__init__.py
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)
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" ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/auth/__init__.py#L192-L201
[ "def", "render_key", "(", "app", ",", "key", "=", "\"\"", ")", ":", "return", "app", ".", "jinja_env", ".", "from_string", "(", "KEY_HTML", ")", ".", "render", "(", "key", "=", "key", ")" ]
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
_decode_header
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)
ga4gh/server/auth/__init__.py
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...
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", "...
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/auth/__init__.py#L245-L275
[ "def", "_decode_header", "(", "auth_header", ",", "client_id", ",", "client_secret", ")", ":", "try", ":", "token", "=", "auth_header", ".", "split", "(", ")", "[", "1", "]", "payload", "=", "jwt", ".", "decode", "(", "token", ",", "client_secret", ",", ...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
is_active
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:
ga4gh/server/auth/__init__.py
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: ...
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", ...
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/auth/__init__.py#L286-L300
[ "def", "is_active", "(", "cache", ",", "token", ")", ":", "profile", "=", "cache", ".", "get", "(", "token", ")", "if", "not", "profile", ":", "raise", "exceptions", ".", "NotAuthenticatedException", "(", "'The token is good, but you are not logged in. Please '", ...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
AbstractReferenceSet.addReference
Adds the specified reference to this ReferenceSet.
ga4gh/server/datamodel/references.py
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_)
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", "." ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/datamodel/references.py#L49-L56
[ "def", "addReference", "(", "self", ",", "reference", ")", ":", "id_", "=", "reference", ".", "getId", "(", ")", "self", ".", "_referenceIdMap", "[", "id_", "]", "=", "reference", "self", ".", "_referenceNameMap", "[", "reference", ".", "getLocalId", "(", ...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
AbstractReferenceSet.setSpeciesFromJson
Sets the species, an OntologyTerm, to the specified value, given as a JSON string. See the documentation for details of this field.
ga4gh/server/datamodel/references.py
def setSpeciesFromJson(self, speciesJson): """ Sets the species, an OntologyTerm, to the specified value, given as a JSON string. See the documentation for details of this field. """ try: parsed = protocol.fromJson(speciesJson, protocol.OntologyTerm) ...
def setSpeciesFromJson(self, speciesJson): """ Sets the species, an OntologyTerm, to the specified value, given as a JSON string. See the documentation for details of this field. """ try: parsed = protocol.fromJson(speciesJson, protocol.OntologyTerm) ...
[ "Sets", "the", "species", "an", "OntologyTerm", "to", "the", "specified", "value", "given", "as", "a", "JSON", "string", "." ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/datamodel/references.py#L64-L75
[ "def", "setSpeciesFromJson", "(", "self", ",", "speciesJson", ")", ":", "try", ":", "parsed", "=", "protocol", ".", "fromJson", "(", "speciesJson", ",", "protocol", ".", "OntologyTerm", ")", "except", ":", "raise", "exceptions", ".", "InvalidJsonException", "(...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
AbstractReferenceSet.getReferenceByName
Returns the reference with the specified name.
ga4gh/server/datamodel/references.py
def getReferenceByName(self, name): """ Returns the reference with the specified name. """ if name not in self._referenceNameMap: raise exceptions.ReferenceNameNotFoundException(name) return self._referenceNameMap[name]
def getReferenceByName(self, name): """ Returns the reference with the specified name. """ if name not in self._referenceNameMap: raise exceptions.ReferenceNameNotFoundException(name) return self._referenceNameMap[name]
[ "Returns", "the", "reference", "with", "the", "specified", "name", "." ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/datamodel/references.py#L119-L125
[ "def", "getReferenceByName", "(", "self", ",", "name", ")", ":", "if", "name", "not", "in", "self", ".", "_referenceNameMap", ":", "raise", "exceptions", ".", "ReferenceNameNotFoundException", "(", "name", ")", "return", "self", ".", "_referenceNameMap", "[", ...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
AbstractReferenceSet.getReference
Returns the Reference with the specified ID or raises a ReferenceNotFoundException if it does not exist.
ga4gh/server/datamodel/references.py
def getReference(self, id_): """ Returns the Reference with the specified ID or raises a ReferenceNotFoundException if it does not exist. """ if id_ not in self._referenceIdMap: raise exceptions.ReferenceNotFoundException(id_) return self._referenceIdMap[id_]
def getReference(self, id_): """ Returns the Reference with the specified ID or raises a ReferenceNotFoundException if it does not exist. """ if id_ not in self._referenceIdMap: raise exceptions.ReferenceNotFoundException(id_) return self._referenceIdMap[id_]
[ "Returns", "the", "Reference", "with", "the", "specified", "ID", "or", "raises", "a", "ReferenceNotFoundException", "if", "it", "does", "not", "exist", "." ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/datamodel/references.py#L127-L134
[ "def", "getReference", "(", "self", ",", "id_", ")", ":", "if", "id_", "not", "in", "self", ".", "_referenceIdMap", ":", "raise", "exceptions", ".", "ReferenceNotFoundException", "(", "id_", ")", "return", "self", ".", "_referenceIdMap", "[", "id_", "]" ]
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
AbstractReferenceSet.getMd5Checksum
Returns the MD5 checksum for this reference set. This checksum is calculated by making a list of `Reference.md5checksum` for all `Reference`s in this set. We then sort this list, and take the MD5 hash of all the strings concatenated together.
ga4gh/server/datamodel/references.py
def getMd5Checksum(self): """ Returns the MD5 checksum for this reference set. This checksum is calculated by making a list of `Reference.md5checksum` for all `Reference`s in this set. We then sort this list, and take the MD5 hash of all the strings concatenated together. ...
def getMd5Checksum(self): """ Returns the MD5 checksum for this reference set. This checksum is calculated by making a list of `Reference.md5checksum` for all `Reference`s in this set. We then sort this list, and take the MD5 hash of all the strings concatenated together. ...
[ "Returns", "the", "MD5", "checksum", "for", "this", "reference", "set", ".", "This", "checksum", "is", "calculated", "by", "making", "a", "list", "of", "Reference", ".", "md5checksum", "for", "all", "Reference", "s", "in", "this", "set", ".", "We", "then",...
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/datamodel/references.py#L136-L148
[ "def", "getMd5Checksum", "(", "self", ")", ":", "references", "=", "sorted", "(", "self", ".", "getReferences", "(", ")", ",", "key", "=", "lambda", "ref", ":", "ref", ".", "getMd5Checksum", "(", ")", ")", "checksums", "=", "''", ".", "join", "(", "[...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
AbstractReferenceSet.toProtocolElement
Returns the GA4GH protocol representation of this ReferenceSet.
ga4gh/server/datamodel/references.py
def toProtocolElement(self): """ Returns the GA4GH protocol representation of this ReferenceSet. """ ret = protocol.ReferenceSet() ret.assembly_id = pb.string(self.getAssemblyId()) ret.description = pb.string(self.getDescription()) ret.id = self.getId() re...
def toProtocolElement(self): """ Returns the GA4GH protocol representation of this ReferenceSet. """ ret = protocol.ReferenceSet() ret.assembly_id = pb.string(self.getAssemblyId()) ret.description = pb.string(self.getDescription()) ret.id = self.getId() re...
[ "Returns", "the", "GA4GH", "protocol", "representation", "of", "this", "ReferenceSet", "." ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/datamodel/references.py#L201-L220
[ "def", "toProtocolElement", "(", "self", ")", ":", "ret", "=", "protocol", ".", "ReferenceSet", "(", ")", "ret", ".", "assembly_id", "=", "pb", ".", "string", "(", "self", ".", "getAssemblyId", "(", ")", ")", "ret", ".", "description", "=", "pb", ".", ...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
AbstractReference.toProtocolElement
Returns the GA4GH protocol representation of this Reference.
ga4gh/server/datamodel/references.py
def toProtocolElement(self): """ Returns the GA4GH protocol representation of this Reference. """ reference = protocol.Reference() reference.id = self.getId() reference.is_derived = self.getIsDerived() reference.length = self.getLength() reference.md5check...
def toProtocolElement(self): """ Returns the GA4GH protocol representation of this Reference. """ reference = protocol.Reference() reference.id = self.getId() reference.is_derived = self.getIsDerived() reference.length = self.getLength() reference.md5check...
[ "Returns", "the", "GA4GH", "protocol", "representation", "of", "this", "Reference", "." ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/datamodel/references.py#L344-L363
[ "def", "toProtocolElement", "(", "self", ")", ":", "reference", "=", "protocol", ".", "Reference", "(", ")", "reference", ".", "id", "=", "self", ".", "getId", "(", ")", "reference", ".", "is_derived", "=", "self", ".", "getIsDerived", "(", ")", "referen...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
AbstractReference.checkQueryRange
Checks to ensure that the query range is valid within this reference. If not, raise ReferenceRangeErrorException.
ga4gh/server/datamodel/references.py
def checkQueryRange(self, start, end): """ Checks to ensure that the query range is valid within this reference. If not, raise ReferenceRangeErrorException. """ condition = ( (start < 0 or end > self.getLength()) or start > end or start == end) if ...
def checkQueryRange(self, start, end): """ Checks to ensure that the query range is valid within this reference. If not, raise ReferenceRangeErrorException. """ condition = ( (start < 0 or end > self.getLength()) or start > end or start == end) if ...
[ "Checks", "to", "ensure", "that", "the", "query", "range", "is", "valid", "within", "this", "reference", ".", "If", "not", "raise", "ReferenceRangeErrorException", "." ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/datamodel/references.py#L365-L375
[ "def", "checkQueryRange", "(", "self", ",", "start", ",", "end", ")", ":", "condition", "=", "(", "(", "start", "<", "0", "or", "end", ">", "self", ".", "getLength", "(", ")", ")", "or", "start", ">", "end", "or", "start", "==", "end", ")", "if",...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
HtslibReferenceSet.populateFromFile
Populates the instance variables of this ReferencSet from the data URL.
ga4gh/server/datamodel/references.py
def populateFromFile(self, dataUrl): """ Populates the instance variables of this ReferencSet from the data URL. """ self._dataUrl = dataUrl fastaFile = self.getFastaFile() for referenceName in fastaFile.references: reference = HtslibReference(self, re...
def populateFromFile(self, dataUrl): """ Populates the instance variables of this ReferencSet from the data URL. """ self._dataUrl = dataUrl fastaFile = self.getFastaFile() for referenceName in fastaFile.references: reference = HtslibReference(self, re...
[ "Populates", "the", "instance", "variables", "of", "this", "ReferencSet", "from", "the", "data", "URL", "." ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/datamodel/references.py#L463-L478
[ "def", "populateFromFile", "(", "self", ",", "dataUrl", ")", ":", "self", ".", "_dataUrl", "=", "dataUrl", "fastaFile", "=", "self", ".", "getFastaFile", "(", ")", "for", "referenceName", "in", "fastaFile", ".", "references", ":", "reference", "=", "HtslibRe...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
HtslibReferenceSet.populateFromRow
Populates this reference set from the values in the specified DB row.
ga4gh/server/datamodel/references.py
def populateFromRow(self, referenceSetRecord): """ Populates this reference set from the values in the specified DB row. """ self._dataUrl = referenceSetRecord.dataurl self._description = referenceSetRecord.description self._assemblyId = referenceSetRecord.assembl...
def populateFromRow(self, referenceSetRecord): """ Populates this reference set from the values in the specified DB row. """ self._dataUrl = referenceSetRecord.dataurl self._description = referenceSetRecord.description self._assemblyId = referenceSetRecord.assembl...
[ "Populates", "this", "reference", "set", "from", "the", "values", "in", "the", "specified", "DB", "row", "." ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/datamodel/references.py#L480-L495
[ "def", "populateFromRow", "(", "self", ",", "referenceSetRecord", ")", ":", "self", ".", "_dataUrl", "=", "referenceSetRecord", ".", "dataurl", "self", ".", "_description", "=", "referenceSetRecord", ".", "description", "self", ".", "_assemblyId", "=", "referenceS...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
HtslibReference.populateFromRow
Populates this reference from the values in the specified DB row.
ga4gh/server/datamodel/references.py
def populateFromRow(self, referenceRecord): """ Populates this reference from the values in the specified DB row. """ self._length = referenceRecord.length self._isDerived = bool(referenceRecord.isderived) self._md5checksum = referenceRecord.md5checksum species = ...
def populateFromRow(self, referenceRecord): """ Populates this reference from the values in the specified DB row. """ self._length = referenceRecord.length self._isDerived = bool(referenceRecord.isderived) self._md5checksum = referenceRecord.md5checksum species = ...
[ "Populates", "this", "reference", "from", "the", "values", "in", "the", "specified", "DB", "row", "." ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/datamodel/references.py#L521-L533
[ "def", "populateFromRow", "(", "self", ",", "referenceRecord", ")", ":", "self", ".", "_length", "=", "referenceRecord", ".", "length", "self", ".", "_isDerived", "=", "bool", "(", "referenceRecord", ".", "isderived", ")", "self", ".", "_md5checksum", "=", "...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
G2PUtility._extractAssociationsDetails
Given a set of results from our search query, return the `details` (feature,environment,phenotype)
ga4gh/server/datamodel/genotype_phenotype.py
def _extractAssociationsDetails(self, associations): """ Given a set of results from our search query, return the `details` (feature,environment,phenotype) """ detailedURIRef = [] for row in associations.bindings: if 'feature' in row: detailedU...
def _extractAssociationsDetails(self, associations): """ Given a set of results from our search query, return the `details` (feature,environment,phenotype) """ detailedURIRef = [] for row in associations.bindings: if 'feature' in row: detailedU...
[ "Given", "a", "set", "of", "results", "from", "our", "search", "query", "return", "the", "details", "(", "feature", "environment", "phenotype", ")" ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/datamodel/genotype_phenotype.py#L102-L113
[ "def", "_extractAssociationsDetails", "(", "self", ",", "associations", ")", ":", "detailedURIRef", "=", "[", "]", "for", "row", "in", "associations", ".", "bindings", ":", "if", "'feature'", "in", "row", ":", "detailedURIRef", ".", "append", "(", "row", "["...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
G2PUtility._detailTuples
Given a list of uriRefs, return a list of dicts: {'subject': s, 'predicate': p, 'object': o } all values are strings
ga4gh/server/datamodel/genotype_phenotype.py
def _detailTuples(self, uriRefs): """ Given a list of uriRefs, return a list of dicts: {'subject': s, 'predicate': p, 'object': o } all values are strings """ details = [] for uriRef in uriRefs: for subject, predicate, object_ in self._rdfGraph.triples...
def _detailTuples(self, uriRefs): """ Given a list of uriRefs, return a list of dicts: {'subject': s, 'predicate': p, 'object': o } all values are strings """ details = [] for uriRef in uriRefs: for subject, predicate, object_ in self._rdfGraph.triples...
[ "Given", "a", "list", "of", "uriRefs", "return", "a", "list", "of", "dicts", ":", "{", "subject", ":", "s", "predicate", ":", "p", "object", ":", "o", "}", "all", "values", "are", "strings" ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/datamodel/genotype_phenotype.py#L115-L130
[ "def", "_detailTuples", "(", "self", ",", "uriRefs", ")", ":", "details", "=", "[", "]", "for", "uriRef", "in", "uriRefs", ":", "for", "subject", ",", "predicate", ",", "object_", "in", "self", ".", "_rdfGraph", ".", "triples", "(", "(", "uriRef", ",",...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
G2PUtility._bindingsToDict
Given a binding from the sparql query result, create a dict of plain text
ga4gh/server/datamodel/genotype_phenotype.py
def _bindingsToDict(self, bindings): """ Given a binding from the sparql query result, create a dict of plain text """ myDict = {} for key, val in bindings.iteritems(): myDict[key.toPython().replace('?', '')] = val.toPython() return myDict
def _bindingsToDict(self, bindings): """ Given a binding from the sparql query result, create a dict of plain text """ myDict = {} for key, val in bindings.iteritems(): myDict[key.toPython().replace('?', '')] = val.toPython() return myDict
[ "Given", "a", "binding", "from", "the", "sparql", "query", "result", "create", "a", "dict", "of", "plain", "text" ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/datamodel/genotype_phenotype.py#L132-L140
[ "def", "_bindingsToDict", "(", "self", ",", "bindings", ")", ":", "myDict", "=", "{", "}", "for", "key", ",", "val", "in", "bindings", ".", "iteritems", "(", ")", ":", "myDict", "[", "key", ".", "toPython", "(", ")", ".", "replace", "(", "'?'", ","...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
G2PUtility._addDataFile
Given a filename, add it to the graph
ga4gh/server/datamodel/genotype_phenotype.py
def _addDataFile(self, filename): """ Given a filename, add it to the graph """ if filename.endswith('.ttl'): self._rdfGraph.parse(filename, format='n3') else: self._rdfGraph.parse(filename, format='xml')
def _addDataFile(self, filename): """ Given a filename, add it to the graph """ if filename.endswith('.ttl'): self._rdfGraph.parse(filename, format='n3') else: self._rdfGraph.parse(filename, format='xml')
[ "Given", "a", "filename", "add", "it", "to", "the", "graph" ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/datamodel/genotype_phenotype.py#L142-L149
[ "def", "_addDataFile", "(", "self", ",", "filename", ")", ":", "if", "filename", ".", "endswith", "(", "'.ttl'", ")", ":", "self", ".", "_rdfGraph", ".", "parse", "(", "filename", ",", "format", "=", "'n3'", ")", "else", ":", "self", ".", "_rdfGraph", ...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
G2PUtility._getDetails
Given a uriRef, return a dict of all the details for that Ref use the uriRef as the 'id' of the dict
ga4gh/server/datamodel/genotype_phenotype.py
def _getDetails(self, uriRef, associations_details): """ Given a uriRef, return a dict of all the details for that Ref use the uriRef as the 'id' of the dict """ associationDetail = {} for detail in associations_details: if detail['subject'] == uriRef: ...
def _getDetails(self, uriRef, associations_details): """ Given a uriRef, return a dict of all the details for that Ref use the uriRef as the 'id' of the dict """ associationDetail = {} for detail in associations_details: if detail['subject'] == uriRef: ...
[ "Given", "a", "uriRef", "return", "a", "dict", "of", "all", "the", "details", "for", "that", "Ref", "use", "the", "uriRef", "as", "the", "id", "of", "the", "dict" ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/datamodel/genotype_phenotype.py#L151-L161
[ "def", "_getDetails", "(", "self", ",", "uriRef", ",", "associations_details", ")", ":", "associationDetail", "=", "{", "}", "for", "detail", "in", "associations_details", ":", "if", "detail", "[", "'subject'", "]", "==", "uriRef", ":", "associationDetail", "[...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
G2PUtility._formatExternalIdentifiers
Formats several external identifiers for query
ga4gh/server/datamodel/genotype_phenotype.py
def _formatExternalIdentifiers(self, element, element_type): """ Formats several external identifiers for query """ elementClause = None elements = [] if not issubclass(element.__class__, dict): element = protocol.toJsonDict(element) if element['extern...
def _formatExternalIdentifiers(self, element, element_type): """ Formats several external identifiers for query """ elementClause = None elements = [] if not issubclass(element.__class__, dict): element = protocol.toJsonDict(element) if element['extern...
[ "Formats", "several", "external", "identifiers", "for", "query" ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/datamodel/genotype_phenotype.py#L163-L176
[ "def", "_formatExternalIdentifiers", "(", "self", ",", "element", ",", "element_type", ")", ":", "elementClause", "=", "None", "elements", "=", "[", "]", "if", "not", "issubclass", "(", "element", ".", "__class__", ",", "dict", ")", ":", "element", "=", "p...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
G2PUtility._formatExternalIdentifier
Formats a single external identifier for query
ga4gh/server/datamodel/genotype_phenotype.py
def _formatExternalIdentifier(self, element, element_type): """ Formats a single external identifier for query """ if "http" not in element['database']: term = "{}:{}".format(element['database'], element['identifier']) namespaceTerm = self._toNamespaceURL(term) ...
def _formatExternalIdentifier(self, element, element_type): """ Formats a single external identifier for query """ if "http" not in element['database']: term = "{}:{}".format(element['database'], element['identifier']) namespaceTerm = self._toNamespaceURL(term) ...
[ "Formats", "a", "single", "external", "identifier", "for", "query" ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/datamodel/genotype_phenotype.py#L178-L189
[ "def", "_formatExternalIdentifier", "(", "self", ",", "element", ",", "element_type", ")", ":", "if", "\"http\"", "not", "in", "element", "[", "'database'", "]", ":", "term", "=", "\"{}:{}\"", ".", "format", "(", "element", "[", "'database'", "]", ",", "el...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
G2PUtility._formatOntologyTerm
Formats the ontology terms for query
ga4gh/server/datamodel/genotype_phenotype.py
def _formatOntologyTerm(self, element, element_type): """ Formats the ontology terms for query """ elementClause = None if isinstance(element, dict) and element.get('terms'): elements = [] for _term in element['terms']: if _term.get('id'): ...
def _formatOntologyTerm(self, element, element_type): """ Formats the ontology terms for query """ elementClause = None if isinstance(element, dict) and element.get('terms'): elements = [] for _term in element['terms']: if _term.get('id'): ...
[ "Formats", "the", "ontology", "terms", "for", "query" ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/datamodel/genotype_phenotype.py#L191-L206
[ "def", "_formatOntologyTerm", "(", "self", ",", "element", ",", "element_type", ")", ":", "elementClause", "=", "None", "if", "isinstance", "(", "element", ",", "dict", ")", "and", "element", ".", "get", "(", "'terms'", ")", ":", "elements", "=", "[", "]...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
G2PUtility._formatOntologyTermObject
Formats the ontology term object for query
ga4gh/server/datamodel/genotype_phenotype.py
def _formatOntologyTermObject(self, terms, element_type): """ Formats the ontology term object for query """ elementClause = None if not isinstance(terms, collections.Iterable): terms = [terms] elements = [] for term in terms: if term.term_...
def _formatOntologyTermObject(self, terms, element_type): """ Formats the ontology term object for query """ elementClause = None if not isinstance(terms, collections.Iterable): terms = [terms] elements = [] for term in terms: if term.term_...
[ "Formats", "the", "ontology", "term", "object", "for", "query" ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/datamodel/genotype_phenotype.py#L208-L224
[ "def", "_formatOntologyTermObject", "(", "self", ",", "terms", ",", "element_type", ")", ":", "elementClause", "=", "None", "if", "not", "isinstance", "(", "terms", ",", "collections", ".", "Iterable", ")", ":", "terms", "=", "[", "terms", "]", "elements", ...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
G2PUtility._formatIds
Formats a set of identifiers for query
ga4gh/server/datamodel/genotype_phenotype.py
def _formatIds(self, element, element_type): """ Formats a set of identifiers for query """ elementClause = None if isinstance(element, collections.Iterable): elements = [] for _id in element: elements.append('?{} = <{}> '.format( ...
def _formatIds(self, element, element_type): """ Formats a set of identifiers for query """ elementClause = None if isinstance(element, collections.Iterable): elements = [] for _id in element: elements.append('?{} = <{}> '.format( ...
[ "Formats", "a", "set", "of", "identifiers", "for", "query" ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/datamodel/genotype_phenotype.py#L239-L250
[ "def", "_formatIds", "(", "self", ",", "element", ",", "element_type", ")", ":", "elementClause", "=", "None", "if", "isinstance", "(", "element", ",", "collections", ".", "Iterable", ")", ":", "elements", "=", "[", "]", "for", "_id", "in", "element", ":...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
G2PUtility._formatEvidence
Formats elements passed into parts of a query for filtering
ga4gh/server/datamodel/genotype_phenotype.py
def _formatEvidence(self, elements): """ Formats elements passed into parts of a query for filtering """ elementClause = None filters = [] for evidence in elements: if evidence.description: elementClause = 'regex(?{}, "{}")'.format( ...
def _formatEvidence(self, elements): """ Formats elements passed into parts of a query for filtering """ elementClause = None filters = [] for evidence in elements: if evidence.description: elementClause = 'regex(?{}, "{}")'.format( ...
[ "Formats", "elements", "passed", "into", "parts", "of", "a", "query", "for", "filtering" ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/datamodel/genotype_phenotype.py#L252-L273
[ "def", "_formatEvidence", "(", "self", ",", "elements", ")", ":", "elementClause", "=", "None", "filters", "=", "[", "]", "for", "evidence", "in", "elements", ":", "if", "evidence", ".", "description", ":", "elementClause", "=", "'regex(?{}, \"{}\")'", ".", ...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
G2PUtility._getIdentifier
Given a url identifier return identifier portion Leverages prefixes already in graph namespace Returns None if no match Ex. "http://www.drugbank.ca/drugs/DB01268" -> "DB01268"
ga4gh/server/datamodel/genotype_phenotype.py
def _getIdentifier(self, url): """ Given a url identifier return identifier portion Leverages prefixes already in graph namespace Returns None if no match Ex. "http://www.drugbank.ca/drugs/DB01268" -> "DB01268" """ for prefix, namespace in self._rdfGraph.namespac...
def _getIdentifier(self, url): """ Given a url identifier return identifier portion Leverages prefixes already in graph namespace Returns None if no match Ex. "http://www.drugbank.ca/drugs/DB01268" -> "DB01268" """ for prefix, namespace in self._rdfGraph.namespac...
[ "Given", "a", "url", "identifier", "return", "identifier", "portion", "Leverages", "prefixes", "already", "in", "graph", "namespace", "Returns", "None", "if", "no", "match", "Ex", ".", "http", ":", "//", "www", ".", "drugbank", ".", "ca", "/", "drugs", "/"...
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/datamodel/genotype_phenotype.py#L330-L339
[ "def", "_getIdentifier", "(", "self", ",", "url", ")", ":", "for", "prefix", ",", "namespace", "in", "self", ".", "_rdfGraph", ".", "namespaces", "(", ")", ":", "if", "namespace", "in", "url", ":", "return", "url", ".", "replace", "(", "namespace", ","...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
G2PUtility._getPrefixURL
Given a url return namespace prefix. Leverages prefixes already in graph namespace Ex. "http://www.drugbank.ca/drugs/DDD" -> "http://www.drugbank.ca/drugs/"
ga4gh/server/datamodel/genotype_phenotype.py
def _getPrefixURL(self, url): """ Given a url return namespace prefix. Leverages prefixes already in graph namespace Ex. "http://www.drugbank.ca/drugs/DDD" -> "http://www.drugbank.ca/drugs/" """ for prefix, namespace in self._rdfGraph.namespaces(): ...
def _getPrefixURL(self, url): """ Given a url return namespace prefix. Leverages prefixes already in graph namespace Ex. "http://www.drugbank.ca/drugs/DDD" -> "http://www.drugbank.ca/drugs/" """ for prefix, namespace in self._rdfGraph.namespaces(): ...
[ "Given", "a", "url", "return", "namespace", "prefix", ".", "Leverages", "prefixes", "already", "in", "graph", "namespace", "Ex", ".", "http", ":", "//", "www", ".", "drugbank", ".", "ca", "/", "drugs", "/", "DDD", "-", ">", "http", ":", "//", "www", ...
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/datamodel/genotype_phenotype.py#L353-L362
[ "def", "_getPrefixURL", "(", "self", ",", "url", ")", ":", "for", "prefix", ",", "namespace", "in", "self", ".", "_rdfGraph", ".", "namespaces", "(", ")", ":", "if", "namespace", ".", "toPython", "(", ")", "in", "url", ":", "return", "namespace" ]
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
G2PUtility._toGA4GH
given an association dict, return a protocol.FeaturePhenotypeAssociation
ga4gh/server/datamodel/genotype_phenotype.py
def _toGA4GH(self, association, featureSets=[]): """ given an association dict, return a protocol.FeaturePhenotypeAssociation """ # The association dict has the keys: environment, environment # label, evidence, feature label, phenotype and sources. Each # key's v...
def _toGA4GH(self, association, featureSets=[]): """ given an association dict, return a protocol.FeaturePhenotypeAssociation """ # The association dict has the keys: environment, environment # label, evidence, feature label, phenotype and sources. Each # key's v...
[ "given", "an", "association", "dict", "return", "a", "protocol", ".", "FeaturePhenotypeAssociation" ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/datamodel/genotype_phenotype.py#L364-L440
[ "def", "_toGA4GH", "(", "self", ",", "association", ",", "featureSets", "=", "[", "]", ")", ":", "# The association dict has the keys: environment, environment", "# label, evidence, feature label, phenotype and sources. Each", "# key's value is a dict with the RDF predicates as keys an...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
RdfPhenotypeAssociationSet.getAssociations
This query is the main search mechanism. It queries the graph for annotations that match the AND of [feature,environment,phenotype].
ga4gh/server/datamodel/genotype_phenotype.py
def getAssociations( self, request=None, featureSets=[]): """ This query is the main search mechanism. It queries the graph for annotations that match the AND of [feature,environment,phenotype]. """ if len(featureSets) == 0: featureSets = self.getP...
def getAssociations( self, request=None, featureSets=[]): """ This query is the main search mechanism. It queries the graph for annotations that match the AND of [feature,environment,phenotype]. """ if len(featureSets) == 0: featureSets = self.getP...
[ "This", "query", "is", "the", "main", "search", "mechanism", ".", "It", "queries", "the", "graph", "for", "annotations", "that", "match", "the", "AND", "of", "[", "feature", "environment", "phenotype", "]", "." ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/datamodel/genotype_phenotype.py#L474-L524
[ "def", "getAssociations", "(", "self", ",", "request", "=", "None", ",", "featureSets", "=", "[", "]", ")", ":", "if", "len", "(", "featureSets", ")", "==", "0", ":", "featureSets", "=", "self", ".", "getParentContainer", "(", ")", ".", "getFeatureSets",...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
RdfPhenotypeAssociationSet._formatFilterQuery
Generate a formatted sparql query with appropriate filters
ga4gh/server/datamodel/genotype_phenotype.py
def _formatFilterQuery(self, request=None, featureSets=[]): """ Generate a formatted sparql query with appropriate filters """ query = self._baseQuery() filters = [] if issubclass(request.__class__, protocol.SearchGenotypePhenotypeRequest): ...
def _formatFilterQuery(self, request=None, featureSets=[]): """ Generate a formatted sparql query with appropriate filters """ query = self._baseQuery() filters = [] if issubclass(request.__class__, protocol.SearchGenotypePhenotypeRequest): ...
[ "Generate", "a", "formatted", "sparql", "query", "with", "appropriate", "filters" ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/datamodel/genotype_phenotype.py#L526-L545
[ "def", "_formatFilterQuery", "(", "self", ",", "request", "=", "None", ",", "featureSets", "=", "[", "]", ")", ":", "query", "=", "self", ".", "_baseQuery", "(", ")", "filters", "=", "[", "]", "if", "issubclass", "(", "request", ".", "__class__", ",", ...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
RdfPhenotypeAssociationSet._filterSearchPhenotypesRequest
Filters request for phenotype search requests
ga4gh/server/datamodel/genotype_phenotype.py
def _filterSearchPhenotypesRequest(self, request): """ Filters request for phenotype search requests """ filters = [] if request.id: filters.append("?phenotype = <{}>".format(request.id)) if request.description: filters.append( 're...
def _filterSearchPhenotypesRequest(self, request): """ Filters request for phenotype search requests """ filters = [] if request.id: filters.append("?phenotype = <{}>".format(request.id)) if request.description: filters.append( 're...
[ "Filters", "request", "for", "phenotype", "search", "requests" ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/datamodel/genotype_phenotype.py#L587-L615
[ "def", "_filterSearchPhenotypesRequest", "(", "self", ",", "request", ")", ":", "filters", "=", "[", "]", "if", "request", ".", "id", ":", "filters", ".", "append", "(", "\"?phenotype = <{}>\"", ".", "format", "(", "request", ".", "id", ")", ")", "if", "...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
WiggleReader.parseStep
Parse the line describing the mode. One of: variableStep chrom=<reference> [span=<window_size>] fixedStep chrom=<reference> start=<position> step=<step_interval> [span=<window_size>] Span is optional, defaulting to 1. It indicates that each value applies to re...
ga4gh/server/datamodel/continuous.py
def parseStep(self, line): """ Parse the line describing the mode. One of: variableStep chrom=<reference> [span=<window_size>] fixedStep chrom=<reference> start=<position> step=<step_interval> [span=<window_size>] Span is optional, defaulting to 1. It ...
def parseStep(self, line): """ Parse the line describing the mode. One of: variableStep chrom=<reference> [span=<window_size>] fixedStep chrom=<reference> start=<position> step=<step_interval> [span=<window_size>] Span is optional, defaulting to 1. It ...
[ "Parse", "the", "line", "describing", "the", "mode", "." ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/datamodel/continuous.py#L78-L107
[ "def", "parseStep", "(", "self", ",", "line", ")", ":", "fields", "=", "dict", "(", "[", "field", ".", "split", "(", "'='", ")", "for", "field", "in", "line", ".", "split", "(", ")", "[", "1", ":", "]", "]", ")", "if", "'chrom'", "in", "fields"...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
WiggleReader.readWiggleLine
Read a wiggle line. If it is a data line, add values to the protocol object.
ga4gh/server/datamodel/continuous.py
def readWiggleLine(self, line): """ Read a wiggle line. If it is a data line, add values to the protocol object. """ if(line.isspace() or line.startswith("#") or line.startswith("browser") or line.startswith("track")): return elif line.startswi...
def readWiggleLine(self, line): """ Read a wiggle line. If it is a data line, add values to the protocol object. """ if(line.isspace() or line.startswith("#") or line.startswith("browser") or line.startswith("track")): return elif line.startswi...
[ "Read", "a", "wiggle", "line", ".", "If", "it", "is", "a", "data", "line", "add", "values", "to", "the", "protocol", "object", "." ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/datamodel/continuous.py#L109-L152
[ "def", "readWiggleLine", "(", "self", ",", "line", ")", ":", "if", "(", "line", ".", "isspace", "(", ")", "or", "line", ".", "startswith", "(", "\"#\"", ")", "or", "line", ".", "startswith", "(", "\"browser\"", ")", "or", "line", ".", "startswith", "...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
WiggleReader.wiggleFileHandleToProtocol
Return a continuous protocol object satsifiying the given query parameters from the given wiggle file handle.
ga4gh/server/datamodel/continuous.py
def wiggleFileHandleToProtocol(self, fileHandle): """ Return a continuous protocol object satsifiying the given query parameters from the given wiggle file handle. """ for line in fileHandle: self.readWiggleLine(line) return self._data
def wiggleFileHandleToProtocol(self, fileHandle): """ Return a continuous protocol object satsifiying the given query parameters from the given wiggle file handle. """ for line in fileHandle: self.readWiggleLine(line) return self._data
[ "Return", "a", "continuous", "protocol", "object", "satsifiying", "the", "given", "query", "parameters", "from", "the", "given", "wiggle", "file", "handle", "." ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/datamodel/continuous.py#L154-L161
[ "def", "wiggleFileHandleToProtocol", "(", "self", ",", "fileHandle", ")", ":", "for", "line", "in", "fileHandle", ":", "self", ".", "readWiggleLine", "(", "line", ")", "return", "self", ".", "_data" ]
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
BigWigDataSource.checkReference
Check the reference for security. Tries to avoid any characters necessary for doing a script injection.
ga4gh/server/datamodel/continuous.py
def checkReference(self, reference): """ Check the reference for security. Tries to avoid any characters necessary for doing a script injection. """ pattern = re.compile(r'[\s,;"\'&\\]') if pattern.findall(reference.strip()): return False return True
def checkReference(self, reference): """ Check the reference for security. Tries to avoid any characters necessary for doing a script injection. """ pattern = re.compile(r'[\s,;"\'&\\]') if pattern.findall(reference.strip()): return False return True
[ "Check", "the", "reference", "for", "security", ".", "Tries", "to", "avoid", "any", "characters", "necessary", "for", "doing", "a", "script", "injection", "." ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/datamodel/continuous.py#L188-L196
[ "def", "checkReference", "(", "self", ",", "reference", ")", ":", "pattern", "=", "re", ".", "compile", "(", "r'[\\s,;\"\\'&\\\\]'", ")", "if", "pattern", ".", "findall", "(", "reference", ".", "strip", "(", ")", ")", ":", "return", "False", "return", "T...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
BigWigDataSource.readValuesPyBigWig
Use pyBigWig package to read a BigWig file for the given range and return a protocol object. pyBigWig returns an array of values that fill the query range. Not sure if it is possible to get the step and span. This method trims NaN values from the start and end. pyBigWig throws...
ga4gh/server/datamodel/continuous.py
def readValuesPyBigWig(self, reference, start, end): """ Use pyBigWig package to read a BigWig file for the given range and return a protocol object. pyBigWig returns an array of values that fill the query range. Not sure if it is possible to get the step and span. This...
def readValuesPyBigWig(self, reference, start, end): """ Use pyBigWig package to read a BigWig file for the given range and return a protocol object. pyBigWig returns an array of values that fill the query range. Not sure if it is possible to get the step and span. This...
[ "Use", "pyBigWig", "package", "to", "read", "a", "BigWig", "file", "for", "the", "given", "range", "and", "return", "a", "protocol", "object", "." ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/datamodel/continuous.py#L198-L250
[ "def", "readValuesPyBigWig", "(", "self", ",", "reference", ",", "start", ",", "end", ")", ":", "if", "not", "self", ".", "checkReference", "(", "reference", ")", ":", "raise", "exceptions", ".", "ReferenceNameNotFoundException", "(", "reference", ")", "if", ...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
BigWigDataSource.readValuesBigWigToWig
Read a bigwig file and return a protocol object with values within the query range. This method uses the bigWigToWig command line tool from UCSC GoldenPath. The tool is used to return values within a query region. The output is in wiggle format, which is processed by the WiggleReader ...
ga4gh/server/datamodel/continuous.py
def readValuesBigWigToWig(self, reference, start, end): """ Read a bigwig file and return a protocol object with values within the query range. This method uses the bigWigToWig command line tool from UCSC GoldenPath. The tool is used to return values within a query region. ...
def readValuesBigWigToWig(self, reference, start, end): """ Read a bigwig file and return a protocol object with values within the query range. This method uses the bigWigToWig command line tool from UCSC GoldenPath. The tool is used to return values within a query region. ...
[ "Read", "a", "bigwig", "file", "and", "return", "a", "protocol", "object", "with", "values", "within", "the", "query", "range", "." ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/datamodel/continuous.py#L252-L291
[ "def", "readValuesBigWigToWig", "(", "self", ",", "reference", ",", "start", ",", "end", ")", ":", "if", "not", "self", ".", "checkReference", "(", "reference", ")", ":", "raise", "exceptions", ".", "ReferenceNameNotFoundException", "(", "reference", ")", "if"...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
AbstractContinuousSet.toProtocolElement
Returns the representation of this ContinuousSet as the corresponding ProtocolElement.
ga4gh/server/datamodel/continuous.py
def toProtocolElement(self): """ Returns the representation of this ContinuousSet as the corresponding ProtocolElement. """ gaContinuousSet = protocol.ContinuousSet() gaContinuousSet.id = self.getId() gaContinuousSet.dataset_id = self.getParentContainer().getId() ...
def toProtocolElement(self): """ Returns the representation of this ContinuousSet as the corresponding ProtocolElement. """ gaContinuousSet = protocol.ContinuousSet() gaContinuousSet.id = self.getId() gaContinuousSet.dataset_id = self.getParentContainer().getId() ...
[ "Returns", "the", "representation", "of", "this", "ContinuousSet", "as", "the", "corresponding", "ProtocolElement", "." ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/datamodel/continuous.py#L324-L340
[ "def", "toProtocolElement", "(", "self", ")", ":", "gaContinuousSet", "=", "protocol", ".", "ContinuousSet", "(", ")", "gaContinuousSet", ".", "id", "=", "self", ".", "getId", "(", ")", "gaContinuousSet", ".", "dataset_id", "=", "self", ".", "getParentContaine...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
FileContinuousSet.populateFromRow
Populates the instance variables of this ContinuousSet from the specified DB row.
ga4gh/server/datamodel/continuous.py
def populateFromRow(self, continuousSetRecord): """ Populates the instance variables of this ContinuousSet from the specified DB row. """ self._filePath = continuousSetRecord.dataurl self.setAttributesJson(continuousSetRecord.attributes)
def populateFromRow(self, continuousSetRecord): """ Populates the instance variables of this ContinuousSet from the specified DB row. """ self._filePath = continuousSetRecord.dataurl self.setAttributesJson(continuousSetRecord.attributes)
[ "Populates", "the", "instance", "variables", "of", "this", "ContinuousSet", "from", "the", "specified", "DB", "row", "." ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/datamodel/continuous.py#L358-L364
[ "def", "populateFromRow", "(", "self", ",", "continuousSetRecord", ")", ":", "self", ".", "_filePath", "=", "continuousSetRecord", ".", "dataurl", "self", ".", "setAttributesJson", "(", "continuousSetRecord", ".", "attributes", ")" ]
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
FileContinuousSet.getContinuous
Method passed to runSearchRequest to fulfill the request to yield continuous protocol objects that satisfy the given query. :param str referenceName: name of reference (ex: "chr1") :param start: castable to int, start position on reference :param end: castable to int, end position on re...
ga4gh/server/datamodel/continuous.py
def getContinuous(self, referenceName=None, start=None, end=None): """ Method passed to runSearchRequest to fulfill the request to yield continuous protocol objects that satisfy the given query. :param str referenceName: name of reference (ex: "chr1") :param start: castable to i...
def getContinuous(self, referenceName=None, start=None, end=None): """ Method passed to runSearchRequest to fulfill the request to yield continuous protocol objects that satisfy the given query. :param str referenceName: name of reference (ex: "chr1") :param start: castable to i...
[ "Method", "passed", "to", "runSearchRequest", "to", "fulfill", "the", "request", "to", "yield", "continuous", "protocol", "objects", "that", "satisfy", "the", "given", "query", "." ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/datamodel/continuous.py#L372-L385
[ "def", "getContinuous", "(", "self", ",", "referenceName", "=", "None", ",", "start", "=", "None", ",", "end", "=", "None", ")", ":", "bigWigReader", "=", "BigWigDataSource", "(", "self", ".", "_filePath", ")", "for", "continuousObj", "in", "bigWigReader", ...
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
SimulatedContinuousSet.getContinuousData
Returns a set number of simulated continuous data. :param referenceName: name of reference to "search" on :param start: start coordinate of query :param end: end coordinate of query :return: Yields continuous list
ga4gh/server/datamodel/continuous.py
def getContinuousData(self, referenceName=None, start=None, end=None): """ Returns a set number of simulated continuous data. :param referenceName: name of reference to "search" on :param start: start coordinate of query :param end: end coordinate of query :return: Yield...
def getContinuousData(self, referenceName=None, start=None, end=None): """ Returns a set number of simulated continuous data. :param referenceName: name of reference to "search" on :param start: start coordinate of query :param end: end coordinate of query :return: Yield...
[ "Returns", "a", "set", "number", "of", "simulated", "continuous", "data", "." ]
ga4gh/ga4gh-server
python
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/datamodel/continuous.py#L401-L420
[ "def", "getContinuousData", "(", "self", ",", "referenceName", "=", "None", ",", "start", "=", "None", ",", "end", "=", "None", ")", ":", "randomNumberGenerator", "=", "random", ".", "Random", "(", ")", "randomNumberGenerator", ".", "seed", "(", "self", "....
1aa18922ef136db8604f6f098cb1732cba6f2a76
train
NetworkDriver.load_template
Will load a templated configuration on the device. :param cls: Instance of the driver class. :param template_name: Identifies the template name. :param template_source (optional): Custom config template rendered and loaded on device :param template_path (optional): Absolute path to dire...
napalm_base/base.py
def load_template(self, template_name, template_source=None, template_path=None, **template_vars): """ Will load a templated configuration on the device. :param cls: Instance of the driver class. :param template_name: Identifies the template name. :param te...
def load_template(self, template_name, template_source=None, template_path=None, **template_vars): """ Will load a templated configuration on the device. :param cls: Instance of the driver class. :param template_name: Identifies the template name. :param te...
[ "Will", "load", "a", "templated", "configuration", "on", "the", "device", "." ]
napalm-automation/napalm-base
python
https://github.com/napalm-automation/napalm-base/blob/f8a154e642a6da01ac1024dd52eaf7a7116e6191/napalm_base/base.py#L118-L139
[ "def", "load_template", "(", "self", ",", "template_name", ",", "template_source", "=", "None", ",", "template_path", "=", "None", ",", "*", "*", "template_vars", ")", ":", "return", "napalm_base", ".", "helpers", ".", "load_template", "(", "self", ",", "tem...
f8a154e642a6da01ac1024dd52eaf7a7116e6191
train
NetworkDriver.ping
Executes ping on the device and returns a dictionary with the result :param destination: Host or IP Address of the destination :param source (optional): Source address of echo request :param ttl (optional): Maximum number of hops :param timeout (optional): Maximum seconds to wait after ...
napalm_base/base.py
def ping(self, destination, source=c.PING_SOURCE, ttl=c.PING_TTL, timeout=c.PING_TIMEOUT, size=c.PING_SIZE, count=c.PING_COUNT, vrf=c.PING_VRF): """ Executes ping on the device and returns a dictionary with the result :param destination: Host or IP Address of the destination ...
def ping(self, destination, source=c.PING_SOURCE, ttl=c.PING_TTL, timeout=c.PING_TIMEOUT, size=c.PING_SIZE, count=c.PING_COUNT, vrf=c.PING_VRF): """ Executes ping on the device and returns a dictionary with the result :param destination: Host or IP Address of the destination ...
[ "Executes", "ping", "on", "the", "device", "and", "returns", "a", "dictionary", "with", "the", "result" ]
napalm-automation/napalm-base
python
https://github.com/napalm-automation/napalm-base/blob/f8a154e642a6da01ac1024dd52eaf7a7116e6191/napalm_base/base.py#L1159-L1221
[ "def", "ping", "(", "self", ",", "destination", ",", "source", "=", "c", ".", "PING_SOURCE", ",", "ttl", "=", "c", ".", "PING_TTL", ",", "timeout", "=", "c", ".", "PING_TIMEOUT", ",", "size", "=", "c", ".", "PING_SIZE", ",", "count", "=", "c", ".",...
f8a154e642a6da01ac1024dd52eaf7a7116e6191
train
MockDevice.run_commands
Only useful for EOS
napalm_base/mock.py
def run_commands(self, commands): """Only useful for EOS""" if "eos" in self.profile: return list(self.parent.cli(commands).values())[0] else: raise AttributeError("MockedDriver instance has not attribute '_rpc'")
def run_commands(self, commands): """Only useful for EOS""" if "eos" in self.profile: return list(self.parent.cli(commands).values())[0] else: raise AttributeError("MockedDriver instance has not attribute '_rpc'")
[ "Only", "useful", "for", "EOS" ]
napalm-automation/napalm-base
python
https://github.com/napalm-automation/napalm-base/blob/f8a154e642a6da01ac1024dd52eaf7a7116e6191/napalm_base/mock.py#L88-L93
[ "def", "run_commands", "(", "self", ",", "commands", ")", ":", "if", "\"eos\"", "in", "self", ".", "profile", ":", "return", "list", "(", "self", ".", "parent", ".", "cli", "(", "commands", ")", ".", "values", "(", ")", ")", "[", "0", "]", "else", ...
f8a154e642a6da01ac1024dd52eaf7a7116e6191
train
textfsm_extractor
Applies a TextFSM template over a raw text and return the matching table. Main usage of this method will be to extract data form a non-structured output from a network device and return the values in a table format. :param cls: Instance of the driver class :param template_name: Specifies the name of t...
napalm_base/helpers.py
def textfsm_extractor(cls, template_name, raw_text): """ Applies a TextFSM template over a raw text and return the matching table. Main usage of this method will be to extract data form a non-structured output from a network device and return the values in a table format. :param cls: Instance of t...
def textfsm_extractor(cls, template_name, raw_text): """ Applies a TextFSM template over a raw text and return the matching table. Main usage of this method will be to extract data form a non-structured output from a network device and return the values in a table format. :param cls: Instance of t...
[ "Applies", "a", "TextFSM", "template", "over", "a", "raw", "text", "and", "return", "the", "matching", "table", "." ]
napalm-automation/napalm-base
python
https://github.com/napalm-automation/napalm-base/blob/f8a154e642a6da01ac1024dd52eaf7a7116e6191/napalm_base/helpers.py#L88-L138
[ "def", "textfsm_extractor", "(", "cls", ",", "template_name", ",", "raw_text", ")", ":", "textfsm_data", "=", "list", "(", ")", "cls", ".", "__class__", ".", "__name__", ".", "replace", "(", "'Driver'", ",", "''", ")", "current_dir", "=", "os", ".", "pat...
f8a154e642a6da01ac1024dd52eaf7a7116e6191
train
find_txt
Extracts the text value from an XML tree, using XPath. In case of error, will return a default value. :param xml_tree: the XML Tree object. Assumed is <type 'lxml.etree._Element'>. :param path: XPath to be applied, in order to extract the desired data. :param default: Value to be returned in case ...
napalm_base/helpers.py
def find_txt(xml_tree, path, default=''): """ Extracts the text value from an XML tree, using XPath. In case of error, will return a default value. :param xml_tree: the XML Tree object. Assumed is <type 'lxml.etree._Element'>. :param path: XPath to be applied, in order to extract the desired da...
def find_txt(xml_tree, path, default=''): """ Extracts the text value from an XML tree, using XPath. In case of error, will return a default value. :param xml_tree: the XML Tree object. Assumed is <type 'lxml.etree._Element'>. :param path: XPath to be applied, in order to extract the desired da...
[ "Extracts", "the", "text", "value", "from", "an", "XML", "tree", "using", "XPath", ".", "In", "case", "of", "error", "will", "return", "a", "default", "value", "." ]
napalm-automation/napalm-base
python
https://github.com/napalm-automation/napalm-base/blob/f8a154e642a6da01ac1024dd52eaf7a7116e6191/napalm_base/helpers.py#L141-L162
[ "def", "find_txt", "(", "xml_tree", ",", "path", ",", "default", "=", "''", ")", ":", "value", "=", "''", "try", ":", "xpath_applied", "=", "xml_tree", ".", "xpath", "(", "path", ")", "# will consider the first match only", "if", "len", "(", "xpath_applied",...
f8a154e642a6da01ac1024dd52eaf7a7116e6191
train
convert
Converts data to a specific datatype. In case of error, will return a default value. :param to: datatype to be casted to. :param who: value to cast. :param default: value to return in case of error. :return: a str value.
napalm_base/helpers.py
def convert(to, who, default=u''): """ Converts data to a specific datatype. In case of error, will return a default value. :param to: datatype to be casted to. :param who: value to cast. :param default: value to return in case of error. :return: a str value. """ if who is ...
def convert(to, who, default=u''): """ Converts data to a specific datatype. In case of error, will return a default value. :param to: datatype to be casted to. :param who: value to cast. :param default: value to return in case of error. :return: a str value. """ if who is ...
[ "Converts", "data", "to", "a", "specific", "datatype", ".", "In", "case", "of", "error", "will", "return", "a", "default", "value", "." ]
napalm-automation/napalm-base
python
https://github.com/napalm-automation/napalm-base/blob/f8a154e642a6da01ac1024dd52eaf7a7116e6191/napalm_base/helpers.py#L165-L180
[ "def", "convert", "(", "to", ",", "who", ",", "default", "=", "u''", ")", ":", "if", "who", "is", "None", ":", "return", "default", "try", ":", "return", "to", "(", "who", ")", "except", ":", "# noqa", "return", "default" ]
f8a154e642a6da01ac1024dd52eaf7a7116e6191
train
mac
Converts a raw string to a standardised MAC Address EUI Format. :param raw: the raw string containing the value of the MAC Address :return: a string with the MAC Address in EUI format Example: .. code-block:: python >>> mac('0123.4567.89ab') u'01:23:45:67:89:AB' Some vendors lik...
napalm_base/helpers.py
def mac(raw): """ Converts a raw string to a standardised MAC Address EUI Format. :param raw: the raw string containing the value of the MAC Address :return: a string with the MAC Address in EUI format Example: .. code-block:: python >>> mac('0123.4567.89ab') u'01:23:45:67:89...
def mac(raw): """ Converts a raw string to a standardised MAC Address EUI Format. :param raw: the raw string containing the value of the MAC Address :return: a string with the MAC Address in EUI format Example: .. code-block:: python >>> mac('0123.4567.89ab') u'01:23:45:67:89...
[ "Converts", "a", "raw", "string", "to", "a", "standardised", "MAC", "Address", "EUI", "Format", "." ]
napalm-automation/napalm-base
python
https://github.com/napalm-automation/napalm-base/blob/f8a154e642a6da01ac1024dd52eaf7a7116e6191/napalm_base/helpers.py#L183-L218
[ "def", "mac", "(", "raw", ")", ":", "if", "raw", ".", "endswith", "(", "':'", ")", ":", "flat_raw", "=", "raw", ".", "replace", "(", "':'", ",", "''", ")", "raw", "=", "'{flat_raw}{zeros_stuffed}'", ".", "format", "(", "flat_raw", "=", "flat_raw", ",...
f8a154e642a6da01ac1024dd52eaf7a7116e6191
train
compare_numeric
Compare numerical values. You can use '<%d','>%d'.
napalm_base/validate.py
def compare_numeric(src_num, dst_num): """Compare numerical values. You can use '<%d','>%d'.""" dst_num = float(dst_num) match = numeric_compare_regex.match(src_num) if not match: error = "Failed numeric comparison. Collected: {}. Expected: {}".format(dst_num, src_num) raise ValueError(...
def compare_numeric(src_num, dst_num): """Compare numerical values. You can use '<%d','>%d'.""" dst_num = float(dst_num) match = numeric_compare_regex.match(src_num) if not match: error = "Failed numeric comparison. Collected: {}. Expected: {}".format(dst_num, src_num) raise ValueError(...
[ "Compare", "numerical", "values", ".", "You", "can", "use", "<%d", ">", "%d", "." ]
napalm-automation/napalm-base
python
https://github.com/napalm-automation/napalm-base/blob/f8a154e642a6da01ac1024dd52eaf7a7116e6191/napalm_base/validate.py#L150-L167
[ "def", "compare_numeric", "(", "src_num", ",", "dst_num", ")", ":", "dst_num", "=", "float", "(", "dst_num", ")", "match", "=", "numeric_compare_regex", ".", "match", "(", "src_num", ")", "if", "not", "match", ":", "error", "=", "\"Failed numeric comparison. C...
f8a154e642a6da01ac1024dd52eaf7a7116e6191
train
colon_separated_string_to_dict
Converts a string in the format: Name: Et3 Switchport: Enabled Administrative Mode: trunk Operational Mode: trunk MAC Address Learning: enabled Access Mode VLAN: 3 (VLAN0003) Trunking Native Mode VLAN: 1 (default) Administrative Native VLAN tagging: disab...
napalm_base/utils/string_parsers.py
def colon_separated_string_to_dict(string, separator=':'): ''' Converts a string in the format: Name: Et3 Switchport: Enabled Administrative Mode: trunk Operational Mode: trunk MAC Address Learning: enabled Access Mode VLAN: 3 (VLAN0003) Trunking Native M...
def colon_separated_string_to_dict(string, separator=':'): ''' Converts a string in the format: Name: Et3 Switchport: Enabled Administrative Mode: trunk Operational Mode: trunk MAC Address Learning: enabled Access Mode VLAN: 3 (VLAN0003) Trunking Native M...
[ "Converts", "a", "string", "in", "the", "format", ":" ]
napalm-automation/napalm-base
python
https://github.com/napalm-automation/napalm-base/blob/f8a154e642a6da01ac1024dd52eaf7a7116e6191/napalm_base/utils/string_parsers.py#L23-L52
[ "def", "colon_separated_string_to_dict", "(", "string", ",", "separator", "=", "':'", ")", ":", "dictionary", "=", "dict", "(", ")", "for", "line", "in", "string", ".", "splitlines", "(", ")", ":", "line_data", "=", "line", ".", "split", "(", "separator", ...
f8a154e642a6da01ac1024dd52eaf7a7116e6191