Python SequenceCollection.ids方法代碼示例- 純淨天空
文章推薦指數: 80 %
本文整理匯總了Python中skbio.core.alignment.SequenceCollection.ids方法的典型用法代碼示例。
如果您正苦於以下問題:Python SequenceCollection.ids方法的具體用法?
當前位置:首頁>>代碼示例>>Python>>正文
本文整理匯總了Python中skbio.core.alignment.SequenceCollection.ids方法的典型用法代碼示例。
如果您正苦於以下問題:PythonSequenceCollection.ids方法的具體用法?PythonSequenceCollection.ids怎麽用?PythonSequenceCollection.ids使用的例子?那麽恭喜您,這裏精選的方法代碼示例或許可以為您提供幫助。
您也可以進一步了解該方法所在類skbio.core.alignment.SequenceCollection的用法示例。
在下文中一共展示了SequenceCollection.ids方法的1個代碼示例,這些例子默認根據受歡迎程度排序。
您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於我們的係統推薦出更棒的Python代碼示例。
示例1:SequenceCollectionTests
點讚6
#需要導入模塊:fromskbio.core.alignmentimportSequenceCollection[as別名]
#或者:fromskbio.core.alignment.SequenceCollectionimportids[as別名]
classSequenceCollectionTests(TestCase):
"""TestsoftheSequenceCollectionclass"""
defsetUp(self):
"""Initializevaluestobeusedintests
"""
self.d1=DNASequence('GATTACA',id="d1")
self.d2=DNASequence('TTG',id="d2")
self.d1_lower=DNASequence('gattaca',id="d1")
self.d2_lower=DNASequence('ttg',id="d2")
self.r1=RNASequence('GAUUACA',id="r1")
self.r2=RNASequence('UUG',id="r2")
self.r3=RNASequence('U-----UGCC--',id="r3")
self.i1=DNASequence('GATXACA',id="i1")
self.seqs1=[self.d1,self.d2]
self.seqs1_lower=[self.d1_lower,self.d2_lower]
self.seqs2=[self.r1,self.r2,self.r3]
self.seqs3=self.seqs1+self.seqs2
self.seqs1_t=[('d1','GATTACA'),('d2','TTG')]
self.seqs2_t=[('r1','GAUUACA'),('r2','UUG'),
('r3','U-----UGCC--')]
self.seqs3_t=self.seqs1_t+self.seqs2_t
self.s1=SequenceCollection(self.seqs1)
self.s1_lower=SequenceCollection(self.seqs1_lower)
self.s2=SequenceCollection(self.seqs2)
self.s3=SequenceCollection(self.seqs3)
self.empty=SequenceCollection([])
self.invalid_s1=SequenceCollection([self.i1])
deftest_init(self):
"""Initializationfunctionsasexpectedwithvariedinputtypes
"""
SequenceCollection(self.seqs1)
SequenceCollection(self.seqs2)
SequenceCollection(self.seqs3)
SequenceCollection([])
deftest_init_fail(self):
"""initializationwithsequenceswithoverlappingidsfails
"""
s1=[self.d1,self.d1]
self.assertRaises(SequenceCollectionError,SequenceCollection,s1)
deftest_init_validate(self):
"""initializationwithvalidationfunctionsasexpected
"""
SequenceCollection(self.seqs1,validate=True)
SequenceCollection(self.seqs1,validate=True)
#can'tvalidateself.seqs2asaDNASequence
self.assertRaises(SequenceCollectionError,SequenceCollection,
self.invalid_s1,validate=True)
deftest_from_fasta_records(self):
"""Initializationfromlistoftuplesfunctionsasexpected
"""
SequenceCollection.from_fasta_records(self.seqs1_t,DNASequence)
SequenceCollection.from_fasta_records(self.seqs2_t,RNASequence)
SequenceCollection.from_fasta_records(self.seqs3_t,NucleotideSequence)
deftest_contains(self):
"""inoperatorfunctionsasexpected
"""
self.assertTrue('d1'inself.s1)
self.assertTrue('r2'inself.s2)
self.assertFalse('r2'inself.s1)
deftest_eq(self):
"""equalityoperatorfunctionsasexpected
"""
self.assertTrue(self.s1==self.s1)
self.assertFalse(self.s1==self.s2)
#differentobjectscanbeequal
self.assertTrue(self.s1==SequenceCollection([self.d1,self.d2]))
self.assertTrue(SequenceCollection([self.d1,self.d2])==self.s1)
#SequenceCollectionswithdifferentnumberofsequencesarenotequal
self.assertFalse(self.s1==SequenceCollection([self.d1]))
classFakeSequenceCollection(SequenceCollection):
pass
#SequenceCollectionsofdifferenttypesarenotequal
self.assertFalse(self.s1==FakeSequenceCollection([self.d1,self.d2]))
self.assertFalse(self.s1==Alignment([self.d1,self.d2]))
#SequenceCollectionswithdifferentsequencesarenotequal
self.assertFalse(self.s1==SequenceCollection([self.d1,self.r1]))
deftest_getitem(self):
"""getitemfunctionsasexpected
"""
self.assertEqual(self.s1[0],self.d1)
self.assertEqual(self.s1[1],self.d2)
self.assertEqual(self.s2[0],self.r1)
self.assertEqual(self.s2[1],self.r2)
#.........這裏部分代碼省略.........
開發者ID:BANSHEE-,項目名稱:scikit-bio,代碼行數:103,代碼來源:test_alignment.py
注:本文中的skbio.core.alignment.SequenceCollection.ids方法示例整理自Github/MSDocs等源碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。
相關方法
SequenceCollection.from_fasta_records
SequenceCollection.to_fasta
SequenceCollection.degap
SequenceCollection.iteritems
SequenceCollection.toFasta
SequenceCollection.sequence_lengths
SequenceCollection.sequence_count
SequenceCollection.lower
SequenceCollection.k_word_frequencies
SequenceCollection.is_valid
SequenceCollection.distances
SequenceCollection.is_empty
SequenceCollection.int_map
SequenceCollection.ids
SequenceCollection.identifiers
SequenceCollection.get_seq
SequenceCollection.distribution_stats
SequenceCollection.upper
延伸文章資訊
- 1Python id() 函数 - 菜鸟教程
Python id() 函数Python 内置函数描述id() 函数返回对象的唯一标识符,标识符是一个整数。 CPython 中id() 函数用于获取对象的内存地址。 语法id 语法: id([...
- 2ncsuarc/ids: Interface for IDS machine vision cameras - GitHub
A module for interfacing with IDS Imaging machine vision cameras. This module wraps the IDS uEye ...
- 3IDS Cameras: Pyueye python package set exposure ...
When I use the IDS GUI software and flip on auto exposure, things look great. But when I try to d...
- 4Configure Mono12 mode at IDS camera via python uEye
- 5Minimal python example to capture frames with an IDS uEye ...