text stringlengths 0 828 |
|---|
In cases where the direct children of a gene feature have heterogenous |
types, the `primary_mrna` function will only discard mRNA features. This |
function, however, will discard all direct children of the gene that are |
not the primary transcript, including non-transcript children. This is a |
retty subtle distinction, and anecdotal experience suggests that cases in |
which the distinction actually matters are extremely rare. |
"""""" |
for entry in entrystream: |
if not isinstance(entry, tag.Feature): |
yield entry |
continue |
for parent in tag.select.features(entry, parenttype, traverse=True): |
if parent.num_children == 0: |
continue |
transcripts = defaultdict(list) |
for child in parent.children: |
if child.type in type_terms: |
transcripts[child.type].append(child) |
if len(transcripts) == 0: |
continue |
ttypes = list(transcripts.keys()) |
ttype = _get_primary_type(ttypes, parent) |
transcript_list = transcripts[ttype] |
if ttype == 'mRNA': |
_emplace_pmrna(transcript_list, parent, strict=True) |
else: |
_emplace_transcript(transcript_list, parent) |
yield entry" |
3777,"def parse_parent(docname): |
"""""" Given a docname path, pick apart and return name of parent """""" |
lineage = docname.split('/') |
lineage_count = len(lineage) |
if docname == 'index': |
# This is the top of the Sphinx project |
parent = None |
elif lineage_count == 1: |
# This is a non-index doc in root, e.g. about |
parent = 'index' |
elif lineage_count == 2 and lineage[-1] == 'index': |
# This is blog/index, parent is the root |
parent = 'index' |
elif lineage_count == 2: |
# This is blog/about |
parent = lineage[0] + '/index' |
elif lineage[-1] == 'index': |
# This is blog/sub/index |
parent = '/'.join(lineage[:-2]) + '/index' |
else: |
# This should be blog/sub/about |
parent = '/'.join(lineage[:-1]) + '/index' |
return parent" |
3778,"def parents(self, resources): |
"""""" Split the path in name and get parents """""" |
if self.docname == 'index': |
# The root has no parents |
return [] |
parents = [] |
parent = resources.get(self.parent) |
while parent is not None: |
parents.append(parent) |
parent = resources.get(parent.parent) |
return parents" |
3779,"def acquire(self, resources, prop_name): |
"""""" Starting with self, walk until you find prop or None """""" |
# Instance |
custom_prop = getattr(self.props, prop_name, None) |
if custom_prop: |
return custom_prop |
# Parents...can't use acquire as have to keep going on acquireds |
for parent in self.parents(resources): |
acquireds = parent.props.acquireds |
if acquireds: |
# First try in the per-type acquireds |
rtype_acquireds = acquireds.get(self.rtype) |
if rtype_acquireds: |
prop_acquired = rtype_acquireds.get(prop_name) |
if prop_acquired: |
return prop_acquired |
# Next in the ""all"" section of acquireds |
all_acquireds = acquireds.get('all') |
if all_acquireds: |
prop_acquired = all_acquireds.get(prop_name) |
if prop_acquired: |
return prop_acquired |
return" |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.