Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ebioman
    Member
    • Aug 2013
    • 41

    #1

    Filtering PacBio reads

    Hello

    I am dealing with a rather common problem which gives me real headaches with PacBio data:

    How can you filter your reads prior assembly ?

    Note: I am not talking about subread filtering, quality filtering and so on, but filtering for "contamination".

    E.g. Assembling a genome and filtering known metagenomes, or filtering only mitochondrial reads and assembling its genome from a sequenced organism ,.....

    So, what I am looking for is a possibility to filter the *.h5 files and only use certain ones for the assembly. I guess one would have to parse the files, but with the h5 format that is a little bit beyond my scope.
    For some modules (e.g. Allora) FASTA can be provided, but for other ones not (e.g. HGAP).

    Anybody ideas ?
  • flxlex
    Moderator
    • Nov 2008
    • 412

    #2
    Have a look here: https://github.com/PacificBioscience...filtering-step. Does that answer your question?

    Comment

    • ebioman
      Member
      • Aug 2013
      • 41

      #3
      On the first glance, it seems exactly what I was looking for - thanks !
      Will test it over night

      Comment

      • colindaven
        Senior Member
        • Oct 2008
        • 417

        #4
        Great, thanks for the link. The tutorial is even working (!).

        Comment

        • OstanNick
          Member
          • Apr 2014
          • 26

          #5
          Hello,

          I'm following the whitelist tutorial and have encountered an error where I have to use their python script to generate the whitelist.txt.

          I'm using my own PacBio data as opposed to the data provided, but I don't think that it should make a difference.

          When I run the python script, this is the error I encounter:

          Traceback (most recent call last):
          File "whitelist.py", line 20, in <module>
          hole_num = alignment_id_parts[1]
          IndexError: list index out of range

          Which I believe means that when the list is generated from splitting the first column at the '/', it is not generating any more than one list element.

          Is anybody else encountering this issue?

          Regards,
          Nick

          Comment

          • rhall
            Senior Member
            • Aug 2012
            • 324

            #6
            Can you post an example of your alignment output?
            Code:
            head <align output file>
            The script isn't very robust, any deviation in the blasr output will cause issues.
            Thanks.

            Comment

            • OstanNick
              Member
              • Apr 2014
              • 26

              #7
              I got it working but had to change around my script a bit. I had to change the headers to look like:

              Code:
              qName/qHole/qAlign tName qStrand tStrand score percentSimilarity tStart tEnd tLength qStart qEnd qLength nCells
              m130726_012611_42158_c100524682550000001823080609281382_s1_p0/72/2066_4077 gi|556503834|ref|NC_000913.3| 0 0 -828 91.0891 366290 366482 4641652 2118 2314 4346 4145
              Because it wasn't properly splitting at the space separations.

              I changed the code to just include my one movie file:

              Code:
              import sys
              
              # NOTE: this script assumes a single movie in the blasr alignment
              
              blacklist_alignment = sys.argv[1]
              num_holes = int(sys.argv[2])
              
              blacklist = set()
              movie_prefix = 'm130726_012611_42158_c100524682550000001823080609281382_s1_p0'
              for line in open(blacklist_alignment):
                  if line.startswith('qname'):
                      continue
              
                  cols = line.split()
              
                  alignment_id_parts = cols[0].split('/')
              
                  hole_num = alignment_id_parts[1]
              
                  blacklist.add(hole_num)
              
              for i in range(num_holes):
                  i = str(i)
                  if i not in blacklist:
                      print '/'.join([movie_prefix, i])
              I got my whitelist.txt output to look like such:

              Code:
              m130726_012611_42158_c100524682550000001823080609281382_s1_p0/0
              m130726_012611_42158_c100524682550000001823080609281382_s1_p0/1
              m130726_012611_42158_c100524682550000001823080609281382_s1_p0/2
              m130726_012611_42158_c100524682550000001823080609281382_s1_p0/3
              m130726_012611_42158_c100524682550000001823080609281382_s1_p0/4
              
              ...
              Does including the following parameter in the settings.xml file:

              Code:
               <param name="whiteList" label="Read IDs to whitelist">
                          <value>/home/USERNAME/BACassembly/whitelist.txt</value>
                          </param>
              Automatically let Smrtpipe know that I want to include those reads as on a whitelist?
              In other words, does Smrtpipe have a whitelist function built into it? I would have expected more code to be required.

              Comment

              • rhall
                Senior Member
                • Aug 2012
                • 324

                #8
                Yes SMRT Pipe should filter out the reads if passed that parameter. Technically an extra filter is passed to the filtering task, you can check workflow/P_Filter/filter_?of?.sh to make sure the ReadWhilelist parameter is present:
                Code:
                filterPlsH5.py --debug --filter='MinReadScore=0.80,MinSRL=500,MinRL=100,ReadWhitelist=/home/USERNAME/BACassembly/whitelist.txt ......'

                Comment

                • OstanNick
                  Member
                  • Apr 2014
                  • 26

                  #9
                  The whitelisting tutorial online is a good one, but it doesn't specify the format the whitelist would need to be if you wanted to run multiple SMRT cells with their own whitelisted reads.

                  What format would the whitelist file need to be in, in order to run say 8 smrt cells all of which are decontaminated?


                  "...Note whitelisting in this tutorial assumes that you are working on one cell of data at a time (1x bas.h5 file, or 3x bax.h5 files), it could be expanded to run on multiple cells with some changes to the code."

                  Comment

                  • rhall
                    Senior Member
                    • Aug 2012
                    • 324

                    #10
                    The whitelist file is in the same format, e.g.
                    m130726_012611_42158_c100524682550000001823080609281382_s1_p0/0

                    The cell/file name would just be different. The note in the tutorial is because the tutorial whitelists the reads that do not map to ecoli, therefore the script needs to take the 'inverse' of the reads that map to ecoli, this is only really simple for a single cell.
                    To make the script work on multiple cells it would need to be expanded to keep track of all the cells, the alternative is to generate the whitelist for each cell, then join them together to get a whitelist for running a job on all the cells.

                    Comment

                    • OstanNick
                      Member
                      • Apr 2014
                      • 26

                      #11
                      Awesome, thank you for your reply.

                      So basically a whitelist encompassing more than one cell could look like:

                      <cell_1>_s1_p0/0
                      <cell_1>_s1_p0/2
                      <cell_1>_s1_p0/5
                      ....
                      <cell_1>_s1_p0/81740
                      <cell_2>_s1_p0/1
                      <cell_2>_s1_p0/2
                      <cell_2>_s1_p0/6

                      Such that subsequent whitelists are basically appended to the previous one?

                      Regards,
                      Nick

                      Comment

                      • rhall
                        Senior Member
                        • Aug 2012
                        • 324

                        #12
                        Exactly

                        Comment

                        • seb.lees
                          Member
                          • Sep 2012
                          • 12

                          #13
                          New link for the whitelist tutorial ?

                          Originally posted by flxlex View Post
                          Have a look here: https://github.com/PacificBioscience...filtering-step. Does that answer your question?
                          Hi all,

                          It seems that the previous link doesn't redirect to the correct page anymore (at least for me).

                          Nonetheless, I found the whitelist tutorial at this location:

                          GitHub is where people build software. More than 225 million people use GitHub to discover, fork, and contribute to over 800 million projects.


                          Can the whitelist procedure be implemented in SMRT Portal ? It is a very standard filtering step which would benefit to be run in a user-friendly way.

                          Seb.

                          Comment

                          • OstanNick
                            Member
                            • Apr 2014
                            • 26

                            #14
                            Indeed, it can be implemented but it requires some XML coding. If you just follow the tutorial, and don't do the last part of it (the SMRTpipe part), and make your own custom protocol using the whitelist filtering parameter, you can specify the path to your whitelist in smrtportal as a parameter in the filtering step and it will use the whitelist to filter your reads

                            Comment

                            • seb.lees
                              Member
                              • Sep 2012
                              • 12

                              #15
                              Ok, thanks.

                              But I need to practice more bas.h5 manipulation and protocol creation first, as I'm very new with PacBio data.

                              Actually I don't have my own data yet, so I'm practicing with tutorials data. By the way, do you know where can I find publicly available cosmid sequencing data under the PacBio format ?

                              Comment

                              Latest Articles

                              Collapse

                              • SEQadmin2
                                Multiomic Liquid Biopsy: What DNA/RNA Panels Reveal That DNA Alone Can’t
                                by SEQadmin2



                                Tumors contain complex mixtures of cell populations that evolve in response to treatment and host-specific factors. Tissue biopsies provide only static snapshots of a tumor’s state. But what if we could follow that evolution over time using a minimally invasive technique?

                                Liquid biopsies can detect tumor-derived material circulating in the bloodstream, providing a way to study treatment response, detect emerging resistance, and discover new biomarkers. Circulating
                                ...
                                10-14-2026, 09:55 AM
                              • SEQadmin2
                                New Genomics Technologies Take Aim at Long-Standing Limits
                                by SEQadmin2


                                Researchers using sequencing and genomics tools often have to make trade-offs. They can choose between speed or scale, short reads or long-range information, or targeted panels or a view of the whole transcriptome. New technologies that have been released this year are built to address those tough choices.

                                We asked six companies the same four questions to learn about their latest products. The new technologies bring a lot to the table, including rethinking sequencing
                                ...
                                09-28-2026, 10:25 AM

                              ad_right_rmr

                              Collapse

                              News

                              Collapse

                              Topics Statistics Last Post
                              Started by SEQadmin2, 10-15-2026, 10:52 AM
                              0 responses
                              28 views
                              0 reactions
                              Last Post SEQadmin2  
                              Started by SEQadmin2, 10-14-2026, 05:39 AM
                              0 responses
                              36 views
                              0 reactions
                              Last Post SEQadmin2  
                              Started by SEQadmin2, 10-13-2026, 09:56 AM
                              0 responses
                              31 views
                              0 reactions
                              Last Post SEQadmin2  
                              Started by SEQadmin2, 10-09-2026, 11:14 AM
                              0 responses
                              29 views
                              0 reactions
                              Last Post SEQadmin2  
                              Working...