#NEWLINE# def CalculateDistanceJC69( info , do_gamma = False , alpha = None ) : #NEWLINE# #INDENT# 'return Jukes-Cantor distance.\n    ' #NEWLINE# try : #NEWLINE# #INDENT# p = ( float ( info . mNDifferent ) / info . mNAligned ) #NEWLINE# if do_gamma : #NEWLINE# #INDENT# distance = ( ( 0.75 * alpha ) * ( pow ( ( 1 - ( ( 4 * p ) / 3 ) ) , ( ( - 1 ) / alpha ) ) - 1 ) ) #NEWLINE# variance = ( ( p * ( 1 - p ) ) / ( pow ( ( 1 - ( ( 4 * p ) / 3 ) ) , ( ( - 2 ) / ( alpha + 1 ) ) ) * L ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# distance = ( ( - 0.75 ) * math . log ( ( 1.0 - ( ( 4.0 * p ) / 3.0 ) ) ) ) #NEWLINE# variance = ( ( p * ( 1.0 - p ) ) / ( math . pow ( ( 1.0 - ( ( 4.0 * p ) / 3 ) ) , 2.0 ) * info . mNAligned ) ) #NEWLINE# #UNINDENT# #UNINDENT# except : #NEWLINE# #INDENT# raise ValueError #NEWLINE# #UNINDENT# return ( distance , variance )