Whey I try to convert one of my bam-files with bam2bed from the bedops suite (version 2.3.0) I get an error saying that my bam-file contains tags that are not in the samtools specification.
bam2bed < myfile.bam
My bam-file is made with bwa and quality scores are recalibrated with GATK that ads BD and BI tags to the bam file
Traceback (most recent call last): File "/home/irsan/programs/bedops/version_2.3.0/bin/bam2bed", line 716, in <module> sys.exit(main(*sys.argv)) File "/home/irsan/programs/bedops/version_2.3.0/bin/bam2bed", line 637, in main samTags.append(elems[idx]) File "/home/irsan/programs/bedops/version_2.3.0/bin/bam2bed", line 159, in append raise Exception("Appended tag (%s) is not valid per SAMtools specification" % tagName) Exception: Appended tag (BD) is not valid per SAMtools specification
allValidSamTags = ['AM',
'AS',
'BC',
'BD', # <-- added by me
'BI', # <-- added by me
'BQ',
'CC',
'CM',
'CO',
'CP',
'CQ',
'CS',
'CT',
'E2',
'FI',
'FS',
'FZ',
'LB',
'H0',
'H1',
'H2',
'HI',
'IH',
'MD',
'MQ',
'NH',
'NM',
'OQ',
'OP',
'OC',
'PG',
'PQ',
'PT',
'PU',
'QT',
'Q2',
'R2',
'RG',
'RT',
'SA',
'SM',
'TC',
'U2',
'UQ']
Should I just add 'BD' and 'BI' to the list of allValidSamTags
in bam2bed
script or is there a better way?
I may add custom tags support, so that the end user can specify those as a command-line option. You could edit this script, in the meantime, as you describe.
This is fixed in v2.4. See BEDOPS v2.4 released and http://bedops.readthedocs.org/en/latest/content/reference/file-management/conversion/bam2bed.html for a description of the
--custom-tags
option.