Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • illinu
    Member
    • Jul 2013
    • 55

    #1

    Trim off variable length 'N' strings at the end of the read

    Hi,

    I need to remove all 'N' strings in a fastq file. I have paired end files and there are N strings at the end of some reads of variable length (both the reads and the N strings are of variable length). I can't find any tool to do this. Trimmomatic will remove bases based on their quality score. Fastx_trimmer will keep 'x' first bases.

    Anyone has a script for this or knows of a tool? It is important that the tool deals with paired files and keeps the pairs 'alive' after trimming in both files.

    ps: I tried to install nesoni but I am uncapable to do this in the server without root permisions and an older python version.

    Thanx
    Illinu
  • dpryan
    Devon Ryan
    • Jul 2011
    • 3478

    #2
    Aren't the quality scores of the Ns very low? Trimming by quality will normally remove stretches of them (at least unless they're in the middle, which happens).

    Comment

    • Brian Bushnell
      Super Moderator
      • Jan 2014
      • 2709

      #3
      As dpryan said, quality-trimming should suffice; Ns should have a quality of zero, so you can just set the quality-trim threshold at 1. For example, with BBTools:

      reformat.sh in1=read1.fq in2=read2.fq out1=trimmed1.fq out2=trimmed2.fq qtrim=rl trimq=1

      That will keep the pairs together. That program will also automatically convert the quality of Ns to zero, if they happen to be non-zero.

      Comment

      • SES
        Senior Member
        • Mar 2010
        • 275

        #4
        You can trim poly-Ns with PRINSEQ. There are (at least) three options to control the trimming, one to specify the minimum length of Ns at the 3-prime end, another option to specify the maximum N percentage to allow, and one option to specify the max number of Ns to allow.

        Code:
        -trim_ns_right <integer>
                    Trim poly-N tail with a minimum length of trim_ns_right at the
                    3'-end.
        
        -ns_max_p <integer>
                    Filter sequence with more than ns_max_p percentage of Ns.
        
        -ns_max_n <integer>
                    Filter sequence with more than ns_max_n Ns.

        Comment

        • illinu
          Member
          • Jul 2013
          • 55

          #5
          SES, thank you for this tip I think it's the approach I was looking for.
          To answer the previous posts, I checked precisely this and surprisingly the scores are high. I don't understand why but I was expecting them to be null if nothing.

          Comment

          • illinu
            Member
            • Jul 2013
            • 55

            #6
            Originally posted by SES View Post
            You can trim poly-Ns with PRINSEQ. There are (at least) three options to control the trimming, one to specify the minimum length of Ns at the 3-prime end, another option to specify the maximum N percentage to allow, and one option to specify the max number of Ns to allow.

            Code:
            -trim_ns_right <integer>
                        Trim poly-N tail with a minimum length of trim_ns_right at the
                        3'-end.
            
            -ns_max_p <integer>
                        Filter sequence with more than ns_max_p percentage of Ns.
            
            -ns_max_n <integer>
                        Filter sequence with more than ns_max_n Ns.
            SES, I am thinking now... this will not handle paired files right?

            Comment

            • Brian Bushnell
              Super Moderator
              • Jan 2014
              • 2709

              #7
              Originally posted by illinu View Post
              To answer the previous posts, I checked precisely this and surprisingly the scores are high. I don't understand why but I was expecting them to be null if nothing.
              But like I said, BBTools will automatically change the quality of N bases to 0, because it makes no sense for them to have any other quality. So they will be trimmed anyway.

              Comment

              • SES
                Senior Member
                • Mar 2010
                • 275

                #8
                Originally posted by illinu View Post
                SES, I am thinking now... this will not handle paired files right?
                Yes, I believe recent versions of PRINSEQ will handle paired-end files correctly. If you run into issues, you could use Pairfq to re-pair your reads and separate the singletons after trimming.

                Comment

                • illinu
                  Member
                  • Jul 2013
                  • 55

                  #9
                  I tried the bbmap option and it worked beautifully! Only 5 minutes wallclock time. The programs needs no installation it runs with java.

                  Comment

                  Latest Articles

                  Collapse

                  • 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
                    ...
                    Yesterday, 10:25 AM
                  • SEQadmin2
                    How Immunogenomics Decodes Immunity’s Genetic Blueprint
                    by SEQadmin2




                    The immune system’s power comes from its genetic diversity, allowing myriad threats to be neutralized through first recognizing foreign antigens. That diversity is also what makes the immune system so difficult to study. Recent advances in sequencing technology and computational biology, however, are giving researchers new tools to understand immune responses and immune-related diseases in greater detail.

                    This convergence of genetics, immunology, and computation...
                    09-01-2026, 05:41 AM

                  ad_right_rmr

                  Collapse

                  News

                  Collapse

                  Topics Statistics Last Post
                  Started by SEQadmin2, Today, 09:51 AM
                  0 responses
                  9 views
                  0 reactions
                  Last Post SEQadmin2  
                  Started by SEQadmin2, 09-25-2026, 09:06 AM
                  0 responses
                  32 views
                  0 reactions
                  Last Post SEQadmin2  
                  Started by SEQadmin2, 09-23-2026, 11:05 AM
                  0 responses
                  27 views
                  0 reactions
                  Last Post SEQadmin2  
                  Started by SEQadmin2, 09-18-2026, 11:37 AM
                  1 response
                  48 views
                  0 reactions
                  Last Post pekgio
                  by pekgio
                   
                  Working...