Pysam操作BAM文件
Pysam包是一個(gè)處理基因組數(shù)據(jù)的python模塊,它打包了htslib-1.3、samtools-1.3 和 bcftools-1.3的核心功能竹观,能在編程時(shí)非常靈活的處理bam和bcf文件豫喧,實(shí)現(xiàn)python處理基因組數(shù)據(jù)的無縫銜接,而不用在python程序內(nèi)部調(diào)用samtools缀雳、bcftools等軟件。
>>> import pysam
>>> samfile = pysam.AlignmentFile("ex1.bam", "rb")
導(dǎo)入pysam包梢睛,samfile是一個(gè)pysam.AlignmentFile對象肥印,該對象有很多內(nèi)置方法提供后續(xù)的分析,對BAM文件的操作也基本上基于這個(gè)對象绝葡。
AlignmentFile對象內(nèi)置方法
- check_index(self)
如果index文件存在則返回True
>>> samfile.check_index()
True
- close(self)
關(guān)閉pysam.AlignmentFile - count(self深碱,contig=None, start=None, stop=None, region=None, until_eof=False, read_callback='nofilter', reference=None,end=None)
計(jì)算目標(biāo)區(qū)域內(nèi)比對上的reads數(shù)目
>>> samfile.count(contig='chr1', start=1000000, stop=1000100)
107
- count_coverage(self, contig=None, start=None, stop=None, region=None, quality_threshold=15, read_callback='all', reference=None, end=None)
計(jì)算目標(biāo)區(qū)域內(nèi)的覆蓋度藏畅。返回1個(gè)4維的array敷硅,代表ACGT的覆蓋度,而每個(gè)維度的array長度為100愉阎,里面的數(shù)字代表該堿基在各個(gè)位置上的覆蓋度绞蹦。
>>> samfile.count_coverage(contig='chr1', start=1000000, stop=1000100)
(array('L', [0, 1, 0, 0, 85, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 58, 0, 0, 0, 52, 0, 0, 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 35, 0, 0, 0, 0, 0, 0, 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 22, 1, 1, 0, 0, 20, 0, 0, 0, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]),\
array('L', [0, 0, 0, 0, 0, 0, 77, 0, 70, 0, 68, 67, 0, 58, 58, 0, 59, 0, 0, 1, 51, 49, 0, 48, 0, 0, 0, 41, 0, 0, 0, 40, 0, 0, 0, 38, 0, 0, 0, 36, 0, 0, 0, 36, 0, 0, 34, 0, 0, 0, 28, 0, 31, 0, 28, 0, 0, 25, 0, 0, 0, 21, 24, 0, 0, 0, 22, 22, 22, 22, 0, 0, 0, 0, 0, 19, 0, 0, 0, 0, 17, 20, 20, 0, 0, 17, 0, 17, 17, 0, 0, 0, 14, 15, 15, 0, 12, 0, 13, 0]), \
array('L', [94, 0, 88, 87, 0, 83, 0, 72, 0, 67, 0, 0, 61, 0, 0, 0, 0, 59, 56, 0, 0, 0, 0, 0, 46, 46, 40, 0, 41, 41, 41, 0, 0, 38, 38, 0, 36, 36, 36, 0, 36, 0, 36, 0, 34, 34, 0, 31, 0, 31, 0, 31, 0, 29, 0, 26, 25, 0, 24, 0, 1, 0, 0, 23, 0, 21, 0, 0, 0, 0, 0, 0, 20, 22, 21, 0, 19, 19, 9, 0, 0, 0, 0, 17, 19, 0, 0, 0, 0, 0, 15, 15, 0, 0, 0, 14, 0, 13, 0, 13]), \
array('L', [0, 90, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]))
- fetch(self, contig=None, start=None, stop=None, region=None, tid=None, until_eof=False, multiple_iterators=False, reference=None, end=None)
提取出比對到目標(biāo)區(qū)域內(nèi)的全部reads。返回的是一個(gè)迭代器诫硕,可以通過for循環(huán)或者next函數(shù)從中取出reads坦辟,我們使用next()函數(shù)取出第一條reads,reads是用AlignedSegment對象表示章办,可以通過該對象的內(nèi)置方法再對這條reads進(jìn)行一些查詢操作锉走。
>>> allreads=samfile.fetch(contig='chr1', start=1000000, stop=1000010)
>>> allreads
<pysam.libcalignmentfile.IteratorRowRegion object at 0x7f30451e0d48>
>>> reads1=next(allreads)
>>> reads1
<pysam.libcalignedsegment.AlignedSegment object at 0x7f30452021c8>
- find_introns(self, read_iterator)
返回一個(gè)字典{(start, stop): count},列出了reads中的intronic sites(cigar字符串中的'N') - get_index_statistics(self)
通過index統(tǒng)計(jì)該BAM文件中在各個(gè)染色體上mapped/unmapped的reads個(gè)數(shù)藕届。
>>> samfile.get_index_statistics()
[IndexStats(contig='chr1', mapped=310538, unmapped=940, total=311478), IndexStats(contig='chr2', mapped=0, unmapped=0, total=0), IndexStats(contig='chr3', mapped=0, unmapped=0, total=0), IndexStats(contig='chr4', mapped=0, unmapped=0, total=0), IndexStats(contig='chr5', mapped=0, unmapped=0, total=0), IndexStats(contig='chr6', mapped=0, unmapped=0, total=0), IndexStats(contig='chr7', mapped=0, unmapped=0, total=0), IndexStats(contig='chr8', mapped=0,unmapped=0,
total=0), IndexStats(contig='chr9', mapped=0, unmapped=0, total=0), IndexStats(contig='chr10', mapped=0, unmapped=0, total=0), IndexStats(contig='chr11', mapped=0, unmapped=0, total=0), IndexStats(contig='chr12', mapped=0, unmapped=0, total=0), IndexStats(contig='chr13', mapped=0, unmapped=0, total=0), IndexStats(contig='chr14', mapped=0, unmapped=0, total=0), IndexStats(contig='chr15', mapped=0, unmapped=0, total=0), IndexStats(contig='chr16', mapped=0, unmapped=0, total=0), IndexStats(contig='chr17', mapped=0, unmapped=0, total=0), IndexStats(contig='chr18', mapped=0, unmapped=0, total=0), IndexStats(contig='chr19', mapped=0, unmapped=0, total=0), IndexStats(contig='chr20', mapped=0, unmapped=0, total=0), IndexStats(contig='chr21', mapped=0, unmapped=0, total=0), IndexStats(contig='chr22', mapped=0, unmapped=0, total=0), IndexStats(contig='chrX', mapped=0, unmapped=0, total=0), IndexStats(contig='chrY', mapped=0, unmapped=0, total=0), IndexStats(contig='chrM', mapped=0, unmapped=0, total=0)]
- get_reference_name(self, tid)
得到tid(數(shù)字)相對應(yīng)的reference name(字符串)挪蹭,例如在這個(gè)BAM中tid為0代表chr1,tid為1代表chr2休偶,tid為24代表chrM梁厉。
>>> samfile.get_reference_name(0)
'chr1'
>>> samfile.get_reference_name(1)
'chr2'
>>> samfile.get_reference_name(24)
'chrM'
- get_tid(self, reference)
相似的,將reference轉(zhuǎn)換成tid
>>> samfile.get_tid('chr2')
1
- has_index(self)
如果hts文件存在打開的index文件則返回True踏兜。 - head(self, n, multiple_iterators=True)
返回含有前n個(gè)比對reads的迭代器词顾,常用于檢查bam文件。 - header
得到BAM文件的頭文件碱妆,用字典表示肉盹。 - is_valid_tid(self, tid)
判斷這個(gè)tid是否存在(合法),若存在則返回True疹尾。 - lengths
返回各個(gè)reference的長度的一個(gè)元組上忍。 - mapped
返回比對的上(mapped)的reads個(gè)數(shù)骤肛。 - unmapped
返回未比對的上(unmapped)的reads個(gè)數(shù)。 - mate(self, AlignedSegment read)
返回傳入的AlignedSegment read的另一配對reads(mate reads)窍蓝。
>>> reads1
<pysam.libcalignedsegment.AlignedSegment object at 0x7f30452021c8>
>>> samfile.mate(reads1)
<pysam.libcalignedsegment.AlignedSegment object at 0x7f3045202228>
- nocoordinate
通過index文件統(tǒng)計(jì)沒有比對坐標(biāo)的reads數(shù)目 - nreferences
返回reference的個(gè)數(shù) - pileup(self, contig=None, start=None, stop=None, region=None, reference=None, end=None, **kwargs)
類似于samtools的pileup操作腋颠,返回一個(gè)迭代器,每次迭代返回一個(gè)位點(diǎn)的PileupColumn對象,該對象的操作在后面進(jìn)行詳細(xì)介紹吓笙。
>>> pileupcolumn = samfile.pileup("chr1", 999863, 999865,truncate=True)
>>> pileupcolumn
<pysam.libcalignmentfile.IteratorColumnRegion object at 0x7f3048609648>
>>> pc=next(pileupcolumn)
>>> pc
<pysam.libcalignedsegment.PileupColumn object at 0x7f30518e8948>
- references
得到所有的reference name淑玫。
>>> samfile.references
('chr1', 'chr2', 'chr3', 'chr4', 'chr5', 'chr6', 'chr7', 'chr8', 'chr9', 'chr10', 'chr11', 'chr12', 'chr13', 'chr14', 'chr15', 'chr16', 'chr17', 'chr18', 'chr19', 'chr20', 'chr21', 'chr22', 'chrX', 'chrY', 'chrM')
- text
得到字符串類型的BAM header信息 - write(self, AlignedSegment read) → int
向samfile中寫入信息(AlignedSegment格式reads)
AlignedSegmennt對象內(nèi)置方法
該對象代表了某個(gè)比對上的segment。使用以下的內(nèi)置方法屬性來查詢操作這個(gè)segment观蓄。
- bin
不知道什么意思 - cigarstring
該segment的cigar混移,同bam文件中一個(gè)segment記錄的cigar字段,字符串格式祠墅。
>>> reads1.cigarstring
'151M'
- cigartuples
cigar記錄的元組格式侮穿,下面的例子就代表了151M(0 代表 M)。
>>> reads1.cigartuples
[(0, 151)]
alignment | meaning | operation |
---|---|---|
M | BAM_CMATCH | 0 |
I | BAM_CINS | 1 |
D | BAM_CDEL | 2 |
N | BAM_CREF_SKIP | 3 |
S | BAM_CSOFT_CLIP | 4 |
H | BAM_CHARD_CLIP | 5 |
P | BAM_CPAD | 6 |
= | BAM_CEQUAL | 7 |
X | BAM_CDIFF | 8 |
B | BAM_CBACK | 9 |
- compare(self, AlignedSegment other)
和其他AlignedSegment比較毁嗦,值為兩個(gè)segment在reference上坐標(biāo)差值
>>> reads1.compare(reads2)
-17
- flag
返回該segment的flag信息 - get_aligned_pairs(self, matches_only=False, with_seq=False)
展示了query和reference之間的比對情況亲茅,如果遇到indel或者skipping的情況,相應(yīng)的query或者reference會變?yōu)镹one
>>> reads1.get_aligned_pairs(matches_only=False, with_seq=True)
[(0, 999850, 'C'), (1, 999851, 'G'), (2, 999852, 'G'), (3, 999853, 'C'), (4, 999854, 'C'), (5, 999855, 'G'), (6, 999856, 'G'), (7, 999857, 'G'), (8, 999858, 'A'), (9, 999859, 'C'), (10, 999860, 'C'), (11, 999861, 'C'), (12, 999862, 'C'), (13, 999863, 'A'), (14, 999864, 'C'), (15, 999865, 'C'), (16, 999866, 'T'), (17, 999867, 'T'), (18, 999868, 'G'), (19, 999869, 'C'), (20, 999870, 'G'), (21, 999871, 'G'), (22, 999872, 'T'), (23, 999873, 'G'), (24, 999874, 'C'), (25, 999875, 'T'), (26, 999876, 'C'), (27, 999877, 'G'), (28, 999878, 'G'), (29, 999879, 'C'), (30, 999880, 'C'), (31, 999881, 'G'), (32, 999882, 'C'), (33, 999883, 'G'), (34, 999884, 'C'), (35, 999885, 'T'), (36, 999886, 'C'), (37, 999887, 'C'), (38, 999888, 'G'), (39, 999889, 'G'), (40, 999890, 'G'), (41, 999891, 'G'), (42, 999892, 'C'), (43, 999893, 'T'), (44, 999894, 'T'), (45, 999895, 'G'), (46, 999896, 'T'), (47, 999897, 'C'), (48, 999898, 'T'), (49, 999899, 'G'), (50, 999900, 'G'), (51, 999901, 'G'), (52, 999902, 'G'), (53, 999903, 'T'), (54, 999904, 'C'), (55, 999905, 'C'), (56, 999906, 'G'), (57, 999907, 'G'), (58, 999908, 'C'), (59, 999909, 'T'), (60, 999910, 'G'), (61, 999911, 'G'), (62, 999912, 'C'), (63, 999913, 'G'), (64, 999914, 'C'), (65, 999915, 'T'), (66, 999916, 'G'), (67, 999917, 'G'), (68, 999918, 'C'), (69, 999919, 'C'), (70, 999920, 'G'), (71, 999921, 'G'), (72, 999922, 'C'), (73, 999923, 'G'), (74, 999924, 'C'), (75, 999925, 'T'), (76, 999926, 'C'), (77, 999927, 'C'), (78, 999928, 'T'), (79, 999929, 'G'), (80, 999930, 'C'), (81, 999931, 'C'), (82, 999932, 'A'), (83, 999933, 'T'), (84, 999934, 'C'), (85, 999935, 'G'), (86, 999936, 'G'), (87, 999937, 'C'), (88, 999938, 'G'), (89, 999939, 'A'), (90, 999940, 'G'), (91, 999941, 'G'), (92, 999942, 'C'), (93, 999943, 'G'), (94, 999944, 'C'), (95, 999945, 'T'), (96, 999946, 'C'), (97, 999947, 'G'), (98, 999948, 'G'), (99, 999949, 'T'), (100, 999950, 'T'), (101, 999951, 'T'), (102, 999952, 'C'), (103, 999953, 'C'), (104, 999954, 'C'), (105, 999955, 'C'), (106, 999956, 'G'), (107, 999957, 'G'), (108, 999958, 'C'), (109, 999959, 'G'), (110, 999960, 'T'), (111, 999961, 'G'), (112, 999962, 'T'), (113, 999963, 'C'), (114, 999964, 'T'), (115, 999965, 'G'), (116, 999966, 'C'), (117, 999967, 'G'), (118, 999968, 'G'), (119, 999969, 'C'), (120, 999970, 'C'), (121, 999971, 'A'), (122, 999972, 'T'), (123, 999973, 'G'), (124, 999974, 'G'), (125, 999975, 'T'), (126, 999976, 'G'), (127, 999977, 'C'), (128, 999978, 'G'), (129, 999979, 'C'), (130, 999980, 'C'), (131, 999981, 'C'), (132, 999982, 'C'), (133, 999983, 'G'), (134, 999984, 'C'), (135, 999985, 'G'), (136, 999986, 'C'), (137, 999987, 'C'), (138, 999988, 'T'), (139, 999989, 'C'), (140, 999990, 'C'), (141, 999991, 'C'), (142, 999992, 'C'), (143, 999993, 'G'), (144, 999994, 'T'), (145, 999995, 'G'), (146, 999996, 'C'), (147, 999997, 'C'), (148, 999998, 'G'), (149, 999999, 'G'), (150, 1000000, 'G')]
- get_blocks(self)
返回該segment比對到reference的start和end坐標(biāo)狗准。 - get_cigar_stats(self)
同樣返回cigar信息克锣,不過是兩個(gè)arrays的形式。
>>> reads1.get_cigar_stats()
(array('I', [151, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), array('I', [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]))
>>> reads2.get_cigar_stats()
(array('I', [151, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), array('I', [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]))
>>> reads3.get_cigar_stats()
(array('I', [134, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0]), array('I', [1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0]))
- get_overlap(self, uint32_t start, uint32_t end)
返回和reference傳入?yún)?shù)區(qū)域內(nèi)比對上的堿基數(shù)
>>> reads1.get_blocks()
[(999850, 1000001)]
>>> reads1.get_overlap(999950, 1000010)
51
- get_reference_positions(self, full_length=False)
返回和reference比對上的位置列表腔长,數(shù)值為ref上的位置 - get_reference_sequence(self)
返回該reads比對到的ref區(qū)域的reference堿基袭祟。
>>> reads1.get_reference_sequence()
'CGGCCGGGACCCCACCTTGCGGTGCTCGGCCGCGCTCCGGGGCTTGTCTGGGGTCCGGCTGGCGCTGGCCGGCGCTCCTGCCATCGGCGAGGCGCTCGGTTTCCCCGGCGTGTCTGCGGCCATGGTGCGCCCCGCGCCTCCCCGTGCCGGG'
- get_tags(self, with_value_type=False)
得到該segment的tag信息
>>> reads1.get_tags()
[('MC', '151M'), ('BD', 'MMMOQNNKOPNJJNKMNLMOKLNKOOMMLNNKNKNOMNKLIINPMNLPNPOJJOPOLMOPPOOLOPPOOOLMOLOPNONPPOOPQNMOLPOPOLOPNNMONDNOKKLMOLPLLPNPPLMOOOPPOOLPLOOKKLOLOPPOPLLNRNROLMJ'), ('MD', '151'), ('PG', 'MarkDuplicates.H'), ('RG', 'group1'), ('BI', 'OOPQQOQLRRPKKQNOQOPQNOPNQQNOPPONQOQROPNPLLQRPQOSQSQLLQSPNPQRSQQOQRSQQPNPQOQRPPRSRPRQRPPQOSRQQPRSOPPQPHRPLLNQRPRPPTRTSPQRQSRSRRPSPRQMMORPRQSPQMMOQQTPNPL'), ('NM', 0), ('MQ', 60), ('AS', 151), ('XS', 0)]
- get_tag(self, tag, with_value_type=False)
查詢某個(gè)tag的值
>>> reads1.get_tag( 'MC')
'151M'
- has_tag(self, tag)
查詢是否有某個(gè)tag值,若有則返回True捞附。 - infer_query_length(self, always=False)
通過CIGAR推斷query的長度巾乳,不包括hard-clipped區(qū)域堿基 - infer_reads_length(self)
通過CIGAR推斷reads的長度,包括hard-clipped區(qū)域堿基 - is_duplicate
判斷是否是PCR duplicate - is_paired
判斷reads是不是成對的 - is_proper_pair
判斷reads對是否都比對上了 - is_qcfail
判斷是否QC失敗了 - is_read1
判斷是否是read1 - is_read2
判斷是否是read2 - is_reverse
判斷是否比對到了ref的負(fù)義鏈上 - is_secondary
若不是primary比對則返回true - is_supplementary
判斷是否是supplementary比對 - is_unmapped
判斷是否沒比對上 - mapping_quality
比對質(zhì)量 - mate_is_reverse
配對reads是否比對到負(fù)義鏈 - mate_is_unmapped
配對reads是否沒比對上 - next_reference_id
配對reads比對上的reference id - next_refernece_name
配對reads比對上的reference name - next_reference_start
配對reads比對在reference的起始位置 - query_alignment_end
query比對上ref的結(jié)束位置鸟召,數(shù)值為query上的相對位置
>>> reads1.query_alignment_end
151
- query_alignment_start
query比對上ref的起始位置胆绊,數(shù)值為query上的相對位置 - query_alignment_length
相當(dāng)于query_alignment_end-query_alignment_start - query_alignment_qualities
query比對上ref的堿基的質(zhì)量值
>>> reads1.query_alignment_qualities
array('B', [28, 26, 29, 34, 33, 28, 32, 32, 29, 35, 34, 34, 34, 30, 35, 34, 35, 30, 37, 37, 29, 32, 28, 37, 37, 35, 36, 29, 32, 37, 34, 29, 37, 29, 37, 35, 36, 34, 29, 32, 32, 32, 37, 35, 30, 37, 28, 36, 35, 37, 32, 32, 32, 28, 36, 34, 29, 32, 37, 35, 37, 32, 37, 29, 37, 35, 37, 32, 37, 34, 29, 32, 37, 29, 37, 35, 36, 34, 35, 37, 37, 34, 30, 28, 36, 29, 32, 37, 29, 14, 37, 32, 37, 29, 37, 35, 36, 29, 32, 28, 30, 30, 36, 34, 34, 34, 29, 32, 37, 29, 28, 37, 28, 36, 35, 37, 37, 29, 32, 37, 34, 30, 28, 37, 32, 28, 37, 37, 29, 37, 34, 34, 34, 29, 37, 29, 37, 34, 35, 36, 34, 34, 34, 29, 28, 36, 35, 30, 23, 26, 26])
- query_alignment_sequence
query比對上ref的堿基 - query_length
query的長度 - query_name
query的名字 - query_qualities
query的堿基質(zhì)量值,這個(gè)和query_alignment_qualities不一樣欧募,query_alignment_qualities為query比對上那部分序列的堿基質(zhì)量值压状,若存在soft-clip,query_alignment_qualities的堿基質(zhì)量值個(gè)數(shù)會少相應(yīng)的部分跟继。 - query_sequence
query堿基序列 - reference_id
比對上的reference ID - reference_name
比對上的reference name - reference_length
和reference能比對上的序列的長度 - reference_start
和reference能比對上部分的起始坐標(biāo)(reference坐標(biāo)) - set_tag(self, tag, value, value_type=None, replace=True)
設(shè)定tag值 - set_tags(self, tags)
重新設(shè)定tag
PileupColumn對象內(nèi)置方法
之前說到AlignmentFile對象使用pileup方法產(chǎn)生一個(gè)存儲了PileupColumn對象的迭代器种冬,這個(gè)PileupColumn對象就代表了某個(gè)位點(diǎn)上的pileup結(jié)果。通過PileupColumn對象的內(nèi)置方法我們可以得到更多的信息舔糖。
- nsegments
在這個(gè)pileupcolumn上比對上的segment個(gè)數(shù) - pileups
返回一個(gè)列表娱两,列表中的元素為PuleupRead對象
>>> pr=pc.pileups
>>> pr1 = pr[0]
>>> pr1
<pysam.libcalignedsegment.PileupRead object at 0x7f30449c5f98>
- reference_id
- reference_name
- reference_pos
這個(gè)pileupcolumn在ref上的位置
PileupRead對象內(nèi)置方法
代表了比對到ref某個(gè)位置的reads。
- alignment
返回一個(gè)AlignedSegment對象
>>> pr1.alignment
<pysam.libcalignedsegment.AlignedSegment object at 0x7f30452022e8>
- indel
后面的堿基是否處在indel上剩盒,若在insertion上則返回正數(shù)谷婆,數(shù)值為insertion長度慨蛙,若在deltion上則為負(fù)數(shù),數(shù)值為deltion長度纪挎。 - is_del
此位點(diǎn)的堿基是否處在deltion上期贫,若是則返回1,不是則返回0异袄。 - id_head
此位點(diǎn)的堿基是否是比對上的第一個(gè)堿基通砍,若是則返回1,不是則返回0烤蜕。 - is_refskip
此位點(diǎn)的堿基是否是CIGAR N堿基封孙,若是則返回1,不是則返回0讽营。 - is_tail
此位點(diǎn)的堿基是否是比對上的最后一個(gè)堿基虎忌,若是則返回1,不是則返回0橱鹏。 - level
the level of the read in the “viewer” mode. Note that this value is currently not computed. - query_position
該堿基位點(diǎn)在query上的位置膜蠢,0代表第一個(gè)。若處在deltion上或者是refskip則返回None莉兰。 - query_position_or_next
同上挑围,但是如果此位點(diǎn)是deltion則返回下一個(gè)堿基的位置。