text stringlengths 81 112k |
|---|
Enters the given node. Creates it if it does not exist.
Returns the node.
def enter(self, path):
"""
Enters the given node. Creates it if it does not exist.
Returns the node.
"""
self.current.append(self.add(path))
return self.current[-1] |
Given a converter (as returned by compile()), this function reads
the given input file and converts it to the requested output format.
Supported output formats are 'xml', 'yaml', 'json', or 'none'.
:type converter: compiler.Context
:param converter: The compiled converter.
:type input_file: str
... |
Like generate(), but writes the output to the given output file
instead.
:type converter: compiler.Context
:param converter: The compiled converter.
:type input_file: str
:param input_file: Name of a file to convert.
:type output_file: str
:param output_file: The output filename.
:ty... |
Like generate(), but reads the input from a string instead of
from a file.
:type converter: compiler.Context
:param converter: The compiled converter.
:type input: str
:param input: The string to convert.
:type format: str
:param format: The output format.
:rtype: str
:return: T... |
Like generate(), but reads the input from a string instead of
from a file, and writes the output to the given output file.
:type converter: compiler.Context
:param converter: The compiled converter.
:type input: str
:param input: The string to convert.
:type output_file: str
:param outpu... |
A very simple cron-like parser to determine, if (cron-like) string is valid for this date and time.
@input:
s = cron-like string (minute, hour, day of month, month, day of week)
dt = datetime to use as reference time, defaults to now
@output: boolean of result
def is_now(s, dt=None):
'''
... |
A parser to check whether a (cron-like) string has been true during a certain time period.
Useful for applications which cannot check every minute or need to catch up during a restart.
@input:
s = cron-like string (minute, hour, day of month, month, day of week)
since = datetime to use as refere... |
Area under the precision-recall curve
def auprc(y_true, y_pred):
"""Area under the precision-recall curve
"""
y_true, y_pred = _mask_value_nan(y_true, y_pred)
return skm.average_precision_score(y_true, y_pred) |
Get tid of the best trial
rank=0 means the best model
rank=1 means second best
...
def best_trial_tid(self, rank=0):
"""Get tid of the best trial
rank=0 means the best model
rank=1 means second best
...
"""
candidates = [t for t in self.trials
... |
Extends the original object in order to inject checking
for stalled jobs and killing them if they are running for too long
def count_by_state_unsynced(self, arg):
"""Extends the original object in order to inject checking
for stalled jobs and killing them if they are running for too long
... |
Plot the loss curves
def plot_history(self, tid, scores=["loss", "f1", "accuracy"],
figsize=(15, 3)):
"""Plot the loss curves"""
history = self.train_history(tid)
import matplotlib.pyplot as plt
fig = plt.figure(figsize=figsize)
for i, score in enumerate(sc... |
Load saved keras model of the trial.
If tid = None, get the best model
Not applicable for trials ran in cross validion (i.e. not applicable
for `CompileFN.cv_n_folds is None`
def load_model(self, tid, custom_objects=None):
"""Load saved keras model of the trial.
If tid = None... |
Number of ok trials()
def n_ok(self):
"""Number of ok trials()
"""
if len(self.trials) == 0:
return 0
else:
return np.sum(np.array(self.statuses()) == "ok") |
Return a list of results with ok status
def get_ok_results(self, verbose=True):
"""Return a list of results with ok status
"""
if len(self.trials) == 0:
return []
not_ok = np.where(np.array(self.statuses()) != "ok")[0]
if len(not_ok) > 0 and verbose:
pr... |
Common wrapper for the authentication modules.
* Parses the request before passing it on to the authentication module.
* Sets 'pyoidc' cookie if authentication succeeds.
* Redirects the user to complete the authentication.
* Allows the user to retry authentication if it fails.
:param... |
Common wrapper for the underlying pyoidc library functions.
Reads GET params and POST data before passing it on the library and
converts the response from oic.utils.http_util to wsgi.
:param func: underlying library function
def pyoidcMiddleware(func):
"""Common wrapper for the underlying pyoidc librar... |
Convert an oic.utils.http_util instance to Flask.
def resp2flask(resp):
"""Convert an oic.utils.http_util instance to Flask."""
if isinstance(resp, Redirect) or isinstance(resp, SeeOther):
code = int(resp.status.split()[0])
raise cherrypy.HTTPRedirect(resp.message, code)
return resp.message... |
Add all authentication methods specified in the configuration.
def setup_authentication_methods(authn_config, template_env):
"""Add all authentication methods specified in the configuration."""
routing = {}
ac = AuthnBroker()
for authn_method in authn_config:
cls = make_cls_from_name(authn_meth... |
Setup the OpenID Connect Provider endpoints.
def setup_endpoints(provider):
"""Setup the OpenID Connect Provider endpoints."""
app_routing = {}
endpoints = [
AuthorizationEndpoint(
pyoidcMiddleware(provider.authorization_endpoint)),
TokenEndpoint(
pyoidcMiddleware(pr... |
Handle webfinger requests.
def _webfinger(provider, request, **kwargs):
"""Handle webfinger requests."""
params = urlparse.parse_qs(request)
if params["rel"][0] == OIC_ISSUER:
wf = WebFinger()
return Response(wf.response(params["resource"][0], provider.baseurl),
head... |
Converts a dictionary of keyword arguments into a tuple
of SQL select statements and the list of SQL arguments
def featuresQuery(self, **kwargs):
"""
Converts a dictionary of keyword arguments into a tuple
of SQL select statements and the list of SQL arguments
"""
# TODO... |
Perform a full features query in database.
:param startIndex: int representing first record to return
:param maxResults: int representing number of records to return
:param referenceName: string representing reference name, ex 'chr1'
:param start: int position on reference to start sear... |
Fetch feature by featureID.
:param featureId: the FeatureID as found in GFF3 records
:return: dictionary representing a feature object,
or None if no match is found.
def getFeatureById(self, featureId):
"""
Fetch feature by featureID.
:param featureId: the FeatureI... |
Returns the representation of this FeatureSet as the corresponding
ProtocolElement.
def toProtocolElement(self):
"""
Returns the representation of this FeatureSet as the corresponding
ProtocolElement.
"""
gaFeatureSet = protocol.FeatureSet()
gaFeatureSet.id = sel... |
Returns server-style compound ID for an internal featureId.
:param long featureId: id of feature in database
:return: string representing ID for the specified GA4GH protocol
Feature object in this FeatureSet.
def getCompoundIdForFeatureId(self, featureId):
"""
Returns serve... |
Fetches a simulated feature by ID.
:param compoundId: any non-null string
:return: A simulated feature with id set to the same value as the
passed-in compoundId.
":raises: exceptions.ObjectWithIdNotFoundException if None is passed
in for the compoundId.
def getFeature(s... |
Returns a set number of simulated features.
:param referenceName: name of reference to "search" on
:param start: start coordinate of query
:param end: end coordinate of query
:param startIndex: None or int
:param maxResults: None or int
:param featureTypes: optional list... |
Populates the instance variables of this FeatureSet from the specified
data URL.
def populateFromFile(self, dataUrl):
"""
Populates the instance variables of this FeatureSet from the specified
data URL.
"""
self._dbFilePath = dataUrl
self._db = Gff3DbBackend(self... |
Populates the instance variables of this FeatureSet from the specified
DB row.
def populateFromRow(self, featureSetRecord):
"""
Populates the instance variables of this FeatureSet from the specified
DB row.
"""
self._dbFilePath = featureSetRecord.dataurl
self.set... |
Returns a protocol.Feature object corresponding to a compoundId
:param compoundId: a datamodel.FeatureCompoundId object
:return: a Feature object.
:raises: exceptions.ObjectWithIdNotFoundException if invalid
compoundId is provided.
def getFeature(self, compoundId):
"""
... |
:param feature: The DB Row representing a feature
:return: the corresponding GA4GH protocol.Feature object
def _gaFeatureForFeatureDbRecord(self, feature):
"""
:param feature: The DB Row representing a feature
:return: the corresponding GA4GH protocol.Feature object
"""
... |
method passed to runSearchRequest to fulfill the request
: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 reference
:param startIndex: none or castable to int
:param ma... |
Add an rnaQuantification to this rnaQuantificationSet
def addRnaQuantification(self, rnaQuantification):
"""
Add an rnaQuantification to this rnaQuantificationSet
"""
id_ = rnaQuantification.getId()
self._rnaQuantificationIdMap[id_] = rnaQuantification
self._rnaQuantific... |
Converts this rnaQuant into its GA4GH protocol equivalent.
def toProtocolElement(self):
"""
Converts this rnaQuant into its GA4GH protocol equivalent.
"""
protocolElement = protocol.RnaQuantificationSet()
protocolElement.id = self.getId()
protocolElement.dataset_id = sel... |
Populates the instance variables of this RnaQuantificationSet from the
specified data URL.
def populateFromFile(self, dataUrl):
"""
Populates the instance variables of this RnaQuantificationSet from the
specified data URL.
"""
self._dbFilePath = dataUrl
self._db ... |
Populates the instance variables of this RnaQuantificationSet from the
specified DB row.
def populateFromRow(self, quantificationSetRecord):
"""
Populates the instance variables of this RnaQuantificationSet from the
specified DB row.
"""
self._dbFilePath = quantification... |
Converts this rnaQuant into its GA4GH protocol equivalent.
def toProtocolElement(self):
"""
Converts this rnaQuant into its GA4GH protocol equivalent.
"""
protocolElement = protocol.RnaQuantification()
protocolElement.id = self.getId()
protocolElement.name = self._name
... |
data elements are:
Id, annotations, description, name, readGroupId
where annotations is a comma separated list
def addRnaQuantMetadata(self, fields):
"""
data elements are:
Id, annotations, description, name, readGroupId
where annotations is a comma separated list
... |
input is tab file with no header. Columns are:
Id, annotations, description, name, readGroupId
where annotation is a comma separated list
def getRnaQuantMetadata(self):
"""
input is tab file with no header. Columns are:
Id, annotations, description, name, readGroupId
w... |
Populates the instance variables of this FeatureSet from the specified
data URL.
def populateFromFile(self, dataUrl):
"""
Populates the instance variables of this FeatureSet from the specified
data URL.
"""
self._dbFilePath = dataUrl
self._db = SqliteRnaBackend(s... |
Populates the instance variables of this FeatureSet from the specified
DB row.
def populateFromRow(self, row):
"""
Populates the instance variables of this FeatureSet from the specified
DB row.
"""
self._dbFilePath = row[b'dataUrl']
self._db = SqliteRnaBackend(se... |
Returns the list of ExpressionLevels in this RNA Quantification.
def getExpressionLevels(
self, threshold=0.0, names=[], startIndex=0, maxResults=0):
"""
Returns the list of ExpressionLevels in this RNA Quantification.
"""
rnaQuantificationId = self.getLocalId()
with... |
:param rnaQuantificationId: string restrict search by id
:return an array of dictionaries, representing the returned data.
def searchRnaQuantificationsInDb(
self, rnaQuantificationId=""):
"""
:param rnaQuantificationId: string restrict search by id
:return an array of dictio... |
:param rnaQuantificationId: the RNA Quantification ID
:return: dictionary representing an RnaQuantification object,
or None if no match is found.
def getRnaQuantificationById(self, rnaQuantificationId):
"""
:param rnaQuantificationId: the RNA Quantification ID
:return: dicti... |
:param rnaQuantId: string restrict search by quantification id
:param threshold: float minimum expression values to return
:return an array of dictionaries, representing the returned data.
def searchExpressionLevelsInDb(
self, rnaQuantId, names=[], threshold=0.0, startIndex=0,
m... |
:param expressionId: the ExpressionLevel ID
:return: dictionary representing an ExpressionLevel object,
or None if no match is found.
def getExpressionLevelById(self, expressionId):
"""
:param expressionId: the ExpressionLevel ID
:return: dictionary representing an Expressio... |
Populates this CallSet from the specified DB row.
def populateFromRow(self, callSetRecord):
"""
Populates this CallSet from the specified DB row.
"""
self._biosampleId = callSetRecord.biosampleid
self.setAttributesJson(callSetRecord.attributes) |
Returns the representation of this CallSet as the corresponding
ProtocolElement.
def toProtocolElement(self):
"""
Returns the representation of this CallSet as the corresponding
ProtocolElement.
"""
variantSet = self.getParentContainer()
gaCallSet = protocol.Call... |
Adds the specified variantAnnotationSet to this dataset.
def addVariantAnnotationSet(self, variantAnnotationSet):
"""
Adds the specified variantAnnotationSet to this dataset.
"""
id_ = variantAnnotationSet.getId()
self._variantAnnotationSetIdMap[id_] = variantAnnotationSet
... |
Returns the AnnotationSet in this dataset with the specified 'id'
def getVariantAnnotationSet(self, id_):
"""
Returns the AnnotationSet in this dataset with the specified 'id'
"""
if id_ not in self._variantAnnotationSetIdMap:
raise exceptions.AnnotationSetNotFoundException(... |
Adds the specfied CallSet to this VariantSet.
def addCallSet(self, callSet):
"""
Adds the specfied CallSet to this VariantSet.
"""
callSetId = callSet.getId()
self._callSetIdMap[callSetId] = callSet
self._callSetNameMap[callSet.getLocalId()] = callSet
self._callS... |
Adds a CallSet for the specified sample name.
def addCallSetFromName(self, sampleName):
"""
Adds a CallSet for the specified sample name.
"""
callSet = CallSet(self, sampleName)
self.addCallSet(callSet) |
Returns a CallSet with the specified name, or raises a
CallSetNameNotFoundException if it does not exist.
def getCallSetByName(self, name):
"""
Returns a CallSet with the specified name, or raises a
CallSetNameNotFoundException if it does not exist.
"""
if name not in se... |
Returns a CallSet with the specified id, or raises a
CallSetNotFoundException if it does not exist.
def getCallSet(self, id_):
"""
Returns a CallSet with the specified id, or raises a
CallSetNotFoundException if it does not exist.
"""
if id_ not in self._callSetIdMap:
... |
Converts this VariantSet into its GA4GH protocol equivalent.
def toProtocolElement(self):
"""
Converts this VariantSet into its GA4GH protocol equivalent.
"""
protocolElement = protocol.VariantSet()
protocolElement.id = self.getId()
protocolElement.dataset_id = self.getP... |
Convenience method to set the common fields in a GA Variant
object from this variant set.
def _createGaVariant(self):
"""
Convenience method to set the common fields in a GA Variant
object from this variant set.
"""
ret = protocol.Variant()
if self._creationTime:... |
Returns an ID string suitable for the specified GA Variant
object in this variant set.
def getVariantId(self, gaVariant):
"""
Returns an ID string suitable for the specified GA Variant
object in this variant set.
"""
md5 = self.hashVariant(gaVariant)
compoundId =... |
Returns the callSetId for the specified sampleName in this
VariantSet.
def getCallSetId(self, sampleName):
"""
Returns the callSetId for the specified sampleName in this
VariantSet.
"""
compoundId = datamodel.CallSetCompoundId(
self.getCompoundId(), sampleNam... |
Produces an MD5 hash of the ga variant object to distinguish
it from other variants at the same genomic coordinate.
def hashVariant(cls, gaVariant):
"""
Produces an MD5 hash of the ga variant object to distinguish
it from other variants at the same genomic coordinate.
"""
... |
Generate a random variant for the specified position using the
specified random number generator. This generator should be seeded
with a value that is unique to this position so that the same variant
will always be produced regardless of the order it is generated in.
def generateVariant(self, r... |
Populates this VariantSet from the specified DB row.
def populateFromRow(self, variantSetRecord):
"""
Populates this VariantSet from the specified DB row.
"""
self._created = variantSetRecord.created
self._updated = variantSetRecord.updated
self.setAttributesJson(variant... |
Populates this variant set using the specified lists of data
files and indexes. These must be in the same order, such that
the jth index file corresponds to the jth data file.
def populateFromFile(self, dataUrls, indexFiles):
"""
Populates this variant set using the specified lists of d... |
Populates this VariantSet by examing all the VCF files in the
specified directory. This is mainly used for as a convenience
for testing purposes.
def populateFromDirectory(self, vcfDirectory):
"""
Populates this VariantSet by examing all the VCF files in the
specified directory.... |
Perform consistency check on the variant set
def checkConsistency(self):
"""
Perform consistency check on the variant set
"""
for referenceName, (dataUrl, indexFile) in self._chromFileMap.items():
varFile = pysam.VariantFile(dataUrl, index_filename=indexFile)
try... |
Populates the instance variables of this VariantSet from the specified
pysam VariantFile object.
def _populateFromVariantFile(self, varFile, dataUrl, indexFile):
"""
Populates the instance variables of this VariantSet from the specified
pysam VariantFile object.
"""
if v... |
Updates the variant annotation set associated with this variant using
information in the specified pysam variantFile.
def _updateVariantAnnotationSets(self, variantFile, dataUrl):
"""
Updates the variant annotation set associated with this variant using
information in the specified pysa... |
Updates the metadata for his variant set based on the specified
variant file
def _updateMetadata(self, variantFile):
"""
Updates the metadata for his variant set based on the specified
variant file
"""
metadata = self._getMetadataFromVcf(variantFile)
if self._met... |
Checks that metadata is consistent
def _checkMetadata(self, variantFile):
"""
Checks that metadata is consistent
"""
metadata = self._getMetadataFromVcf(variantFile)
if self._metadata is not None and self._metadata != metadata:
raise exceptions.InconsistentMetaDataEx... |
Checks callSetIds for consistency
def _checkCallSetIds(self, variantFile):
"""
Checks callSetIds for consistency
"""
if len(self._callSetIdMap) > 0:
callSetIds = set([
self.getCallSetId(sample)
for sample in variantFile.header.samples])
... |
Updates the call set IDs based on the specified variant file.
def _updateCallSetIds(self, variantFile):
"""
Updates the call set IDs based on the specified variant file.
"""
if len(self._callSetIdMap) == 0:
for sample in variantFile.header.samples:
self.addCa... |
Converts the specified pysam variant record into a GA4GH Variant
object. Only calls for the specified list of callSetIds will
be included.
def convertVariant(self, record, callSetIds):
"""
Converts the specified pysam variant record into a GA4GH Variant
object. Only calls for th... |
Returns an iterator over the pysam VCF records corresponding to the
specified query.
def getPysamVariants(self, referenceName, startPosition, endPosition):
"""
Returns an iterator over the pysam VCF records corresponding to the
specified query.
"""
if referenceName in se... |
Returns an iterator over the specified variants. The parameters
correspond to the attributes of a GASearchVariantsRequest object.
def getVariants(self, referenceName, startPosition, endPosition,
callSetIds=[]):
"""
Returns an iterator over the specified variants. The paramet... |
Returns the id of a metadata
def getMetadataId(self, metadata):
"""
Returns the id of a metadata
"""
return str(datamodel.VariantSetMetadataCompoundId(
self.getCompoundId(), 'metadata:' + metadata.key)) |
Convenience method to set the common fields in a GA VariantAnnotation
object from this variant set.
def _createGaVariantAnnotation(self):
"""
Convenience method to set the common fields in a GA VariantAnnotation
object from this variant set.
"""
ret = protocol.VariantAnn... |
Converts this VariantAnnotationSet into its GA4GH protocol equivalent.
def toProtocolElement(self):
"""
Converts this VariantAnnotationSet into its GA4GH protocol equivalent.
"""
protocolElement = protocol.VariantAnnotationSet()
protocolElement.id = self.getId()
protocol... |
Produces an MD5 hash of the gaVariant and gaVariantAnnotation objects
def hashVariantAnnotation(cls, gaVariant, gaVariantAnnotation):
"""
Produces an MD5 hash of the gaVariant and gaVariantAnnotation objects
"""
treffs = [treff.id for treff in gaVariantAnnotation.transcript_effects]
... |
Produces a stringified compoundId representing a variant
annotation.
:param gaVariant: protocol.Variant
:param gaAnnotation: protocol.VariantAnnotation
:return: compoundId String
def getVariantAnnotationId(self, gaVariant, gaAnnotation):
"""
Produces a stringified com... |
Generate a random variant annotation based on a given variant.
This generator should be seeded with a value that is unique to the
variant so that the same annotation will always be produced regardless
of the order it is generated in.
def generateVariantAnnotation(self, variant):
"""
... |
Populates this VariantAnnotationSet from the specified DB row.
def populateFromRow(self, annotationSetRecord):
"""
Populates this VariantAnnotationSet from the specified DB row.
"""
self._annotationType = annotationSetRecord.annotationtype
self._analysis = protocol.fromJson(
... |
Assembles metadata within the VCF header into a GA4GH Analysis object.
:return: protocol.Analysis
def _getAnnotationAnalysis(self, varFile):
"""
Assembles metadata within the VCF header into a GA4GH Analysis object.
:return: protocol.Analysis
"""
header = varFile.heade... |
Generator for iterating through variant annotations in this
variant annotation set.
:param referenceName:
:param startPosition:
:param endPosition:
:return: generator of protocol.VariantAnnotation
def getVariantAnnotations(self, referenceName, startPosition, endPosition):
... |
Accepts a position string (start/length) and returns
a GA4GH AlleleLocation with populated fields.
:param pos:
:return: protocol.AlleleLocation
def convertLocation(self, pos):
"""
Accepts a position string (start/length) and returns
a GA4GH AlleleLocation with populated ... |
Accepts an annotation in HGVS notation and returns
an AlleleLocation with populated fields.
:param hgvsc:
:return:
def convertLocationHgvsC(self, hgvsc):
"""
Accepts an annotation in HGVS notation and returns
an AlleleLocation with populated fields.
:param hgvsc:... |
Accepts an annotation in HGVS notation and returns
an AlleleLocation with populated fields.
:param hgvsp:
:return: protocol.AlleleLocation
def convertLocationHgvsP(self, hgvsp):
"""
Accepts an annotation in HGVS notation and returns
an AlleleLocation with populated field... |
Adds locations to a GA4GH transcript effect object
by parsing HGVS annotation fields in concert with
and supplied position values.
:param effect: protocol.TranscriptEffect
:param protPos: String representing protein position from VCF
:param cdnaPos: String representing coding DNA... |
Takes the ANN string of a SnpEff generated VCF, splits it
and returns a populated GA4GH transcript effect object.
:param annStr: String
:param hgvsG: String
:return: effect protocol.TranscriptEffect()
def convertTranscriptEffect(self, annStr, hgvsG):
"""
Takes the ANN st... |
Splits a string of sequence ontology effects and creates
an ontology term record for each, which are built into
an array of return soTerms.
:param seqOntStr:
:return: [protocol.OntologyTerm]
def convertSeqOntology(self, seqOntStr):
"""
Splits a string of sequence ontolog... |
Converts the specfied pysam variant record into a GA4GH variant
annotation object using the specified function to convert the
transcripts.
def convertVariantAnnotation(self, record):
"""
Converts the specfied pysam variant record into a GA4GH variant
annotation object using the ... |
Return name=value for a single attribute
def _attributeStr(self, name):
"""
Return name=value for a single attribute
"""
return "{}={}".format(
_encodeAttr(name),
",".join([_encodeAttr(v) for v in self.attributes[name]])) |
Return name=value, semi-colon-separated string for attributes,
including url-style quoting
def _attributeStrs(self):
"""
Return name=value, semi-colon-separated string for attributes,
including url-style quoting
"""
return ";".join([self._attributeStr(name)
... |
ID attribute from GFF3 or None if record doesn't have it.
Called "Name" rather than "Id" within GA4GH, as there is
no guarantee of either uniqueness or existence.
def featureName(self):
"""
ID attribute from GFF3 or None if record doesn't have it.
Called "Name" rather than "Id" ... |
Link a feature with its parents.
def _linkFeature(self, feature):
"""
Link a feature with its parents.
"""
parentNames = feature.attributes.get("Parent")
if parentNames is None:
self.roots.add(feature)
else:
for parentName in parentNames:
... |
Link a feature with its children
def _linkToParent(self, feature, parentName):
"""
Link a feature with its children
"""
parentParts = self.byFeatureName.get(parentName)
if parentParts is None:
raise GFF3Exception(
"Parent feature does not exist: {}".f... |
finish loading the set, constructing the tree
def linkChildFeaturesToParents(self):
"""
finish loading the set, constructing the tree
"""
# features maybe disjoint
for featureParts in self.byFeatureName.itervalues():
for feature in featureParts:
self.... |
Sort order for Features, by genomic coordinate,
disambiguated by feature type (alphabetically).
def _recSortKey(r):
"""
Sort order for Features, by genomic coordinate,
disambiguated by feature type (alphabetically).
"""
return r.seqname, r.start, -r.end, r.type |
Writes a single record to a file provided by the filehandle fh.
def _writeRec(self, fh, rec):
"""
Writes a single record to a file provided by the filehandle fh.
"""
fh.write(str(rec) + "\n")
for child in sorted(rec.children, key=self._recSortKey):
self._writeRec(fh,... |
Write set to a GFF3 format file.
:param file fh: file handle for file to write to
def write(self, fh):
"""
Write set to a GFF3 format file.
:param file fh: file handle for file to write to
"""
fh.write(GFF3_HEADER+"\n")
for root in sorted(self.roots, key=self._... |
open input file, optionally with decompression
def _open(self):
"""
open input file, optionally with decompression
"""
if self.fileName.endswith(".gz"):
return gzip.open(self.fileName)
elif self.fileName.endswith(".bz2"):
return bz2.BZ2File(self.fileName)... |
Returns tuple of tuple of (attr, value), multiple are returned to
handle multi-value attributes.
def _parseAttrVal(self, attrStr):
"""
Returns tuple of tuple of (attr, value), multiple are returned to
handle multi-value attributes.
"""
m = self.SPLIT_ATTR_RE.match(attrSt... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.