<p>&quot;Complexity&quot; is also known as entropy. A quick and dirty way is to use a file compression utility - zip will get good compression for a repetitive sequence.</p>
<p>You can also look at the k-mer distribution for some suitable k: in a repetitive sequence it will be biased. Here is a tool that give a local plot: <a href="https://rdrr.io/github/vsbuffalo/qrqc/man/kmerEntropyPlot.html" rel="nofollow noreferrer">https://rdrr.io/github/vsbuffalo/qrqc/man/kmerEntropyPlot.html</a></p>

CC BY-SA 4.0
2021-03-02T08:51:20.313Z
I looked into compressibility as a measure of complexity. I found this article very interesting. They do not recommend it for DNA sequences.
https://sci-hub.do/10.1109/iwobi.2014.6913941
Glubbdrubb
CC BY-SA 4.0
2021-03-01T16:43:30.820Z
2021-03-01T16:43:30.820Z
chrishmorris
<p>Use Picard <a href="http://broadinstitute.github.io/picard/command-line-overview.html" rel="nofollow noreferrer">EstimateLibraryComplexity</a>.</p>
<p>From the docs:</p>
<blockquote>
<p>Estimates the numbers of unique molecules in a sequencing library.</p>
</blockquote>
<pre><code>java -jar picard.jar EstimateLibraryComplexity \
     I=input.bam \
     O=est_lib_complex_metrics.txt
</code></pre>

CC BY-SA 4.0
2021-03-02T09:24:46.837Z
Although I mentioned I had fasta files, I was able to take the original bam files and pipe only those regions into picard with ´samtools view -b -L regions.bed sample.bed | picard....´
Glubbdrubb
CC BY-SA 4.0
2021-03-01T18:37:55.913Z
2021-03-01T18:37:55.913Z
Timur Shtatland
<p>How long are your reads, and how many?  Some colleagues of mine wrote <a href="https://github.com/eclarke/komplexity" rel="nofollow noreferrer">https://github.com/eclarke/komplexity</a> to quickly score complexity in large numbers of short reads.  The score is derived from the number of unique k-mers normalized by the sequence length, so it's simple and fast, though the score inherently becomes less informative for longer and longer sequences (so, best for short reads).  We've used it for filtering repetitive or other low-complexity sequences in metagenomics projects.</p>

CC BY-SA 4.0
2021-03-05T08:54:50.397Z
This looks promising!
I don't want to run it on the unmapped per se as you can see in my question. But since all of the non-targeted regions are less than 300 bps, I think komplixity will be helpful.  I'll let  you know how it goes, and possibly award this as the accepted answer.
Glubbdrubb
CC BY-SA 4.0
2021-03-09T13:14:03.920Z
do you think you could ask your colleagues to take a look at their issues on github? I'm not sure it's being maintained.
Glubbdrubb
CC BY-SA 4.0
2021-03-09T16:31:30.210Z
I see what you mean, those issues aren't getting any attention.  I think the short answer for most of those is that it'd need new features to address them, like handling paired-end reads automatically.  (But for that use case you can at least filter forward and reverse separately, and take the intersection of what remains.)  If I can carve out the time I'll send eclarke some PRs to help with those though.
Jesse
CC BY-SA 4.0
2021-03-10T08:01:13.877Z
Thanks Jesse. That would be helpful.
Glubbdrubb
CC BY-SA 4.0
2021-03-03T21:22:44.453Z
2021-03-03T21:22:44.453Z
Jesse
<p>I have fasta files with multiple sequences. They are reads that mapped to the genome outside of  probe-targeted regions.
From a quick perusal, they appear to be repetitive and have low complexity. Is there a way I can quantify their complexity and use that as an explanation as to why those regions were mapped to?</p>

<ngs><read-mapping>
Quantify low complexity regions in DNA sequences
# Quantify low complexity regions in DNA sequences

(Asked by: username_0 on 2021-03-01)

I have fasta files with multiple sequences. They are reads that mapped to the genome outside of probe-targeted regions.
From a quick perusal, they appear to be repetitive and have low complexity. Is there a way I can quantify their complexity and use that as an explanation as to why those regions were mapped to?

**Tags:** ngs, read-mapping

---

## 3 answers

### Answer by username_1 on 2021-03-01. Score: 1

"Complexity" is also known as entropy. A quick and dirty way is to use a file compression utility - zip will get good compression for a repetitive sequence.

You can also look at the k-mer distribution for some suitable k: in a repetitive sequence it will be biased. Here is a tool that give a local plot: <https://rdrr.io/github/vsbuffalo/qrqc/man/kmerEntropyPlot.html>

> **Comments:**
> **username_0**: I looked into compressibility as a measure of complexity. I found this article very interesting. They do not recommend it for DNA sequences. https://sci-hub.do/10.1109/iwobi.2014.6913941  

---

### Answer by username_2 on 2021-03-01. Score: 1

Use Picard EstimateLibraryComplexity.
From the docs:

Estimates the numbers of unique molecules in a sequencing library.

java -jar picard.jar EstimateLibraryComplexity \
     I=input.bam \
     O=est_lib_complex_metrics.txt

> **Comments:**
> **username_0**: Although I mentioned I had fasta files, I was able to take the original bam files and pipe only those regions into picard with ´samtools view -b -L regions.bed sample.bed | picard....´  

---

### Answer by username_3 on 2021-03-03. Score: 0

How long are your reads, and how many? Some colleagues of mine wrote <https://github.com/eclarke/komplexity> to quickly score complexity in large numbers of short reads. The score is derived from the number of unique k-mers normalized by the sequence length, so it's simple and fast, though the score inherently becomes less informative for longer and longer sequences (so, best for short reads). We've used it for filtering repetitive or other low-complexity sequences in metagenomics projects.

> **Comments:**
> **username_0**: This looks promising! I don't want to run it on the unmapped per se as you can see in my question. But since all of the non-targeted regions are less than 300 bps, I think komplixity will be helpful.  I'll let  you know how it goes, and possibly award this as the accepted answer.  
> **username_0**: do you think you could ask your colleagues to take a look at their issues on github? I'm not sure it's being maintained.  
> **username_3**: I see what you mean, those issues aren't getting any attention.  I think the short answer for most of those is that it'd need new features to address them, like handling paired-end reads automatically.  (But for that use case you can at least filter forward and reverse separately, and take the intersection of what remains.)  If I can carve out the time I'll send eclarke some PRs to help with those though.  
> **username_0**: Thanks Jesse. That would be helpful.  

---

