Hi,
I am processing BAM files using pysam as part of the HiFive set of tools for analysing Hi-C data. The input required are two BAM files with each one representing the forward and the reverse reads respectively from an alignment of paired-end reads.
In order to split the alignment BAM file into forward and reverse reads, I used:
samtools view -f 0x40 file_chr1.bam > file_chr1_1.bam
samtools view -f 0x80 file_chr1.bam > file_chr1_2.bam
Then discovered that the new BAM files do not have headers so I added the -h
tag to the commands:
samtools view -h -f 0x40 file_chr1.bam > file_chr1_1.bam
samtools view -h -f 0x80 file_chr1.bam > file_chr1_2.bam
Now I am getting the following error:
for I in range(len(input.header['SQ'])):
File "pysam/calignmentfile.pyx", line 1486, in pysam.calignmentfile.AlignmentFile.header.__get__ (pysam/calignmentfile.c:16469)
ValueError: malformatted header: no ':' in field
Any ideas on how to fix this?
Thank you very much
Can you show me the header of the bam file?