Mercurial > repos > dfornika > micall_lite
comparison amino2consensus.py @ 22:b5df889acab3 draft
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/tools/micall-lite commit 822e7e1c2de31a72c2a13bcc15b9df06b699561f-dirty
author | dfornika |
---|---|
date | Wed, 25 Sep 2019 19:08:16 -0400 |
parents | d099ef46fd42 |
children | 033e0a3674bc |
comparison
equal
deleted
inserted
replaced
21:d099ef46fd42 | 22:b5df889acab3 |
---|---|
8 AMINO_ACIDS = ['A','C','D','E','F','G','H','I','K','L','M','N','P','Q','R','S','T','V','W','Y','*'] | 8 AMINO_ACIDS = ['A','C','D','E','F','G','H','I','K','L','M','N','P','Q','R','S','T','V','W','Y','*'] |
9 | 9 |
10 def determine_amino(amino_counts, threshold): | 10 def determine_amino(amino_counts, threshold): |
11 amino = "" | 11 amino = "" |
12 total_count = sum(amino_counts.values()) | 12 total_count = sum(amino_counts.values()) |
13 amino_with_max_counts, count = sorted(amino_counts.items(), key=lambda item: item[1], reverse=True)[0] | 13 amino_with_max_counts = sorted(amino_counts, key=amino_counts.get, reverse=True)[0] |
14 if total_count == 0: | 14 if total_count == 0: |
15 amino = "#" | 15 amino = "#" |
16 elif (amino_counts[amino_with_max_counts] / float(total_count)) > threshold: | 16 elif (amino_counts[amino_with_max_counts] / float(total_count)) > threshold: |
17 amino = amino_with_max_counts | 17 amino = amino_with_max_counts |
18 else: | 18 else: |
53 | 53 |
54 | 54 |
55 if __name__ == '__main__': | 55 if __name__ == '__main__': |
56 parser = argparse.ArgumentParser() | 56 parser = argparse.ArgumentParser() |
57 parser.add_argument("amino", help="MiCall amino.csv output file") | 57 parser.add_argument("amino", help="MiCall amino.csv output file") |
58 parser.add_argument("--threshold", default=0.15, help="Threshold for calling") | 58 parser.add_argument("--threshold", default=0.15, type=float, help="Threshold for calling") |
59 args = parser.parse_args() | 59 args = parser.parse_args() |
60 main(args) | 60 main(args) |