本文整理汇总了Python中Bio.Seq.MutableSeq.remove方法的典型用法代码示例。如果您正苦于以下问题:Python MutableSeq.remove方法的具体用法?Python MutableSeq.remove怎么用?Python MutableSeq.remove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bio.Seq.MutableSeq
的用法示例。
在下文中一共展示了MutableSeq.remove方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestMutableSeq
# 需要导入模块: from Bio.Seq import MutableSeq [as 别名]
# 或者: from Bio.Seq.MutableSeq import remove [as 别名]
#.........这里部分代码省略.........
self.mutable_s[1:3] = array.array(array_indicator, "GAT")
self.assertEqual(MutableSeq("TGATTAAAGGATGCATCATG", IUPAC.ambiguous_dna),
self.mutable_s, "Set slice with array")
def test_setting_item(self):
self.mutable_s[3] = "G"
self.assertEqual(MutableSeq("TCAGAAGGATGCATCATG", IUPAC.ambiguous_dna),
self.mutable_s)
def test_deleting_slice(self):
del self.mutable_s[4:5]
self.assertEqual(MutableSeq("TCAAAGGATGCATCATG", IUPAC.ambiguous_dna),
self.mutable_s)
def test_deleting_item(self):
del self.mutable_s[3]
self.assertEqual(MutableSeq("TCAAAGGATGCATCATG", IUPAC.ambiguous_dna),
self.mutable_s)
def test_appending(self):
self.mutable_s.append("C")
self.assertEqual(MutableSeq("TCAAAAGGATGCATCATGC", IUPAC.ambiguous_dna),
self.mutable_s)
def test_inserting(self):
self.mutable_s.insert(4, "G")
self.assertEqual(MutableSeq("TCAAGAAGGATGCATCATG", IUPAC.ambiguous_dna),
self.mutable_s)
def test_popping_last_item(self):
self.assertEqual("G", self.mutable_s.pop())
def test_remove_items(self):
self.mutable_s.remove("G")
self.assertEqual(MutableSeq("TCAAAAGATGCATCATG", IUPAC.ambiguous_dna),
self.mutable_s, "Remove first G")
self.assertRaises(ValueError, self.mutable_s.remove, 'Z')
def test_count(self):
self.assertEqual(7, self.mutable_s.count("A"))
self.assertEqual(2, self.mutable_s.count("AA"))
def test_index(self):
self.assertEqual(2, self.mutable_s.index("A"))
self.assertRaises(ValueError, self.mutable_s.index, "8888")
def test_reverse(self):
"""Test using reverse method"""
self.mutable_s.reverse()
self.assertEqual(MutableSeq("GTACTACGTAGGAAAACT", IUPAC.ambiguous_dna),
self.mutable_s)
def test_reverse_with_stride(self):
"""Test reverse using -1 stride"""
self.assertEqual(MutableSeq("GTACTACGTAGGAAAACT", IUPAC.ambiguous_dna),
self.mutable_s[::-1])
def test_complement(self):
self.mutable_s.complement()
self.assertEqual(str("AGTTTTCCTACGTAGTAC"), str(self.mutable_s))
def test_complement_rna(self):
seq = Seq.MutableSeq("AUGaaaCUG", IUPAC.unambiguous_rna)
seq.complement()
示例2: print
# 需要导入模块: from Bio.Seq import MutableSeq [as 别名]
# 或者: from Bio.Seq.MutableSeq import remove [as 别名]
"AATCGTGGCTATTACTGGGATGGAGGTCACTGGCGCGACCACGGCTGGTGGAAACAACAT" +
"TATGAATGGCGAGGCAATCGCTGGCACCTACACGGACCGCCGCCACCGCCGCGCCACCAT" +
"AAGAAAGCTCCTCATGATCATCACGGCGGTCATGGTCCAGGCAAACATCACCGCTAA",
generic_dna)
print(gene.translate(table="Bacterial"))
print(gene.translate(table="Bacterial", cds=True))
##查看密码子表
from Bio.Data import CodonTable
standard_table = CodonTable.unambiguous_dna_by_name["Standard"]
mito_table = CodonTable.unambiguous_dna_by_id[2]
print(standard_table)
print(mito_table.start_codons)
print(mito_table.stop_codons)
print(mito_table.forward_table["ACG"])
##可变对象
from Bio.Seq import MutableSeq
mutable_seq = MutableSeq("GCCATTGTAATGGGCCGCTGAAAGGGTGCCCGA", IUPAC.unambiguous_dna)
print(mutable_seq)
mutable_seq[5] = "C"
print(mutable_seq)
mutable_seq.remove("T")
print(mutable_seq)
mutable_seq.reverse()
print(mutable_seq)
new_seq = mutable_seq.toseq()
print(new_seq)
示例3: Seq
# 需要导入模块: from Bio.Seq import MutableSeq [as 别名]
# 或者: from Bio.Seq.MutableSeq import remove [as 别名]
seq2 = Seq('ACGT',IUPAC.unambiguous_dna)
seq3 = Seq('ACGT',IUPAC.protein)
print id(seq1) == id(seq2) # seq1 == seq2 look for the same object
print str(seq1) == str(seq2) # convert to string
print str(seq1) == str(seq3) # dna similar enought to protein
#MutableSeq
from Bio.Seq import MutableSeq
mutseq = seq1.tomutable() # convert to MutableSeq
print mutseq, type(mutseq)
mutSeq = MutableSeq('CGTTTAAGCTGC',IUPAC.unambiguous_dna)
print mutSeq, type(mutSeq)
mutseq[1]='T' # imposible on simple Seq
print mutseq
seq1 = mutseq.toseq() # convert to Seq
mutSeq.remove('A') # remove first A
mutSeq[2:-5]='TTTT'
mutSeq.reverse() # reverse() and reverse_complement() change object itself
print mutSeq
#MutableSeq can't be a dictionary key, Seq and string can
#UnknownSeq
# Subclass of Seq when you know length but not the characters to save memory
from Bio.Seq import UnknownSeq
unk = UnknownSeq(25)
print unk, len(unk), type(unk)
unkDNA = UnknownSeq(20, alphabet=IUPAC.ambiguous_dna)
print unkDNA # N = any base
unkProt = UnknownSeq(10, alphabet=IUPAC.protein)
print unkProt # X = any aminoacid