code: def detect_bam_features(bamfile, n_entries=1000):
      ''' read the first n entries in the bam file and identify the tags
      available detecting multimapping '''
  
      inbam = pysam.Samfile(bamfile)
      inbam = inbam.fetch(until_eof=True)
  
      tags = ["NH", "X0", "XT"]
      available_tags = {x: 1 for x in tags}
  
      for n, read in enumerate(inbam):
          if n > n_entries:
              break
  
          if read.is_unmapped:
              continue
  
          else:
              for tag in tags:
                  if not read.has_tag(tag):
                      available_tags[tag] = 0
  
      return available_tagf detect_bam_features(bamfile, n_entries=1000):
      ''' read the first n entries in the bam file and identify the tags
      available detecting multimapping '''
  
      inbam = pysam.Samfile(bamfile)
      inbam = inbam.fetch(until_eof=True)
  
      tags = ["NH", "X0", "XT"]
      available_tags = {x: 1 for x in tags}
  
      for n, read in enumerate(inbam):
          if n > n_entries:
              break
  
          if read.is_unmapped:
              continue
  
          else:
              for tag in tags:
                  if not read.has_tag(tag):
                      available_tags[tag] = 0
  
      return available_tags
docs: read the first n entries in the bam file and identify the tags
      available detecting multimapping