Hello Christian,
It's a little tricky for a number of reasons.
1 - You have to set the flags correctly. The reads are aligned separately and then paired, and the flags should refer to their mate and what strand it aligns to.
2 - The position that we record is the 5' end position where the read started. BAM/SAM records where the alignment started (and reverses for reverse strand). We do this for duplicate removal by parsing the CIGAR string. You can find out what we do in the file
chimeric_blacklist.awk3 - We don't store the base pair quality information in merged_nodups; the BAM standard allows for no quality information but it's something to keep in mind
From a .hic file is even worse, as we bin the reads and so lose the exact position/alignment/strand information as well as the sequence information.
May I ask what you're trying to accomplish, i.e. why you would want to convert merged_nodups or another valid pairs file to BAM?
Best
Neva