Mercurial > repos > artbio > small_rna_map
changeset 6:f924a33e1eef draft
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_rna_map commit 19a447cd21c746c852cf7434b5df423504baf383
author | artbio |
---|---|
date | Sun, 23 Jul 2017 03:43:40 -0400 |
parents | d65045e976e6 |
children | 35d3f8ac99cf |
files | small_rna_map.py small_rna_map.xml |
diffstat | 2 files changed, 8 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/small_rna_map.py Sat Jul 22 11:45:52 2017 -0400 +++ b/small_rna_map.py Sun Jul 23 03:43:40 2017 -0400 @@ -121,13 +121,15 @@ Takes a map_dictionary and returns a dictionary of sizes: {chrom: {size: {polarity: nbre of reads}}} ''' - size_dictionary = defaultdict(lambda: defaultdict(lambda: defaultdict( int ))) + size_dictionary = defaultdict(lambda: defaultdict( + lambda: defaultdict( int ))) for key in map_dictionary: + if len(map_dictionary) == 0: + # to track empty chromosomes + size_dictionary[key[0]][key[2]][size] = 0 + continue for size in map_dictionary[key]: - try: - size_dictionary[key[0]][key[2]][size] += 1 - except KeyError: - size_dictionary[key[0]][key[2]][size] = 1 + size_dictionary[key[0]][key[2]][size] += 1 return size_dictionary def write_size_table(self, out):
--- a/small_rna_map.xml Sat Jul 22 11:45:52 2017 -0400 +++ b/small_rna_map.xml Sun Jul 23 03:43:40 2017 -0400 @@ -1,4 +1,4 @@ -<tool id="small_rna_map" name="small rna map" version="0.5.0"> +<tool id="small_rna_map" name="small rna map" version="0.6.0"> <description></description> <requirements> <requirement type="package" version="1.11.2=py27_0">numpy</requirement>