Answers.Body: <p>I don't think that in principle the issue is any different for PacBio and Illumina; it's just that the process might be noisier with higher error rates. Note that <a href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC5553090/" rel="nofollow noreferrer">PacBio errors aren't randomly distributed substitutions</a> and probably many (most?) short-ish k-mers (&lt;30nt) will likely be intact. I would suggest doing k-mer filtering of your reads as suggested <a href="https://www.biostars.org/p/12988/" rel="nofollow noreferrer">here</a> or <a href="https://www.researchgate.net/post/What_methods_programs_are_recommended_to_clean-up_a_genome_from_contaminating_reads" rel="nofollow noreferrer">here</a> or <a href="https://www.biostars.org/p/130/" rel="nofollow noreferrer">here</a>.</p>
  <p>Alternately, use your favorite alignment-based technique, if you have a good idea of what your contaminant is. In principle PB reads will be <em>better</em> filtered by this method than Illumina as local alignment will be able to figure out the errors quite well with longer queries.</p>
  <p>If you go the route of trying to do alignment to some set of contaminant references, the obvious answer would be to use <a href="https://github.com/lh3/minimap2" rel="nofollow noreferrer">minimap2</a> as your aligner as this is exactly the task that it is designed for. You can then use <a href="http://www.htslib.org/" rel="nofollow noreferrer">samtools</a> to filter out anything that maps well.</p>
  <p>Here is a related question/answer that also addresses the contaminant issue and suggests using <a href="https://github.com/blaxterlab/blobology" rel="nofollow noreferrer">Blobology</a>, which I'm not familiar with but may be helpful (granted it also seems to be Illumina-centric). Genome-size estimation using k-mers on PB reads appears to be pretty accurate too, so I think that it's likely ok to work with raw PB k-mers.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-01-07T19:12:28.547Z
Answers.Text: Right, the PacBio CLR reads errors are randomly distributed. Using smaller kmer is a great idea. I find the BBsketch is the fastest comparison using kmer analysis, although the documentation is embedded deep in a readme file. BBSketch could build a local NCBI nr sketch and compare reads against it in less than an hour. I am comparing the accuracy of BBSketch and Kraken (micro-organisms) now.  It might be hard to track down the sources for de novo assembly, within unknown bacteria, parasites, and even plants.  Blobology is now Blobtools2, a very nice tool I have been exploring! Thanks!
Answers.UserDisplayName: Life_Searching_Steps
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-12-01T19:01:34.320Z
Answers.LastActivityDate: 2020-12-01T22:00:36.590Z
Answers.LastEditDate: 2020-12-01T22:00:36.590Z
Answers.UserDisplayName: Maximilian Press
Answers.Body: <p>You can use the kraken database. It will classify your reads based on what organism it matches with. Then can write a custom script to extract the reads you are interested in for downstream analysis.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-01-29T23:24:13.793Z
Answers.LastActivityDate: 2021-01-29T23:34:42.847Z
Answers.LastEditDate: 2021-01-29T23:34:42.847Z
Answers.UserDisplayName: Kobina
Body: <p>De novo genome assembly for non-model organisms face the issue of bacterial contamination. For assembled contigs with mostly bacterial-like sequences (based on BLAST search), the entire contig can be dropped off. But for a long contig with small fragments of bacterial-like sequences, one way to solve it is to break the contigs into smaller pieces and drop the bacterial-like pieces. It would work better if the raw reads could be removed BEFORE assembly. This was commonly done for Illumina reads, but for PacBio long reads (non-HiFi reads) with a higher error rate, is it possible to filter contaminated bacterial sequences based on sequence similarity, like BLAST, Kraken? Of course, the potentially contaminated region should be long enough to drop the entire sequence, for PacBio long reads. Maybe 30%? Any suggestion of the processing details?</p>
  
Tags: <genome><assembly><long-reads><pacbio>
Title: Is it possible to filter contaminated reads for raw PacBio sequences (not HiFi reads) before assembly?
ThreadText: # Is it possible to filter contaminated reads for raw PacBio sequences (not HiFi reads) before assembly?
  
  (Asked by: username_0 on 2020-12-01)
  
  De novo genome assembly for non-model organisms face the issue of bacterial contamination. For assembled contigs with mostly bacterial-like sequences (based on BLAST search), the entire contig can be dropped off. But for a long contig with small fragments of bacterial-like sequences, one way to solve it is to break the contigs into smaller pieces and drop the bacterial-like pieces. It would work better if the raw reads could be removed BEFORE assembly. This was commonly done for Illumina reads, but for PacBio long reads (non-HiFi reads) with a higher error rate, is it possible to filter contaminated bacterial sequences based on sequence similarity, like BLAST, Kraken? Of course, the potentially contaminated region should be long enough to drop the entire sequence, for PacBio long reads. Maybe 30%? Any suggestion of the processing details?
  
  **Tags:** genome, assembly, long-reads, pacbio
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2020-12-01. Score: 1 | Accepted answer
  
  I don't think that in principle the issue is any different for PacBio and Illumina; it's just that the process might be noisier with higher error rates. Note that [PacBio errors aren't randomly distributed substitutions](https://www.ncbi.nlm.nih.gov/pmc/articles/PMC5553090/) and probably many (most?) short-ish k-mers (<30nt) will likely be intact. I would suggest doing k-mer filtering of your reads as suggested [here](https://www.biostars.org/p/12988/) or [here](https://www.researchgate.net/post/What_methods_programs_are_recommended_to_clean-up_a_genome_from_contaminating_reads) or [here](https://www.biostars.org/p/130/).
  
  Alternately, use your favorite alignment-based technique, if you have a good idea of what your contaminant is. In principle PB reads will be *better* filtered by this method than Illumina as local alignment will be able to figure out the errors quite well with longer queries.
  
  If you go the route of trying to do alignment to some set of contaminant references, the obvious answer would be to use [minimap2](https://github.com/lh3/minimap2) as your aligner as this is exactly the task that it is designed for. You can then use [samtools](http://www.htslib.org/) to filter out anything that maps well.
  
  Here is a related question/answer that also addresses the contaminant issue and suggests using [Blobology](https://github.com/blaxterlab/blobology), which I'm not familiar with but may be helpful (granted it also seems to be Illumina-centric). Genome-size estimation using k-mers on PB reads appears to be pretty accurate too, so I think that it's likely ok to work with raw PB k-mers.
  
  > **Comments:**
  > **username_0**: Right, the PacBio CLR reads errors are randomly distributed. Using smaller kmer is a great idea. I find the BBsketch is the fastest comparison using kmer analysis, although the documentation is embedded deep in a readme file. BBSketch could build a local NCBI nr sketch and compare reads against it in less than an hour. I am comparing the accuracy of BBSketch and Kraken (micro-organisms) now.  It might be hard to track down the sources for de novo assembly, within unknown bacteria, parasites, and even plants.  Blobology is now Blobtools2, a very nice tool I have been exploring! Thanks!  
  
  ---
  
  ### Answer by username_2 on 2021-01-29. Score: 0
  
  You can use the kraken database. It will classify your reads based on what organism it matches with. Then can write a custom script to extract the reads you are interested in for downstream analysis.
  
  
  ---
  
  