خرید بک لینک

Vote count: 0

Simplistically the question I'm asking is in a given set of DNA sequencing reads what bases were mutated. To do this I created a data structure like this:

baseDict = {'a':0, 't':0, 'g':0, 'c':0}
varDict = {'a':baseDict, 't':baseDict, 'g':baseDict, 'c':baseDict}

So, a given base can be either A, T, G, or C, and then can be mutated to any of the four bases. So and A could be mutated to a T.

I am reading through a file containing mutations, and using a lot of if...elif statements to process the information, like this:

if base == 'a':
    if mutation == 't':
        varDict['a']['t'] += 1
    elif mutation == 'g':
        varDict['a']['g'] += 1
#and so on...

Is there a way to do the same thing with much less code?

asked 33 secs ago

برچسب: نویسنده: استخدام کار تاريخ: چهارشنبه 29 ارديبهشت 1395 ساعت: 9:13

صفحه بندی