code: def count_unique_mapped_reads(self, file_name, paired_end):
          
  
          _, ext = os.path.splitext(file_name)
          ext = ext.lower()
  
          if ext == ".sam":
              param = "-S -F4"
          elif ext == "bam":
              param = "-F4"
          else:
              raise ValueError("Not a SAM or BAM: '{}'".format(file_name))
  
          if paired_end: 
              r1 = self.samtools_view(file_name, param=param + " -f64", postpend=" | cut -f1 | sort -k1,1 -u | wc -l | sed -E 's/^[[:space:]]+//'")
              r2 = self.samtools_view(file_name, param=param + " -f128", postpend=" | cut -f1 | sort -k1,1 -u | wc -l | sed -E 's/^[[:space:]]+//'")
          else:
              r1 = self.samtools_view(file_name, param=param + "", postpend=" | cut -f1 | sort -k1,1 -u | wc -l | sed -E 's/^[[:space:]]+//'")
              r2 = 0
  
          return int(r1) + int(r2)
docs: For a bam or sam file with paired or or single-end reads, returns the
          number of mapped reads, counting each read only once, even if it appears
          mapped at multiple locations.
  
          :param str file_name: name of reads file
          :param bool paired_end: True/False paired end data
          :return int: Number of uniquely mapped reads.