code: def nt_counts(bam, positions, stranded=False, vcf=False, bed=False):
      if not bed and not vcf:
          if type(positions) == pbt.bedtool.BedTool:
              df = positions.to_dataframe()
          elif positions[-4:] == '.bed':
              bed = True
          elif positions[-4:] == '.vcf':
              vcf = True
          else:
              sys.stderr.write('Positions must be BedTool, bed file, or vcf '
                               'file.\n')
      if bed:
          df = pbt.BedTool(positions).to_dataframe()
      elif vcf:
          from variants import vcf_as_df
          tdf = vcf_as_df(positions)
          df = pd.DataFrame(index=tdf.index)
          df['chrom'] = tdf.CHROM
          df['start'] = tdf.POS - 1
          df['end'] = tdf.POS
      res = []
      for i in df.index:
          region = [df.ix[i, 'chrom'], df.ix[i, 'start'], df.ix[i, 'end']]
          res.append(get_region_nt_counts(region, bam, stranded))
      res = pd.concat(res)
      return res