pbam2bam

The main bash script to convert pbam files back to bam is pbam2bam_bash.sh
This code requires:
(1) python3 (required for decompression algorithm to work)
(2) samtools
(3) pbam2bam.py
(4) PrintSequence.py

README

User arguments
(1) pbam file
(2) reference genome used to align the reads. Which one is used can be found in the pbam header
(3) path to .diff file
(4) name of the diff file
(5) temporary folder to decompress the diff file
(6) read length
  
example usage: sh pbam2bam_bash.sh pbam.bam hg37 ./here/ pbam.diff tmp 100

Please note that current version can only create bam files for reads mapped to the sequences defined in the reference genome such as autosomal chromosomes, chr x and y and some other contigs.
However if you used transcriptome annotation while mapoping to reference genome, some of the reads might map to transcripts (read coordinate starts with ENS). Current version cannot retrive back those reads (which are very small portion of the bam file). However we are currently developing another version of the software that t akes reference transcriptome as an input as well to retrieve back those reads when we create back the original bam files.