comparison small_rna_maps.py @ 24:e75a10eba0a6 draft

planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_maps commit 0293b0f9b07302ba0b71e7877be1ea7a7ed04718
author artbio
date Sun, 31 Mar 2019 20:58:21 -0400
parents de7fbcb1348c
children 07aa8f928d4b
comparison
equal deleted inserted replaced
23:3ca8113cc758 24:e75a10eba0a6
144 R_clust_dic = dict(zip(R_clust_keys, R_clust_values)) 144 R_clust_dic = dict(zip(R_clust_keys, R_clust_values))
145 for centcoor in F_clust_dic: 145 for centcoor in F_clust_dic:
146 accumulator = [] 146 accumulator = []
147 for coor in F_clust_dic[centcoor]: 147 for coor in F_clust_dic[centcoor]:
148 accumulator.extend(map_dic[(chrom, coor, 'F')]) 148 accumulator.extend(map_dic[(chrom, coor, 'F')])
149 '''
150 compute the offset of the cluster due to
151 size of reads
152 '''
153 last = sorted(F_clust_dic[centcoor])[-1]
154 try:
155 margin = max(map_dic[(chrom, last, 'F')]) - 1
156 except ValueError:
157 margin = 0
149 clustered_dic[(chrom, centcoor, 'F')] = [len(accumulator), [ 158 clustered_dic[(chrom, centcoor, 'F')] = [len(accumulator), [
150 F_clust_dic[centcoor][0], 159 F_clust_dic[centcoor][0],
151 F_clust_dic[centcoor][-1]]] 160 F_clust_dic[centcoor][-1] + margin]]
152 for centcoor in R_clust_dic: 161 for centcoor in R_clust_dic:
153 accumulator = [] 162 accumulator = []
154 for coor in R_clust_dic[centcoor]: 163 for coor in R_clust_dic[centcoor]:
155 accumulator.extend(map_dic[(chrom, coor, 'R')]) 164 accumulator.extend(map_dic[(chrom, coor, 'R')])
165 '''
166 compute the offset of the cluster due to
167 size of reads
168 '''
169 first = sorted(R_clust_dic[centcoor])[0]
170 try:
171 margin = max(map_dic[(chrom, first, 'R')]) - 1
172 except ValueError:
173 margin = 0
156 clustered_dic[(chrom, centcoor, 'R')] = [len(accumulator), [ 174 clustered_dic[(chrom, centcoor, 'R')] = [len(accumulator), [
157 R_clust_dic[centcoor][0], 175 R_clust_dic[centcoor][0] - margin,
158 R_clust_dic[centcoor][-1]]] 176 R_clust_dic[centcoor][-1]]]
159 return clustered_dic 177 return clustered_dic
160 178
161 def compute_readcount(self, map_dictionary, out): 179 def compute_readcount(self, map_dictionary, out):
162 ''' 180 '''