diff small_rna_maps.py @ 4:a6b9a081064b draft

planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_maps commit b58cb36616bf351278e57ec1949e9ebf3c3cdff1
author artbio
date Fri, 25 Aug 2017 12:22:03 -0400
parents ed8b0142538d
children 12c14642e6ac
line wrap: on
line diff
--- a/small_rna_maps.py	Tue Aug 22 12:05:47 2017 -0400
+++ b/small_rna_maps.py	Fri Aug 25 12:22:03 2017 -0400
@@ -44,9 +44,6 @@
         for chrom in self.chromosomes:
             for read in bam_object.fetch(chrom):
                 positions = read.positions  # a list of covered positions
-                for pos in positions:
-                    if not map_dictionary[(chrom, pos+1, 'F')]:
-                        map_dictionary[(chrom, pos+1, 'F')] = []
                 if read.is_reverse:
                     map_dictionary[(chrom, positions[-1]+1,
                                     'R')].append(read.query_alignment_length)
@@ -120,6 +117,11 @@
         for chrom in self.chromosomes:
             coverage_dictionary[(chrom, 1, 'F')] = 0
             coverage_dictionary[(chrom, self.chromosomes[chrom], 'F')] = 0
+            for read in self.bam_object.fetch(chrom):
+                positions = read.positions  # a list of covered positions
+                for pos in positions:
+                    if not map_dictionary[(chrom, pos+1, 'F')]:
+                        map_dictionary[(chrom, pos+1, 'F')] = []
         for key in map_dictionary:
             coverage = self.bam_object.count_coverage(
                                                 reference=key[0],