Answers.Body: <blockquote>
    <p>UMI and barcode are the same but read2 is different, would they be
    collapsed to 1 UMI count or 2?</p>
  </blockquote>
  
  <p>If the two reads share cell barcodes and UMI sequences and align to the same <strong>gene</strong>, (even if they are different sequences) then they originate from the same RNA molecule, and should only count as 1.</p>
  
  <p><a href="https://support.10xgenomics.com/single-cell-gene-expression/library-prep/doc/user-guide-chromium-single-cell-3-reagent-kits-user-guide-v3-chemistry" rel="nofollow noreferrer">https://support.10xgenomics.com/single-cell-gene-expression/library-prep/doc/user-guide-chromium-single-cell-3-reagent-kits-user-guide-v3-chemistry</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-07-10T06:51:13.070Z
Answers.Text: Do you have any sources (documentation, code, citation etc) to back this up? To my knowledge the UMI is designed to spot PCR duplicates, so read 2 shouldn't have a different sequence (unless there are sequencing errors).
Answers.UserDisplayName: Sebastian Müller
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-07-10T16:22:55.387Z
Answers.Text: If you look up the library prep protocol, you can see that cDNA amplification happens before fragmentation.  Therefore, you can have multiple reads starting at different fragmentation points which nevertheless originate from the same mRNA molecule.  It's also quite plain from looking at the UMI counts output and bam output that all reads with the same gene ID, UMI and cell barcode are marked as duplicates save one, even if the reads aligned to different places in the transcript, and that only the one not marked as a duplicate is being counted in the final UMI count
Answers.UserDisplayName: swbarnes2
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-07-12T08:03:18.977Z
Answers.Text: Thanks. I Just had another look and this appears to be indeed the case, also for other drop-seq protocols apart from 10x. To however accept this as an answer, the only thing missing is if DropSeq-tools is doing the right thing by default or if this can be adjusted that way? The docu is surprisingly unclear about this important point.
Answers.UserDisplayName: Sebastian Müller
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-07-12T15:52:23.283Z
Answers.Text: It's been a while since I looked at DropSeq data, or its library prep protocol, but one has to presume that the Drop-Seq cookbook protocol handles DropSeq data correctly.  The description cited does seem to indicate that all the reads aligning to a gene are assessed for UMIs, not just all the reads aligning to a particular position.  However, I have in the past run the same Drop-Seq data set through the cookbook and (with some manipulation) through 10XGenomics cellranger, and I got very nearly the same results.
Answers.UserDisplayName: swbarnes2
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-07-13T11:53:37.910Z
Answers.Text: To confirm if this is correct, I've just submitted an [issue](https://github.com/broadinstitute/Drop-seq/issues/135)
Answers.UserDisplayName: Sebastian Müller
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-03-19T03:01:45.427Z
Answers.Text: This is likely correct also for DropSeq tools and DropSeqPipe but this source is specifically for 10x Genomic Chromium platform. The source code for UMI processing for DropSeq tools can be found here: https://github.com/broadinstitute/Drop-seq
Answers.UserDisplayName: Tom Kelly ケリー・トム
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-07-09T16:01:42.143Z
Answers.LastActivityDate: 2019-07-10T16:19:04.237Z
Answers.LastEditDate: 2019-07-10T16:19:04.237Z
Answers.UserDisplayName: swbarnes2
Answers.Body: <p>The code does EXACTLY what it says in the first quote.</p>
  
  <p>Let's say you have 5 reads on a cell barcode that align to gene A.  Those reads have the following molecular barcodes:</p>
  
  <p>AAAA,BBBB,AAAA,CCCC,DDDD.</p>
  
  <p>There are 4 UNIQUE molecular barcodes.</p>
  
  <p>The only complication to this is that we collapse barcodes with an edit distance of 1, which takes care of over-inflation of UMI counts due to PCR/Sequencing errors.  If we added a barcode with the sequence AAAB to the original list, it would be collapsed into AAAA as it has an edit distance of 1, and you'd still have 4 unique molecular barcodes.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-07-15T12:54:36.503Z
Answers.Text: In retrospect, the quote makes now sense, I was a bit confused what `assembled` exactly meant in this context, also the additional rational from swbarnes2 about the fragmentation taken place after PCR now explains why it is done this way (hence the accepted answer). Maybe this could be included in the documentation as explanation?
Answers.UserDisplayName: Sebastian Müller
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-07-13T13:05:02.157Z
Answers.LastActivityDate: 2019-07-13T13:05:02.157Z
Answers.UserDisplayName: Jim Nemesh
Body: <p>The module <code>DigitalExpression</code> which is part of the popular <a href="https://github.com/broadinstitute/Drop-seq" rel="nofollow noreferrer">Drop-seq tools</a> digitally count gene transcripts.</p>
  
  <p>The manual is not very clear on how exactly it resolves the UMI information. 
  Maybe I'm missing something but I was wondering if UMI are used in isolation or in conjunction with the barcode and or transcript?</p>
  
  <p>The manual i.e. <a href="https://github.com/broadinstitute/Drop-seq/blob/v2.3.0/doc/Drop-seq_Alignment_Cookbook.pdf" rel="nofollow noreferrer">Drop-seq Alignment Cookbook</a> only states:</p>
  
  <pre><code>To digitally count gene transcripts, a list of UMIs in each gene, within each cell, is assembled, and UMIs
  within edit distance = 1 are merged together. The total number of unique UMI sequences is counted,
  and this number is reported as the number of transcripts of that gene for a given cell.
  </code></pre>
  
  <p>To clarify my point, I'll use an example. Say my reads are only 4 bp and read 1 has the cell barcode at position 1+2 and UMI at position 3+4.  read 2 constitutes the transcript read. </p>
  
  <p>Given the following example reads:</p>
  
  <pre><code>seqence1:   read1 = AATT  read2 = ATGC
  seqence2:   read1 = AATT  read2 = TTTT
  </code></pre>
  
  <p>UMI and barcode are the same but read2 is different, would they be collapsed to 1 UMI count or 2?</p>
  
  <p>Similarly as case with same UMI and transcript but different cell barcode:</p>
  
  <pre><code>seqence1:   read1 = AATT  read2 = ATGC
  seqence2:   read1 = GGTT  read2 = ATGC
  </code></pre>
  
  <p>Also of note, UMI deduplication is the default setting as of the parameter below:</p>
  
  <pre><code>OUTPUT_READS_INSTEAD=Boolean  Output number of reads instead of number of unique molecular barcodes.  Default value:
                                false. This option can be set to 'null' to clear the default value. Possible values:
                                {true, false} 
  </code></pre>
  
Tags: <scrnaseq><umi>
Title: How are UMIs used to dedupulicate in Drop-seq tools?
ThreadText: # How are UMIs used to dedupulicate in Drop-seq tools?
  
  (Asked by: username_0 on 2019-07-09)
  
  The module `DigitalExpression` which is part of the popular [Drop-seq tools](https://github.com/broadinstitute/Drop-seq) digitally count gene transcripts.
  
  The manual is not very clear on how exactly it resolves the UMI information.
  Maybe I'm missing something but I was wondering if UMI are used in isolation or in conjunction with the barcode and or transcript?
  
  The manual i.e. [Drop-seq Alignment Cookbook](https://github.com/broadinstitute/Drop-seq/blob/v2.3.0/doc/Drop-seq_Alignment_Cookbook.pdf) only states:
  
  ```
  To digitally count gene transcripts, a list of UMIs in each gene, within each cell, is assembled, and UMIs
  within edit distance = 1 are merged together. The total number of unique UMI sequences is counted,
  and this number is reported as the number of transcripts of that gene for a given cell.
  
  ```
  
  To clarify my point, I'll use an example. Say my reads are only 4 bp and read 1 has the cell barcode at position 1+2 and UMI at position 3+4. read 2 constitutes the transcript read.
  
  Given the following example reads:
  
  ```
  seqence1:   read1 = AATT  read2 = ATGC
  seqence2:   read1 = AATT  read2 = TTTT
  
  ```
  
  UMI and barcode are the same but read2 is different, would they be collapsed to 1 UMI count or 2?
  
  Similarly as case with same UMI and transcript but different cell barcode:
  
  ```
  seqence1:   read1 = AATT  read2 = ATGC
  seqence2:   read1 = GGTT  read2 = ATGC
  
  ```
  
  Also of note, UMI deduplication is the default setting as of the parameter below:
  
  ```
  OUTPUT_READS_INSTEAD=Boolean  Output number of reads instead of number of unique molecular barcodes.  Default value:
                                false. This option can be set to 'null' to clear the default value. Possible values:
                                {true, false} 
  
  ```
  
  **Tags:** scrnaseq, umi
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2019-07-09. Score: 3 | Accepted answer
  
  > UMI and barcode are the same but read2 is different, would they be
  > collapsed to 1 UMI count or 2?
  
  If the two reads share cell barcodes and UMI sequences and align to the same **gene**, (even if they are different sequences) then they originate from the same RNA molecule, and should only count as 1.
  
  <https://support.10xgenomics.com/single-cell-gene-expression/library-prep/doc/user-guide-chromium-single-cell-3-reagent-kits-user-guide-v3-chemistry>
  
  > **Comments:**
  > **username_0**: Do you have any sources (documentation, code, citation etc) to back this up? To my knowledge the UMI is designed to spot PCR duplicates, so read 2 shouldn't have a different sequence (unless there are sequencing errors).  
  > **username_1**: If you look up the library prep protocol, you can see that cDNA amplification happens before fragmentation.  Therefore, you can have multiple reads starting at different fragmentation points which nevertheless originate from the same mRNA molecule.  It's also quite plain from looking at the UMI counts output and bam output that all reads with the same gene ID, UMI and cell barcode are marked as duplicates save one, even if the reads aligned to different places in the transcript, and that only the one not marked as a duplicate is being counted in the final UMI count  
  > **username_0**: Thanks. I Just had another look and this appears to be indeed the case, also for other drop-seq protocols apart from 10x. To however accept this as an answer, the only thing missing is if DropSeq-tools is doing the right thing by default or if this can be adjusted that way? The docu is surprisingly unclear about this important point.  
  > **username_1**: It's been a while since I looked at DropSeq data, or its library prep protocol, but one has to presume that the Drop-Seq cookbook protocol handles DropSeq data correctly.  The description cited does seem to indicate that all the reads aligning to a gene are assessed for UMIs, not just all the reads aligning to a particular position.  However, I have in the past run the same Drop-Seq data set through the cookbook and (with some manipulation) through 10XGenomics cellranger, and I got very nearly the same results.  
  > **username_0**: To confirm if this is correct, I've just submitted an [issue](https://github.com/broadinstitute/Drop-seq/issues/135)  
  > **username_2**: This is likely correct also for DropSeq tools and DropSeqPipe but this source is specifically for 10x Genomic Chromium platform. The source code for UMI processing for DropSeq tools can be found here: https://github.com/broadinstitute/Drop-seq  
  
  ---
  
  ### Answer by username_3 on 2019-07-13. Score: 1
  
  The code does EXACTLY what it says in the first quote.
  
  Let's say you have 5 reads on a cell barcode that align to gene A. Those reads have the following molecular barcodes:
  
  AAAA,BBBB,AAAA,CCCC,DDDD.
  
  There are 4 UNIQUE molecular barcodes.
  
  The only complication to this is that we collapse barcodes with an edit distance of 1, which takes care of over-inflation of UMI counts due to PCR/Sequencing errors. If we added a barcode with the sequence AAAB to the original list, it would be collapsed into AAAA as it has an edit distance of 1, and you'd still have 4 unique molecular barcodes.
  
  > **Comments:**
  > **username_0**: In retrospect, the quote makes now sense, I was a bit confused what `assembled` exactly meant in this context, also the additional rational from username_1 about the fragmentation taken place after PCR now explains why it is done this way (hence the accepted answer). Maybe this could be included in the documentation as explanation?  
  
  ---
  
  