I want to convert bam file to pileup format. Is there a way to split into smaller jobs (by chromosomes for example) and re-merge to get the consolidated pileup file?
right now I am using "Pileup" tool from GATK but can use samtools too.
java -Xmx4g -jar ~/software/gatk/GenomeAnalysisTK/GenomeAnalysisTK.jar -I $bam -R $ref -T Pileup
Yes, you can split into smaller jobs using the 'bamtools split' command. In my case, I was using samtools mpileup. I found that for big jobs, such as those on multiple large bam files from many samples splitting is much faster. I think you could probably consolidate the resulting pileups with a short ad-hoc script. However, in my case, I further processed the pileups separately using variant calling software (VarScan) and then consolidated the smaller output files from that sofrtware and then removed the pileups.