Entering edit mode
3.6 years ago
evafinegan
•
0
Hello,
I have some alignment files for different samples. I want to make one file for each of the chromosome from all the alignment files. For example, I want to combine chromosome 1
from all alignment files for different samples and make one file. I tried:
while read i; do awk "chr'$i'$"' $(ls *.bam) | cut -f 1 | sort -V > chr1$i.part; done
However, the output file is empty. I will appreciate any help to fix it. Thank you!
Are your BAM files sorted and indexed? If not you should do that first and then use the answers here: How To Split A Bam File By Chromosome and How Can I Split Bam Into Chromosome (In A Loop) Using Samtools?
Thank you! I have it sorted and indexed and
bam tools split
worked for me. However, can I use this if my alignment files are in plain text format.plain text
format as inSAM
instead ofBAM
format?What's your
awk
trying to do, exactly?