code: def _extract_split_and_discordants(in_bam, work_dir, data):
      
      sr_file = os.path.join(work_dir, "%s-sr.bam" % os.path.splitext(os.path.basename(in_bam))[0])
      disc_file = os.path.join(work_dir, "%s-disc.bam" % os.path.splitext(os.path.basename(in_bam))[0])
      if not utils.file_exists(sr_file) or not utils.file_exists(disc_file):
          with file_transaction(data, sr_file) as tx_sr_file:
              with file_transaction(data, disc_file) as tx_disc_file:
                  cores = dd.get_num_cores(data)
                  ref_file = dd.get_ref_file(data)
                  cmd = ("extract-sv-reads -e --threads {cores} -T {ref_file} "
                         "-i {in_bam} -s {tx_sr_file} -d {tx_disc_file}")
                  do.run(cmd.format(**locals()), "extract split and discordant reads", data)
      for fname in [sr_file, disc_file]:
          bam.index(fname, data["config"])
      return sr_file, disc_file
docs: Retrieve split-read alignments from input BAM file.