Problem with Extract alignment ends

Why is this error happening:

Traceback (most recent call last):
  File "/usr/local/tools/_conda/envs/__bctools@0.2.2/bin/", line 102, in <module>
    alns_bedpe = alns.bam_to_bed(bedpe=True, mate1=True, ed=True)
  File "/usr/local/tools/_conda/envs/__bctools@0.2.2/lib/python3.5/site-packages/pybedtools/", line 806, in decorated
    result = method(self, *args, **kwargs)
  File "/usr/local/tools/_conda/envs/__bctools@0.2.2/lib/python3.5/site-packages/pybedtools/", line 337, in wrapped
  File "/usr/local/tools/_conda/envs/__bctools@0.2.2/lib/python3.5/site-packages/pybedtools/", line 356, in call_bedtools
    raise BEDToolsError(subprocess.list2cmdline(cmds), stderr)
Command was:

	bedtools bamtobed -mate1 -i /data/jwd/main/038/753/38753581/tmp/tmpahcdouwa/fixedmates.bam -ed -bedpe

Error message was:
The edit distance tag (NM) was not found in the BAM file.  Please disable -ed.  Exiting

Hi @biostaring,
which tool have you used to generate the BAM file? The problem is that it doesn’t include the edit distance tag (NM).


Hi, the BAM file is from after UMI-tools deduplicate

What would cause the BAM file to not have the distance tag?

It depends on the tool used for mapping the samples; e.g. in order to include the NM tag when using RNA STAR, it should be specified in the BAM output format option.

1 Like