Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • colinn
    Junior Member
    • May 2015
    • 7

    #1

    how to remove first 15 bases of a sequence using unix or qiime

    So I'm pretty sure all of my sequences have a 15 base pair adaptor sequence at the beginning, and I'd like to remove it, so then my downstream analysis will play nicely within QIIME.

    I've tried changing my mapping file by adding 15bp to each barcode of (NNNNNNNNNNNNNNN), but QIIME says thats not a cool thing to do.

    I'm interested in other ways to do this, and again for the .qual file.
  • luc
    Senior Member
    • Dec 2010
    • 469

    #2
    Hi,

    I am not entirely sure what you want to achieve. But is sounds like BBduk or BB reformat could easily do it (http://seqanswers.com/forums/showthread.php?t=58221 ) as could do some simple scripts.

    Comment

    • GenoMax
      Senior Member
      • Feb 2008
      • 7142

      #3
      Can you post an example 2-3 sequences from the fasta and qual files? BBduk from BBMap can manage the fasta file trim (forcetrimleft=15) for sure but I am not certain about the qual file. You can try it yourself.

      We can always do an awk/perl solution if this does not work.
      Last edited by GenoMax; 05-13-2015, 02:37 PM. Reason: Changed parameter based on Brian's explanation

      Comment

      • Brian Bushnell
        Super Moderator
        • Jan 2014
        • 2709

        #4
        You can do that with BBDuk:

        bbduk.sh in=reads.fq out=trimmed.fq ftl=15

        If you have fasta + qual files:

        bbduk.sh in=reads.fa qfin=reads.qual out=trimmed.fa qfout=trimmed.qual ftl=15

        If not all of the reads contain that, and you only want to trim the reads that have a specific sequence, then use the flags "ktrim=l literal=X k=15" instead, where X is the sequence you want to trim. If you have lots of sequences, you can separate them with commas.

        Edit - double-ninja'd!

        @GenoMax. Sorry the numbering is a little confusing for force-trim; these are the definitions:
        Code:
        	/** Trim left bases of the read to this position (exclusive, 0-based) */
        	private final int forceTrimLeft;
        	/** Trim right bases of the read after this position (exclusive, 0-based) */
        	private final int forceTrimRight;
        	/** Trim this many rightmost bases of the read */
        	private final int forceTrimRight2;
        So to make a 100bp read 85 bp long by trimming the right end, you would say "ftr=84" or "ftr2=15"; to do so by trimming the left side, it would be "ftl=15".
        Last edited by Brian Bushnell; 05-13-2015, 02:34 PM.

        Comment

        • GenoMax
          Senior Member
          • Feb 2008
          • 7142

          #5
          Brian: Shouldn't that be ftl=14 (0-based correct)?

          Comment

          • colinn
            Junior Member
            • May 2015
            • 7

            #6
            Hi Geno-

            Here are some sample lines of the .fna file, its pretty standard.

            >SRR1502445.1
            GACTACACGTAGTATACGAGTGCGTTCCTGCGCTTATTGATATGCTTAAGTTCAGCGGGTAGTCTCACCCGATTTGAGGTCAAGGTTTGTGGGTCGAGTCACAACTCGAACATCGTCTTTGTACAAAGACGGTTGGAAGCGGGTTCCAAGGCAACACAGGGGGATAGGNNNNNNNNNNNNNNNNNNNNNNN
            >SRR1502445.2
            GACTACACGTAGTATACGAGTGCGTTCCTGCGCTTATTGATATGCTTAAGTTCAGCGGGTAGTCTCACCCGATTTGAGGTCAAGGTTTGTGGGTCGAGTCACAACTCGAACATCGTCTTTGTACAAGACGGTTGGAAGCGGGTTCCAAGGCACACAGGGGATAGGNNN
            >SRR1502445.3
            GACTACACGTAGTATACGAGTGCGTTCCTGCGCTTATTGATATGCTTAAGTTCAGCGGGTAGTCTCACCCGATTTGAGGTCAAGGTTTGTGGGTCGAGTCACAACTCGAACATCGTCTTTGTACAAAGACGGTTGGAAGCGGGTTCCAAGGCACACAGGGGATAGGNNN
            >SRR1502445.4
            GACTACACGTAGTATACGAGTGCGTTCCTGCGCTTATTGATATGCTTAAGTTCAGCGGGTAGTCTCACCCGATTTGAGGTCAAGGTTTGTGGGTCGAGTCACAACTCGAACATCGTCTTTGTACAAAGACGGTTGGAAGCGGGTTCCAAGGCACACAGGGGATAGGNNNNNNNNNNN

            Also- thanks for the BBDuk suggestions, however it'd be great to do this with just the base terminal commands rather than installing a new bioinformatics package.

            Comment

            • GenoMax
              Senior Member
              • Feb 2008
              • 7142

              #7
              No installation is required for BBMap. Download, uncompress and start using (I assume you have Java installed).

              Comment

              • SES
                Senior Member
                • Mar 2010
                • 275

                #8
                Originally posted by GenoMax View Post
                No installation is required for BBMap. Download, uncompress and start using (I assume you have Java installed).
                Those are conflicting statements, you can't accomplish not installing anything by installing something . I think I know what you mean though, no external dependencies. We don't really need anything complicated for this task, perl or awk should do fine as mentioned above.

                Here is an example using Perl:

                Code:
                perl -0076 -e 'while (<>) { chomp; my ($name, @parts) = split /\n/; my $seq = join "", @parts; next unless defined $name && defined $seq; substr($seq, 0, 15, ""); print join "\n", ">".$name, "$seq\n" }' seqs.fas
                You would repeat this for seqs.qual.
                Last edited by SES; 05-14-2015, 11:47 AM.

                Comment

                • dariober
                  Senior Member
                  • May 2010
                  • 311

                  #9
                  Originally posted by colinn View Post
                  So I'm pretty sure all of my sequences have a 15 base pair adaptor sequence at the beginning
                  Rather than clipping the first 15bp no matter what is in there I would explicitly look for the adapter sequence and trim that. There are tools for that, I use cutadapt, but I'm sure the BBtools can do it as well.

                  Comment

                  • GenoMax
                    Senior Member
                    • Feb 2008
                    • 7142

                    #10
                    Originally posted by dariober View Post
                    Rather than clipping the first 15bp no matter what is in there I would explicitly look for the adapter sequence and trim that. There are tools for that, I use cutadapt, but I'm sure the BBtools can do it as well.
                    @dario: See this thread for background.

                    Comment

                    • pmiguel
                      Senior Member
                      • Aug 2008
                      • 2328

                      #11
                      Originally posted by SES View Post

                      Here is an example using Perl:

                      Code:
                      perl -0076 -e 'while (<>) { chomp; my ($name, @parts) = split /\n/; my $seq = join "", @parts; next unless defined $name && defined $seq; substr($seq, 0, 15, ""); print join "\n", ">".$name, "$seq\n" }' seqs.fas
                      You would repeat this for seqs.qual.
                      Are we golfing?

                      perl -i'.bak' -pe 's/(>.*?\n).{15}/$1/' seqs.fas

                      perl -i'.bak' -pe 's/(>.*?\n)(\s*\d\s+){15}/$1/' seqs.qual

                      Warning: I did not test these.

                      --
                      Phillip

                      Comment

                      Latest Articles

                      Collapse

                      • SEQadmin2
                        16S/ITS Profiling vs. Shotgun Metagenomics: What Changes in Your Workflow?
                        by SEQadmin2




                        NGS has revolutionized clinical microbiology by offering new ways to identify and surveil pathogens without prior knowledge of the target. One popular approach is 16S rRNA and ITS amplicon sequencing, which targets specific microbial markers. But studies are increasingly incorporating shotgun metagenomics, a technique that sequences all DNA from a sample without targeting specific microbial markers. This approach allows more detailed taxonomic classification, detection...
                        Today, 06:46 AM
                      • 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

                      ad_right_rmr

                      Collapse

                      News

                      Collapse

                      Topics Statistics Last Post
                      Started by SEQadmin2, 10-28-2026, 09:57 AM
                      0 responses
                      22 views
                      0 reactions
                      Last Post SEQadmin2  
                      Started by SEQadmin2, 10-28-2026, 09:51 AM
                      0 responses
                      14 views
                      0 reactions
                      Last Post SEQadmin2  
                      Started by SEQadmin2, 10-22-2026, 11:13 AM
                      0 responses
                      67 views
                      0 reactions
                      Last Post SEQadmin2  
                      Started by SEQadmin2, 10-22-2026, 10:48 AM
                      0 responses
                      47 views
                      0 reactions
                      Last Post SEQadmin2  
                      Working...