I have initially cut my
.bam files to the specified chromosomes using
samtools with the following code:
samtools sort temp.bam temp.sorted samtools index temp.sorted.bam samtools view -bh temp.bam xx > temp.chrxx.bam
I am planning to align these sequences to the corresponding chromosome using
bwa. I have already download the chromosome specific sequence of
chrxx from USCS.
bwa mem chrxx.fa mybam.bam > bwa.outxx.sam bwa aln -t 4 chrxx.fa mybam.bam > outxx.bwa.sai bwa samse chrxx.fa outxx.bwa.sai mybam.bam > bwa.samse.outxx.sam
Since the output is a
sam I would like to change this into a
bam file, using
samtools to then sort and index it again before processing for Quality control.
I used the command
samtools view -bT chrxx.fa bwa.samse.outxx.sam > outxx.bwa.bam
Yet there is an error that occurs with the
sam output from
bwa alignment. If I were to show th upper ten lines only the upper two lines are shown:
@SQ SN:chr17 LN:81195210 @PG ID:bwa PN:bwa VN:0.7.10-r789 CL:chr1xx.fa outxxbam.sai /Volumes/Pegasus/tmp/out17.bam
The error seen is
[samopen] SAM header is present: 1 sequences. [sam_read1] reference 'ID:bwa PN:bwa VN:0.7.10-r789 CL:bwa samse chrxx.fa /outxx.bam ' is recognized as '*'. [main_samview] truncated file.
please provide any help so that I can fix this issue. I would like to know what I am doing wrong. Thank you. Any assistance is appreciated.