Error in chopping alignment files for each chromosome
0
0
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!

alignment • 822 views
ADD COMMENT
1
Entering edit mode

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?

ADD REPLY
0
Entering edit mode

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.

ADD REPLY
0
Entering edit mode

plain text format as in SAM instead of BAM format?

ADD REPLY
0
Entering edit mode

What's your awk trying to do, exactly?

ADD REPLY

Login before adding your answer.

Traffic: 1537 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6