def get_strand_bias(sample, variants):
  """Based on method 1 (SB) of Guo et al., 2012
  If there a denominator would be 0, there is no valid result and this will
  return None. This occurs when there are no reads on one of the strands, or
  when there are no minor allele reads."""
  # using same variable names as in paper
  a = variants.get('+'+sample['major'], 0) # forward major allele
  b = variants.get('+'+sample['minor'], 0) # forward minor allele
  c = variants.get('-'+sample['major'], 0) # reverse major allele
  d = variants.get('-'+sample['minor'], 0) # reverse minor allele
  # no minor allele reads
  try:
    return abs(b/(a+b) - d/(c+d)) / ((b+d) / (a+b+c+d))
  except ZeroDivisionError:
    return None