This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Collapsing BAM based on seq and positions

Is there a tool I can use to input a BAM and do a collapsing based on sequence and positions and retaining the copy number of the unique sequence? (outputing again BAM)

bam collapse

I need something like FASTA collapsing, where you retain only 1 unique sequence with its copy number, but on a level of BAM file. I have BAM mapped with uncollapsed sequences, and need to collapsed it somehow to have BAM with unique sequences mapped somewhere and its copy number (retained in the name or similar way).

input/output example required.

For example, if containing identical seq mapping the same pos:

HISEQ:47:C6FUWANXX:1:1101:1212:2073     4       contig1222  1       25      22M     *       0       0       TATTGCACTTGTCCCGGCCTGT  BBBBBFFFFFFFFFFFFFFFFF  XT:A:U  NM:i:1  X0:i:1  X1:i:0  XM:i:1  XO:i:0  XG:i:0  MD:Z:21C0
HISEQ:47:C6FUWANXX:1:1101:1139:2100     4       contig1222  1       25      22M     *       0       0       TATTGCACTTGTCCCGGCCTGT  BBBBBFFFFFFFFFFFF/FFFF  XT:A:U  NM:i:1  X0:i:1  X1:i:0  XM:i:1  XO:i:0  XG:i:0  MD:Z:21C0

to retain only 1 indicating on the name (or similar way) _2 the copy number:

HISEQ:47:C6FUWANXX:1:1101:1212:2073_2     4       contig1222  1       25      22M     *       0       0       TATTGCACTTGTCCCGGCCTGT  BBBBBFFFFFFFFFFFFFFFFF  XT:A:U  NM:i:1  X0:i:1  X1:i:0  XM:i:1  XO:i:0  XG:i:0  MD:Z:21C0

I just made an example some flags may be wrong, view it as mapped. I hope you got what I mean and want to do?

This sounds much like the ReducedReads format from early GATK versions. Ultimately it was retired because it wasn't sufficient to capture all the important information, but it may still be available if you can find an old enough GATK (2.8?).

0 answers

No answers yet.

Log in to answer this question.