code: def calc_AF(M,major=0,minor=2):
      
      if minor==2:
          Nhet   = (M==0).sum(axis=0)
          Nmajor = 2*(M==0).sum(axis=0)
          Nminor = 2*(M==2).sum(axis=0)
          af  = Nminor/sp.double(2*M.shape[0])
      else:
          Nmajor = (M==0).sum(axis=0)
          Nminor = (M==1).sum(axis=0)
          af  = Nminor/sp.double(1*M.shape[0])
      RV = {}
      RV['af'] = af
      RV['Nmajor'] = Nmajor
      RV['Nminor'] = Nminor
      return RV
docs: calculate minor allelel frequency, by default assuming that minor==2