Answers.Body: <p><code>-t</code> 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. &quot;Exceeding RAM capacity&quot; (I don't know the technical term), is when the process &quot;grinds to a halt&quot; and never completes.</p>
  <p>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 <code>-t</code> isn't set sufficiently high.</p>
  <p>One CPU is known as &quot;one core&quot;.</p>
  <p>For a regular desktop if you set <code>-t X</code> 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.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-08-03T09:35:05.717Z
Answers.Text: thank you .you actually got my question this really did helped me rather then just knowing that it just stands for threads
Answers.UserDisplayName: Moon
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-08-03T09:46:22.797Z
Answers.Text: If I'm using a regular desktop I should write it as Bwa mem -t 1 rather than 8 am i right?
Answers.UserDisplayName: Moon
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-08-03T12:53:29.913Z
Answers.Text: 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.
Answers.UserDisplayName: ATpoint
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-08-03T12:57:56.857Z
Answers.Text: thanks I'm gonna prefer 8 for now then
Answers.UserDisplayName: Moon
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-08-03T16:48:57.833Z
Answers.Text: `-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).
Answers.UserDisplayName: M__
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-08-03T09:26:55.963Z
Answers.LastActivityDate: 2023-08-03T09:26:55.963Z
Answers.UserDisplayName: M__
Answers.Body: <p>When you have questions on software then the first thing is to do your due diligence and read the manual:</p>
  <p><a href="https://bio-bwa.sourceforge.net/bwa.shtml" rel="nofollow noreferrer">https://bio-bwa.sourceforge.net/bwa.shtml</a></p>
  <p>Then simply checking for the &quot;-t&quot; argument will tell you that it is the number of threads used for the alignment process.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-08-03T09:42:29.717Z
Answers.Text: 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
Answers.UserDisplayName: Moon
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-08-03T12:52:39.170Z
Answers.Text: Then you should've asked "how to set -t" and which implications does choice of "-t" has.
Answers.UserDisplayName: ATpoint
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-08-03T12:59:06.960Z
Answers.Text: my bad i was not aware of that after -t it's the thread number
Answers.UserDisplayName: Moon
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-08-03T08:07:45.620Z
Answers.LastActivityDate: 2023-08-03T08:07:45.620Z
Answers.UserDisplayName: ATpoint
Body: <p>What does this command implies in bwa mem</p>
  <pre><code>bwa mem -t 8 index/referencegenome.fna read1.fastq.gz read2.fastq.gz &gt; output.sam&quot;&quot;&quot;
  </code></pre>
  <p>What does <code>-t 8</code> stands for here?</p>
  <p>Thank you</p>
  
Tags: <bwa><command-line>
Title: what does 8 stands for in bwa mem command line
ThreadText: # what does 8 stands for in bwa mem command line
  
  (Asked by: username_0 on 2023-08-03)
  
  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
  
  **Tags:** bwa, command-line
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2023-08-03. Score: 0 | Accepted answer
  
  `-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.
  
  > **Comments:**
  > **username_0**: thank you .you actually got my question this really did helped me rather then just knowing that it just stands for threads  
  > **username_0**: If I'm using a regular desktop I should write it as Bwa mem -t 1 rather than 8 am i right?  
  > **username_2**: 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.  
  > **username_0**: thanks I'm gonna prefer 8 for now then  
  > **username_1**: `-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).  
  
  ---
  
  ### Answer by username_2 on 2023-08-03. Score: 1
  
  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.
  
  > **Comments:**
  > **username_0**: 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  
  > **username_2**: Then you should've asked "how to set -t" and which implications does choice of "-t" has.  
  > **username_0**: my bad i was not aware of that after -t it's the thread number  
  
  ---
  
  