code: def sam_conversions(self, sam_file, depth=True):
          
          cmd = self.tools.samtools + " view -bS " + sam_file + " > " + sam_file.replace(".sam", ".bam") + "\n"
          cmd += self.tools.samtools + " sort " + sam_file.replace(".sam", ".bam") + " -o " + sam_file.replace(".sam", "_sorted.bam") + "\n"
          cmd += self.tools.samtools + " index " + sam_file.replace(".sam", "_sorted.bam") + "\n"
          if depth:
              cmd += self.tools.samtools + " depth " + sam_file.replace(".sam", "_sorted.bam") + " > " + sam_file.replace(".sam", "_sorted.depth") + "\n"
          return cmd
docs: Convert sam files to bam files, then sort and index them for later use.
  
          :param bool depth: also calculate coverage over each position