Mercurial > repos > artbio > small_rna_maps
comparison 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 |
comparison
equal
deleted
inserted
replaced
3:ed8b0142538d | 4:a6b9a081064b |
---|---|
42 map_dictionary[(chrom, 1, 'F')] = [] | 42 map_dictionary[(chrom, 1, 'F')] = [] |
43 map_dictionary[(chrom, self.chromosomes[chrom], 'F')] = [] | 43 map_dictionary[(chrom, self.chromosomes[chrom], 'F')] = [] |
44 for chrom in self.chromosomes: | 44 for chrom in self.chromosomes: |
45 for read in bam_object.fetch(chrom): | 45 for read in bam_object.fetch(chrom): |
46 positions = read.positions # a list of covered positions | 46 positions = read.positions # a list of covered positions |
47 for pos in positions: | |
48 if not map_dictionary[(chrom, pos+1, 'F')]: | |
49 map_dictionary[(chrom, pos+1, 'F')] = [] | |
50 if read.is_reverse: | 47 if read.is_reverse: |
51 map_dictionary[(chrom, positions[-1]+1, | 48 map_dictionary[(chrom, positions[-1]+1, |
52 'R')].append(read.query_alignment_length) | 49 'R')].append(read.query_alignment_length) |
53 else: | 50 else: |
54 map_dictionary[(chrom, positions[0]+1, | 51 map_dictionary[(chrom, positions[0]+1, |
118 ''' | 115 ''' |
119 coverage_dictionary = dict() | 116 coverage_dictionary = dict() |
120 for chrom in self.chromosomes: | 117 for chrom in self.chromosomes: |
121 coverage_dictionary[(chrom, 1, 'F')] = 0 | 118 coverage_dictionary[(chrom, 1, 'F')] = 0 |
122 coverage_dictionary[(chrom, self.chromosomes[chrom], 'F')] = 0 | 119 coverage_dictionary[(chrom, self.chromosomes[chrom], 'F')] = 0 |
120 for read in self.bam_object.fetch(chrom): | |
121 positions = read.positions # a list of covered positions | |
122 for pos in positions: | |
123 if not map_dictionary[(chrom, pos+1, 'F')]: | |
124 map_dictionary[(chrom, pos+1, 'F')] = [] | |
123 for key in map_dictionary: | 125 for key in map_dictionary: |
124 coverage = self.bam_object.count_coverage( | 126 coverage = self.bam_object.count_coverage( |
125 reference=key[0], | 127 reference=key[0], |
126 start=key[1]-1, | 128 start=key[1]-1, |
127 end=key[1], | 129 end=key[1], |