Last active
February 12, 2021 12:14
-
-
Save max-l/4b4e62950818ec08c11ca746e4cc3192 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def group_snp(): | |
for gene, grp in itt.groupby(gene_snps_grp, key=lambda x: x['gene']): | |
if gene in gene_lenghts: | |
yield gene, len(list(grp)) * 1000 / gene_lenghts[gene] | |
# possibilité 1: création de dictinnaire à partir d'un générateur de tuple2 | |
gene_snp_rate = dict(group_snp()) | |
# possibilité 1: bouclage avec for sur le générateur | |
for gene, cnt in group_snp(): | |
print("{} --> {}".format(gene, cnt)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment