本文整理汇总了Python中pbcore.io.SubreadSet.resourceReaders方法的典型用法代码示例。如果您正苦于以下问题:Python SubreadSet.resourceReaders方法的具体用法?Python SubreadSet.resourceReaders怎么用?Python SubreadSet.resourceReaders使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pbcore.io.SubreadSet
的用法示例。
在下文中一共展示了SubreadSet.resourceReaders方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_sequencing_chemistry
# 需要导入模块: from pbcore.io import SubreadSet [as 别名]
# 或者: from pbcore.io.SubreadSet import resourceReaders [as 别名]
def get_sequencing_chemistry(entry_points, include_system_type=True):
"""
Given a list of entry points (eid, path), extract the sequencing chemistry
(and optionally system name) as a human-readable string.
"""
chemistries = set()
is_sequel = is_rsii = False
for eid, path in entry_points:
if eid == "eid_subread" and op.isfile(path):
ds = SubreadSet(path)
for bam in ds.resourceReaders():
for rg in bam.readGroupTable:
chemistries.add(rg.SequencingChemistry)
if rg.SequencingChemistry.startswith("S"):
is_sequel = True
else:
is_rsii = True
if len(chemistries) == 0:
return "NA"
chemistry_str = "; ".join(sorted(list(chemistries)))
if include_system_type:
fmt = "{s} ({c})"
if is_sequel and is_rsii:
return fmt.format(s="Mixed", c=chemistry_str)
elif is_sequel:
return fmt.format(s="Sequel", c=chemistry_str)
elif is_rsii:
return fmt.format(s="RSII", c=chemistry_str)
else:
raise ValueError("Can't determine system type for {c}".format(
c=chemistry_str))
return chemistry_str
示例2: get_data_stats
# 需要导入模块: from pbcore.io import SubreadSet [as 别名]
# 或者: from pbcore.io.SubreadSet import resourceReaders [as 别名]
def get_data_stats(entry_points):
"""
Get basic metrics for input dataset (assumed to be a SubreadSet).
"""
for eid, path in entry_points:
if eid == "eid_subread" and op.isfile(path):
ds = SubreadSet(path)
n_zmws = 0
for bam in ds.resourceReaders():
n_zmws += len(set(bam.pbi.holeNumber))
return data_stats(n_zmws, ds.numRecords, ds.totalLength)
return data_stats("NA", "NA", "NA")
示例3: get_subread_ZMW_stats
# 需要导入模块: from pbcore.io import SubreadSet [as 别名]
# 或者: from pbcore.io.SubreadSet import resourceReaders [as 别名]
def get_subread_ZMW_stats(subread_xml, report):
"""
Fills a dict with:
'numZMW' --- number of sequencing ZMWs
'numSubread' -- number of subreads
'avgZMWlen' -- approximated average ZMW length
'avgSubreadlen' --- average subread length
"""
subread_lens = []
zmw_lens = defaultdict(lambda: 0)
ds = SubreadSet(subread_xml)
for rr in ds.resourceReaders():
for zmw, qStart, qEnd in zip(rr.holeNumber, rr.qStart, rr.qEnd):
subread_lens.append(qEnd-qStart)
zmw_lens[zmw] = max(zmw_lens[zmw], qEnd)
report['numZMW'] = len(zmw_lens)
report['numSubread'] = len(subread_lens)
report['avgZMWlen'] = int(sum(zmw_lens.itervalues())*1./len(zmw_lens))
report['avgSubreadlen'] = int(sum(subread_lens)*1./len(subread_lens))