I use bwa mem to align reads. And got several log info at the head of the samfile. Like this:
[M::main_mem] read71286 sequences(10000200 bp)...
[M::mem_pestat]# candidate unique pairs for(FF, FR, RF, RR):(0,5009,0,0)
[M::mem_pestat]skip orientation FF as there are not enough pairs
[M::mem_pestat]analyzing insert size distribution for orientation FR...
[M::mem_pestat](25,50,75) percentile:(160,170,174)
[M::mem_pestat]low and high boundaries for computing mean and std.
[M::mem_pestat]mean and std. dev:(165.99,9.13)
[M::mem_pestat]low and high boundaries for proper pairs:(118,216)
[M::mem_pestat]skip orientation RF as there are not enough pairs
[M::mem_pestat]skip orientation RR as there are not enough pairs
[M::mem_pestat]processed71286 reads in6.210 CPU sec,6.219 real sec
Then I want to convert the sam file into bam, when I use samtools view to do that, It has an error :
# [samopen] no @SQ lines in the header.
# [sam_read1] missing header? Abort!
so I cut the first 11 lines in the head, and then run it again, and I got another error,
# [samopen] SAM header is present: 25 sequences.
# Parse error at line 71433: sequence and quality are inconsistent
So there are mutiple this log info scattered in the sam file ,so I can not convert into bam.
How could this happen? is there other ways I can convert to bam file?
Thank you in advance.
Please add the commands you used for bwa mem.
I use the basic command of mem align.
bwa mem test.fasta 1.fq 2.fq > aln_pe.sam
Sure you didn't use
nohup
or '&>` or something similar? Because this looks like combining stderr and stdout together.I use nohup and & in the bwa mem running. but don't use in the samtools running cause I want to see the error info. Sorry I don't quite understand the meaning of stderr and stdout combination.
Well there's your problem.
Next time, when someone asks you about the commands you used, give the commands you used and not a piece of it. You left out important information.
WouterDeCoster means standard log message displayed by BWA got concatenated with your standard .sam output file instead of adding to nohup file. Thus you were able to see BWA log message as first 11 lines of your .sam file.
I think you should rerun the BWA mem again without nohup or anything similar followed by samtools view.
And again if you get this error
[samopen] SAM header is present: 25 sequences.
Parse error at line 71433: sequence and quality are inconsistent
then there is surely something wrong in your reads file as error "sequence and quality are inconsistent" means number of total bases in your sequence is not same as number of quality representing those bases