A bash question
1
0
Entering edit mode
3.1 years ago
whb ▴ 60

Hi, I have a set of human exome data sequenced with Agilent Sureselect XT HS2. I am following the Best practice document https://www.agilent.com/cs/library/software/public/AGeNTBestPractices.pdf

On p.3 the example for bwa, just want to check if this is correct before starting the long process for alignment. especially the " at the end and the - after samtools view -b

bwa mem ‐C ‐t 2 /hg38.fa trimmed_dir/sample_R1.cut.fastq.gz   trimmed_dir/sample_R2.cut.fastq.gz | samtools view ‐b ‐ >   aligned_dir/sample.bam"

Any advice would be appreciated! Thanks

bash • 1.6k views
ADD COMMENT
1
Entering edit mode

That extra " at the end is not needed.

- at the end of samtools view command is ok. That indicates that the input to samtools view is coming from the bwa and is being piped in.

ADD REPLY
0
Entering edit mode

your reference file is in the root folder. I am not sure if that is best practice.

ADD REPLY
1
Entering edit mode
3.1 years ago
lethalfang ▴ 160

I would even sort the bam file on the fly as well, e.g.,

bwa mem -R '@RG\tID:READ_GROUP\tPL:PLATFORM\tLB:LIB\tSM:SAMPLE_NAME' ‐C ‐t 2 hg38.fa sample_R1.cut.fastq.gz sample_R2.cut.fastq.gz \
| samtools view -Sbh - | samtools sort -m 2G --threads 4 -o aligned.sorted.bwa.bam
ADD COMMENT
1
Entering edit mode

You don't need the samtools view there - you can pipe it straight to samtools sort

ADD REPLY
0
Entering edit mode

Really? I didn't know that. Is there any flag I needed on the sort function? I thought you couldn't pipe plain text into samtools hence the -b flag in samtools view.

ADD REPLY
1
Entering edit mode

No flag is needed.

By default, samtools tries to select a format based on the -o filename extension; if output is to standard output or no format can be deduced, bam is selected.

ADD REPLY

Login before adding your answer.

Traffic: 1807 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