3
$\begingroup$

What does this command implies in bwa mem

bwa mem -t 8 index/referencegenome.fna read1.fastq.gz read2.fastq.gz > output.sam"""

What does -t 8 stands for here?

Thank you

$\endgroup$
0

2 Answers 2

0
$\begingroup$

-t is an important parameter here and is important to understand. bwa is a CPU calculation and the more CPUs the job (calculation) is spread across the faster the calculation will take to complete and the less chance of the calculation exceeding the RAM capacity of the machine. "Exceeding RAM capacity" (I don't know the technical term), is when the process "grinds to a halt" and never completes.

Basically what can happen is the indexing step instead of taking ~3 hours, could easily be still running after 24 hours if the machine has little RAM and -t isn't set sufficiently high.

One CPU is known as "one core".

For a regular desktop if you set -t X where X is number of CPUs - 1 in my opinion that is good practice. So if the machine has 8 CPUs then X = 7. If you are working on a cluster, e.g. GCP or AWS, then X is the maximum number of cores (CPUs) available.

$\endgroup$
5
  • 1
    $\begingroup$ thank you .you actually got my question this really did helped me rather then just knowing that it just stands for threads $\endgroup$
    – Moon
    Aug 3, 2023 at 9:35
  • 1
    $\begingroup$ If I'm using a regular desktop I should write it as Bwa mem -t 1 rather than 8 am i right? $\endgroup$
    – Moon
    Aug 3, 2023 at 9:46
  • 3
    $\begingroup$ pedantic note: the indexing in bwa is not multithreaded, only the alignment (bwa mem) is. you should set it as high as your machine allows to finish in time. note that the higher "-t" goes, the more memory the process will consume. there is no fixed rule for this since in bwa the memory usage depends on the reads you're aligning, its complexity and length, but usually something in the range from 1-16 with available memory somewhere in the range of 8-32gb works fine. if memory is limited then keep "-t" down, something like "-t 4" will probably do. $\endgroup$
    – ATpoint
    Aug 3, 2023 at 12:53
  • 1
    $\begingroup$ thanks I'm gonna prefer 8 for now then $\endgroup$
    – Moon
    Aug 3, 2023 at 12:57
  • 1
    $\begingroup$ -t 8 is good. It is good to test empirically, so if it takes >3 hours indexing occurs try a different value. I do not recommend -t 1 at all. The point is that -t is a pivotal parameter for RAM usage. There is a difference of opinion on multithreading versus RAM. I agree that multithreading followed by single threading is common (I've written code that does that) and could be an issue (it's really complicated). $\endgroup$
    – M__
    Aug 3, 2023 at 16:48
1
$\begingroup$

When you have questions on software then the first thing is to do your due diligence and read the manual:

https://bio-bwa.sourceforge.net/bwa.shtml

Then simply checking for the "-t" argument will tell you that it is the number of threads used for the alignment process.

$\endgroup$
3
  • 1
    $\begingroup$ sorry but I was not asking about what is t ...I was asking why to put 8 in that which is not given in the manual I wanted to know if I can change it or is there a specific rule about it and yes I'm definitely new to this bioinformatics stuff but I'm not new to science I'll learn things anyways thanks for replying $\endgroup$
    – Moon
    Aug 3, 2023 at 9:42
  • $\begingroup$ Then you should've asked "how to set -t" and which implications does choice of "-t" has. $\endgroup$
    – ATpoint
    Aug 3, 2023 at 12:52
  • $\begingroup$ my bad i was not aware of that after -t it's the thread number $\endgroup$
    – Moon
    Aug 3, 2023 at 12:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.