diff 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
line wrap: on
line diff
--- a/small_rna_maps.py	Tue Dec 25 06:02:08 2018 -0500
+++ b/small_rna_maps.py	Sun Mar 31 20:58:21 2019 -0400
@@ -146,15 +146,33 @@
                 accumulator = []
                 for coor in F_clust_dic[centcoor]:
                     accumulator.extend(map_dic[(chrom, coor, 'F')])
+                '''
+                compute the offset of the cluster due to
+                size of reads
+                '''
+                last = sorted(F_clust_dic[centcoor])[-1]
+                try:
+                    margin = max(map_dic[(chrom, last, 'F')]) - 1
+                except ValueError:
+                    margin = 0
                 clustered_dic[(chrom, centcoor, 'F')] = [len(accumulator), [
                     F_clust_dic[centcoor][0],
-                    F_clust_dic[centcoor][-1]]]
+                    F_clust_dic[centcoor][-1] + margin]]
             for centcoor in R_clust_dic:
                 accumulator = []
                 for coor in R_clust_dic[centcoor]:
                     accumulator.extend(map_dic[(chrom, coor, 'R')])
+                '''
+                compute the offset of the cluster due to
+                size of reads
+                '''
+                first = sorted(R_clust_dic[centcoor])[0]
+                try:
+                    margin = max(map_dic[(chrom, first, 'R')]) - 1
+                except ValueError:
+                    margin = 0
                 clustered_dic[(chrom, centcoor, 'R')] = [len(accumulator), [
-                    R_clust_dic[centcoor][0],
+                    R_clust_dic[centcoor][0] - margin,
                     R_clust_dic[centcoor][-1]]]
         return clustered_dic