cutadapt software command to trim the primer sequences
1
1
Entering edit mode
8.1 years ago

Hi guys, I am trying to trim my primer sequences off my sequence data. I wrote the command with cutadapt.

cutadapt -g F-primer sequence -o output file name  directory of input file/input file name

it could cut the forward primer off. but if I use the same command for reverse primers

cutadapt -a R-primer sequence -o output file name  directory of input file/input file name

it did not work. I tried to put the reverse complementary sequence of the 3´ sequence of the primer, it did not work either. If I merge the 2 reads and do the cutadapt,

cutadapt -a <3´sequence>  -g <forward primer sequence> -o <output file name> directory of input file/input file name

neither works. So I wonder if anyone can give me some suggestions on how to make the right command, or is there any better software to use to trim the primer sequences?

Thanks Ramona

sequencing • 10.0k views
ADD COMMENT
1
Entering edit mode

Can you use spacing to make your question clear - description and commands in separate lines. It is really confusing to see the commands you tried between the description you provided.

ADD REPLY
0
Entering edit mode

oh, sorry. It is actually like this: cutadapt -g <f-primer sequence=""> -o <output file="" name=""> <directory of="" input="" file="" input="" file="" name="">

cutadapt -a <r-primer sequence=""> -o <output file="" name=""> <directory of="" input="" file="" input="" file="" name=""> (this is for the reverse primer cutting, but I tried both reverse complementary sequence of the 3´sequence and the 3´sequence without making the reverse complementary, both did not work)

As for the sequence I merge with PEAR, I tried to trim the primers with the command below, it did not work

cutadapt -g <f-primer sequence=""> -a <r-primer sequence=""> -o <output file="" name=""> <directory of="" input="" file="" input="" file="" name="">

ADD REPLY
1
Entering edit mode

I do not know which version of cutadapt is being used here. This is the usual command I use -

cutadapt -A Rprimer -a Fprimer -o out_PE1 -p out_PE2 in_PE1 in_PE2

For single-end data

cutadapt -A Rprimer -a Fprimer -o outfile_SE infile_SE

ADD REPLY
0
Entering edit mode

Sorry I don't understand the question. Where did PEAR come from in between?

Are you using single-end data or paired-end. Which version of cutadapt are you using, and what is your primer sequence? And what is the actual command you tried (the complete command with file names and paths if possible). It is unclear what is the problem without letting us know what has been tried on your side.

Did you check the cutadapt manual - http://cutadapt.readthedocs.io/en/stable/guide.html The following is an example only -

cutadapt -a ATGCATGC -g GCATGCAT -o /path/to/file/outputfile.fastq /path/to/file/inputfile.fastq

ADD REPLY
0
Entering edit mode

Hi Rohit, I used the version of cutadapt==1.9.1 I think as i installed from this website : http://cutadapt.readthedocs.io/en/stable/installation.html. I used pair-end data, and the primer sequence is 20bp nucleotides used to amplify the target gene. I did follow the rules of the manual as I understand to put the command cutadapt -a <r-primer> -g <f-primer> -o /path/input file/input file name

the input file could be Read1(no need to add -a as I understand) or the merged file of Read1 and Read2. I could trim the forward primer by only putting the Read1 and -g <f-primer>, but not the reverse primer by using command cutadapt -a<r-primer>. Hope my explanation is clear

ADD REPLY
1
Entering edit mode

I think you are missing an output file in the command, since -o requires a file to hold the data. The command below is for single-end data only or the merged reads you mention.

cutadapt -a <r-primer> -g <f-primer> -o /path/outputfile /path/inputfile

If it is paired end data, then you would need to use two outputs and two inputs as below

cutadapt -a <r-primer> -g <f-primer> -o /path/outputfile1 -p /path/outputfile2 /path/inputfile1 /path/inputfile2

Also, can you show the error log incase there is something missing which went unnoticed.

ADD REPLY
1
Entering edit mode

Hi. I also had the same problem

cutadapt -u 4 –a GTCTCGTGGGCTCGGAGATGTGTATAAGAGACAGGACTACHVGGGTATCTAATCC –g TCGTCGGCAGCGTCAGATGTGTATAAGAGACAGNNNNCCTACGGGNGGCWGCAG –o 21I-C1_S2_L001_R1_001_t.fastq -p 21I-C1_S2_L001_R2_001_t.fastq 21I_C1 21I-C1_S2_L001_R1_001.fastq 21I-C1_S2_L001_R2_001.fastq

I tried to remove the f and r primers with the removal of first 4 bases for each read but this error came out

shaufi@ppplives-Precision-T5610[cutadapt-1.11] cutadapt -u 4 –a GTCTCGTGGGCTCGGAGATGTGTATAAGAGACAGGACTACHVGGGTATCTAATCC –g TCGTCGGCAGCGTCAGATGTGTATAAGAGACAGNNNNCCTACGGGNGGCWGCAG –o 21I-C1_S2_L001_R1_001_t.fastq -p 21I-C1_S2_L001_R2_001_t.fastq 21I_C1 21I-C1_S2_L001_R1_001.fastq 21I-C1_S2_L001_R2_001.fastq

/usr/lib/python2.7/dist-packages/pkg_resources.py:1031: UserWarning: /home/shaufi/.python-eggs is writable by group/others and vulnerable to attack when used with get_resource_filename. Consider a more secure location (set with .set_extraction_path or the PYTHON_EGG_CACHE environment variable). warnings.warn(msg, UserWarning) cutadapt version 1.11 Copyright (C) 2010-2016 Marcel Martin marcel.martin@scilifelab.se

cutadapt removes adapter sequences from high-throughput sequencing reads.

Usage: cutadapt -a ADAPTER [options] [-o output.fastq] input.fastq

For paired-end reads: cutadapt -a ADAPT1 -A ADAPT2 [options] -o out1.fastq -p out2.fastq in1.fastq in2.fastq

Replace "ADAPTER" with the actual sequence of your 3' adapter. IUPAC wildcard characters are supported. The reverse complement is not automatically searched. All reads from input.fastq will be written to output.fastq with the adapter sequence removed. Adapter matching is error-tolerant. Multiple adapter sequences can be given (use further -a options), but only the best-matching adapter will be removed.

Input may also be in FASTA format. Compressed input and output is supported and auto-detected from the file name (.gz, .xz, .bz2). Use the file name '-' for standard input/output. Without the -o option, output is sent to standard output.

Citation:

Marcel Martin. Cutadapt removes adapter sequences from high-throughput sequencing reads. EMBnet.Journal, 17(1):10-12, May 2011. http://dx.doi.org/10.14806/ej.17.1.200

Use "cutadapt --help" to see all command-line options. See http://cutadapt.readthedocs.org/ for full documentation.

cutadapt: error: Too many parameters. shaufi@ppplives-Precision-T5610[cutadapt-1.11] [12:03]

What do you think could be the problem? Thanks

ADD REPLY
0
Entering edit mode

Please post this as another question.

ADD REPLY
0
Entering edit mode

Thanks a lot, Rohit. I am running another round of sequencing now, and I will try this. See if it works.

ADD REPLY
0
Entering edit mode
7.5 years ago
a.a.kechin ▴ 20

Try cutPrimers: https://github.com/aakechin/cutPrimers. It's specialized on the cutting primer sequences from the NGS reads! If you have any questions on using it, you can contact me

ADD COMMENT

Login before adding your answer.

Traffic: 2557 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6