HTSeq 2.1.2__cp310-cp310-macosx_10_15_x86_64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- HTSeq/StepVector.py +629 -0
- HTSeq/StretchVector.py +491 -0
- HTSeq/_HTSeq.cpython-310-darwin.so +0 -0
- HTSeq/_HTSeq_internal.py +85 -0
- HTSeq/_StepVector.cpython-310-darwin.so +0 -0
- HTSeq/__init__.py +1249 -0
- HTSeq/features.py +489 -0
- HTSeq/scripts/__init__.py +0 -0
- HTSeq/scripts/count.py +528 -0
- HTSeq/scripts/count_features/__init__.py +0 -0
- HTSeq/scripts/count_features/count_features_per_file.py +465 -0
- HTSeq/scripts/count_features/reads_io_processor.py +187 -0
- HTSeq/scripts/count_features/reads_stats.py +92 -0
- HTSeq/scripts/count_with_barcodes.py +746 -0
- HTSeq/scripts/qa.py +336 -0
- HTSeq/scripts/utils.py +372 -0
- HTSeq/utils.py +92 -0
- htseq-2.1.2.dist-info/METADATA +813 -0
- htseq-2.1.2.dist-info/RECORD +23 -0
- htseq-2.1.2.dist-info/WHEEL +5 -0
- htseq-2.1.2.dist-info/entry_points.txt +4 -0
- htseq-2.1.2.dist-info/licenses/LICENSE +674 -0
- htseq-2.1.2.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import HTSeq
|
|
2
|
+
import sys
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class ReadsStatistics(object):
|
|
6
|
+
"""
|
|
7
|
+
For storing the read counts
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
def __init__(self, feature_attr, read_io_object):
|
|
11
|
+
'''Initialize storage for the read counts
|
|
12
|
+
|
|
13
|
+
Args:
|
|
14
|
+
feature_attr (list of str): Feature names
|
|
15
|
+
read_io_object (ReadsIO): Read processor
|
|
16
|
+
'''
|
|
17
|
+
self.read_io_obj = read_io_object
|
|
18
|
+
|
|
19
|
+
self.empty = 0
|
|
20
|
+
self.ambiguous = 0
|
|
21
|
+
self.notaligned = 0
|
|
22
|
+
self.lowqual = 0
|
|
23
|
+
self.nonunique = 0
|
|
24
|
+
self.num_reads_processed = 0
|
|
25
|
+
self.counts = {key: 0 for key in feature_attr}
|
|
26
|
+
|
|
27
|
+
def add_num_reads_processed(self):
|
|
28
|
+
self.num_reads_processed += 1
|
|
29
|
+
|
|
30
|
+
def add_empty_read(self, read_sequence):
|
|
31
|
+
self.empty += 1
|
|
32
|
+
self.read_io_obj.write_to_samout(read_sequence, "__no_feature")
|
|
33
|
+
|
|
34
|
+
def add_ambiguous_read(self, read_sequence, assignment):
|
|
35
|
+
self.ambiguous += 1
|
|
36
|
+
self.read_io_obj.write_to_samout(read_sequence, assignment)
|
|
37
|
+
|
|
38
|
+
def add_low_quality_read(self, read_sequence):
|
|
39
|
+
self.lowqual += 1
|
|
40
|
+
self.read_io_obj.write_to_samout(read_sequence, "__too_low_aQual")
|
|
41
|
+
|
|
42
|
+
def add_not_unique_read(self, read_sequence):
|
|
43
|
+
self.nonunique += 1
|
|
44
|
+
self.read_io_obj.write_to_samout(read_sequence, "__alignment_not_unique")
|
|
45
|
+
|
|
46
|
+
def add_not_aligned_read(self, read_sequence):
|
|
47
|
+
self.notaligned += 1
|
|
48
|
+
self.read_io_obj.write_to_samout(read_sequence, "__not_aligned")
|
|
49
|
+
|
|
50
|
+
def add_to_count(self, feature, value=1):
|
|
51
|
+
self.counts[feature] += value
|
|
52
|
+
|
|
53
|
+
def add_good_read_assignment(self, read_sequence, assignment):
|
|
54
|
+
self.read_io_obj.write_to_samout(read_sequence, assignment)
|
|
55
|
+
|
|
56
|
+
def print_progress(self, force_print=False):
|
|
57
|
+
"""
|
|
58
|
+
Simple function to update the progress of reads processing.
|
|
59
|
+
Parameters
|
|
60
|
+
----------
|
|
61
|
+
force_print : boolean
|
|
62
|
+
Whether to print progress regardless of number of reads processed
|
|
63
|
+
or not.
|
|
64
|
+
"""
|
|
65
|
+
|
|
66
|
+
if force_print:
|
|
67
|
+
do_print = True
|
|
68
|
+
else:
|
|
69
|
+
do_print = (
|
|
70
|
+
self.num_reads_processed > 0 and self.num_reads_processed % 100000 == 0
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
if do_print:
|
|
74
|
+
sys.stderr.write(
|
|
75
|
+
"%d alignment record%s processed.\n"
|
|
76
|
+
% (
|
|
77
|
+
self.num_reads_processed,
|
|
78
|
+
"s" if not self.read_io_obj.pe_mode else " pairs",
|
|
79
|
+
)
|
|
80
|
+
)
|
|
81
|
+
sys.stderr.flush()
|
|
82
|
+
|
|
83
|
+
def get_output(self, isam):
|
|
84
|
+
return {
|
|
85
|
+
"isam": isam,
|
|
86
|
+
"counts": self.counts,
|
|
87
|
+
"empty": self.empty,
|
|
88
|
+
"ambiguous": self.ambiguous,
|
|
89
|
+
"lowqual": self.lowqual,
|
|
90
|
+
"notaligned": self.notaligned,
|
|
91
|
+
"nonunique": self.nonunique,
|
|
92
|
+
}
|