Hi NGS users,
anyone knows how I can separate a BAM file in different chromosome?
Starting BAM file is too large (about 10GB for a whole exome) so I want to divide it in different smaller BAM file for chromosome. But using:
> samtools view *sorted.bam | awk '$3=="chr1"' > onlychr1.bam.sorted.bam
returns me an incorrect file.
Infact, when I run
> samtools index onlychr1.bam.sorted.bam
it returns me
[bam_header_read] EOF marker is absent.
[bam_header_read] invalid BAM binary header (this is not a BAM file).
Segmentation fault
Thanx
ME
anyone knows how I can separate a BAM file in different chromosome?
Starting BAM file is too large (about 10GB for a whole exome) so I want to divide it in different smaller BAM file for chromosome. But using:
> samtools view *sorted.bam | awk '$3=="chr1"' > onlychr1.bam.sorted.bam
returns me an incorrect file.
Infact, when I run
> samtools index onlychr1.bam.sorted.bam
it returns me
[bam_header_read] EOF marker is absent.
[bam_header_read] invalid BAM binary header (this is not a BAM file).
Segmentation fault
Thanx
ME
Comment