本文整理汇总了Python中pbcore.io.AlignmentSet.addReference方法的典型用法代码示例。如果您正苦于以下问题:Python AlignmentSet.addReference方法的具体用法?Python AlignmentSet.addReference怎么用?Python AlignmentSet.addReference使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pbcore.io.AlignmentSet
的用法示例。
在下文中一共展示了AlignmentSet.addReference方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_alignment_reference
# 需要导入模块: from pbcore.io import AlignmentSet [as 别名]
# 或者: from pbcore.io.AlignmentSet import addReference [as 别名]
def test_alignment_reference(self):
rs1 = ReferenceSet(data.getXml(9))
fasta_res = rs1.externalResources[0]
fasta_file = urlparse(fasta_res.resourceId).path
ds1 = AlignmentSet(data.getXml(8),
referenceFastaFname=rs1)
aln_ref = None
for aln in ds1:
aln_ref = aln.reference()
break
self.assertTrue(aln_ref is not None)
ds1 = AlignmentSet(data.getXml(8),
referenceFastaFname=fasta_file)
aln_ref = None
for aln in ds1:
aln_ref = aln.reference()
break
self.assertTrue(aln_ref is not None)
ds1 = AlignmentSet(data.getXml(8))
ds1.addReference(fasta_file)
aln_ref = None
for aln in ds1:
aln_ref = aln.reference()
break
self.assertTrue(aln_ref is not None)
示例2: test_alignment_reference
# 需要导入模块: from pbcore.io import AlignmentSet [as 别名]
# 或者: from pbcore.io.AlignmentSet import addReference [as 别名]
def test_alignment_reference(self):
rfn = data.getXml(9)
rs1 = ReferenceSet(data.getXml(9))
fasta_res = rs1.externalResources[0]
fasta_file = urlparse(fasta_res.resourceId).path
ds1 = AlignmentSet(data.getXml(8),
referenceFastaFname=rs1)
aln_ref = None
for aln in ds1:
aln_ref = aln.reference()
break
self.assertTrue(aln_ref is not None)
self.assertEqual(ds1.externalResources[0].reference, fasta_file)
self.assertEqual(ds1.resourceReaders()[0].referenceFasta.filename,
fasta_file)
ds1 = AlignmentSet(data.getXml(8),
referenceFastaFname=fasta_file)
aln_ref = None
for aln in ds1:
aln_ref = aln.reference()
break
self.assertTrue(aln_ref is not None)
self.assertEqual(ds1.externalResources[0].reference, fasta_file)
self.assertEqual(ds1.resourceReaders()[0].referenceFasta.filename,
fasta_file)
ds1 = AlignmentSet(data.getXml(8))
ds1.addReference(fasta_file)
aln_ref = None
for aln in ds1:
aln_ref = aln.reference()
break
self.assertTrue(aln_ref is not None)
self.assertEqual(ds1.externalResources[0].reference, fasta_file)
self.assertEqual(ds1.resourceReaders()[0].referenceFasta.filename,
fasta_file)
fofn_out = tempfile.NamedTemporaryFile(suffix=".fofn").name
log.debug(fofn_out)
with open(fofn_out, 'w') as f:
f.write(data.getXml(8))
f.write('\n')
f.write(data.getXml(11))
f.write('\n')
ds1 = AlignmentSet(fofn_out,
referenceFastaFname=fasta_file)
aln_ref = None
for aln in ds1:
aln_ref = aln.reference()
break
self.assertTrue(aln_ref is not None)
self.assertEqual(ds1.externalResources[0].reference, fasta_file)
self.assertEqual(ds1.resourceReaders()[0].referenceFasta.filename,
fasta_file)
示例3: test_loading_reference
# 需要导入模块: from pbcore.io import AlignmentSet [as 别名]
# 或者: from pbcore.io.AlignmentSet import addReference [as 别名]
def test_loading_reference(self):
log.info('Opening Reference')
r = ReferenceSet(data.getRef()).toExternalFiles()[0]
log.info('Done Opening Reference')
log.info('Opening AlignmentSet')
d = AlignmentSet(data.getBam(), referenceFastaFname=r)
log.info('Done Opening AlignmentSet')
bfile = openIndexedAlignmentFile(data.getBam(),
referenceFastaFname=r)
self.assertTrue(bfile.isReferenceLoaded)
for res in d.resourceReaders():
self.assertTrue(res.isReferenceLoaded)
aln = AlignmentSet(data.getBam())
aln.addReference(r)
for res in aln.resourceReaders():
self.assertTrue(res.isReferenceLoaded)
示例4: loadBam
# 需要导入模块: from pbcore.io import AlignmentSet [as 别名]
# 或者: from pbcore.io.AlignmentSet import addReference [as 别名]
def loadBam(filename, referenceFname):
filename = os.path.abspath(os.path.expanduser(filename))
aln = AlignmentSet(filename)
aln.addReference(referenceFname)
return aln