please see the error log:
bam_header_read] EOF marker is absent. The input is probably truncated. [bam_header_read] invalid BAM binary header (this is not a BAM file). [M::bwa_idx_load_from_disk] read 0 ALT contigs [M::process] read 412708 sequences (40000092 bp)... [M::process] read 412590 sequences (40000195 bp)... [M::mem_pestat] # candidate unique pairs for (FF, FR, RF, RR): (1, 158858, 7, 5) [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: (87, 116, 161) [M::mem_pestat] low and high boundaries for computing mean and std.dev: (1, 309) [M::mem_pestat] mean and std.dev: (128.09, 53.87) [M::mem_pestat] low and high boundaries for proper pairs: (1, 383) [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_process_seqs] Processed 412708 reads in 208.661 CPU sec, 685.940 real sec Segmentation fault (core dumped)
I ran your command. It works fine to me. It seems you have Memory problem. May be RAM or CPU. Here is my suggestion to come to a solution:
1- Extract around 20000 reads: head -n 20000 SRR.fastq > SRR_new.fastq
2- Run bwa again with option "-t 2" not -t 3. And exclude this part of the pipeline for now "samtools view -Sbh | samtools sort - aln-sorted".
Give us a feedback then
Hope it helps.
Or even -t 1, I believe bwa uses 5 point something Gb of memory for aligning against the human genome.