I want to automatize alignment and sorting for several fastq files.
When I run the command without automation for one sample It complies fine:
bwa mem -t 15 -R "@RG\tID:id\tSM:sm\tPL:illumina\tLB:lb" hg19 sample1-R1.fastq sample1-R2.fastq | samtools view -@ 15 -b - | samtools sort -@ 15 - > sample1-R1.bam
Whereas It doesn't happens the same when I try to automatize It.
for i in *R1.fastq ; do bwa mem -t 15 -R "@RG\tID:id\tSM:sm\tPL:illumina\tLB:lb" hg19 $i ${i/R1/R2} | samtools view -@ 15 -b - | samtools sort -@ 15 > ${i/_R1.fastq/.bam} ; done
[M::bwa_idx_load_from_disk] read 0 ALT contigs
[W::bseq_read] the 1st file has fewer sequences.
[W::bseq_read] the 1st file has fewer sequences.
[main] Version: 0.7.17-r1188
[main] CMD: bwa mem -t 15 -R @RG\tID:id\tSM:sm\tPL:illumina\tLB:lb ../10.reference_files/hg19 ../12.xengsort_fastq/CDX1-both.R1.fastq ../12.xengsort_fastq/CDX1-both.R2.fastq
[main] Real time: 1.549 sec; CPU: 1.550 sec
When I check the fastq files they have been edited somehow
-rw-rw-r-- 1 user user 5251 Jun 21 09:26 CDX1-both.R1.fastq
-rw-rw-r-- 1 user user 12140549 Jun 21 08:56 CDX1-both.R2.fastq
Where is the mistake?
That was indeed the problem thank you!!