Thanks, this should work for me.
As a follow-up to an earlier question, I am trying to figure out how to use seqkit to change duplicated read names
Unfortunately, the documentation and help for rename are very limited, and I don't see how the example listed can be applied to a case like mine:
https://bioinf.shenwei.me/seqkit/usage/#rename
Specifically, if I have a fastq sequence where two different reads have the same name, what do I do to append an _N to the second occurrence of a name?
In other words, given file.fastq, what input and output arguments do I need to apply so that seqkit rename <some arguments> file.fastq <some arguments> outfile.fastq
Returns outfile fastq with duplicate names changes to <name>_N
1 answer
Besides seqkit you can also use rename.sh from BBMap suite.
rename.sh in=<file> in2=<file2> out=<outfile> out2=<outfile2> addpairnum=t
Back to your seqkit question.
$ more test.fq
@HWI-D00:74:H1493:2:1101:1186:2441
TTTTCTGCTACACTTCGAAAAACATATGATTCGTCTTTTCAGTTAGTTAAATATGTCTATAAGATGCCATCAATTAAAAAAAGTAACTTCACTATAATCG
+
CCCFFFFFGHHHGIEIJIJJGIIJJJJJHIJIGGGIJJJIJIIIJJJJJJJIJJJGIJJEIIIJJJJFHGIFIIGHIHHHFDD@CDDEEDDDDDDDDEDD
@HWI-D00:74:H1493:2:1101:1186:2441
TTTTCTGCTACACTTCGAAAAACATATGATTCGTCTTTTCAGTTAGTTAAATATGTCTATAAGATGCCATCAATTAAAAAAAGTAACTTCACTATAATCG
+
CCCFFFFFGHHHGIEIJIJJGIIJJJJJHIJIGGGIJJJIJIIIJJJJJJJIJJJGIJJEIIIJJJJFHGIFIIGHIHHHFDD@CDDEEDDDDDDDDEDD
You will now do. It will add a _2 to duplicate name for second sequence at end of fastq header
$ seqkit rename test.fq
@HWI-D00:74:H1493:2:1101:1186:2441
TTTTCTGCTACACTTCGAAAAACATATGATTCGTCTTTTCAGTTAGTTAAATATGTCTATAAGATGCCATCAATTAAAAAAAGTAACTTCACTATAATCG
+
CCCFFFFFGHHHGIEIJIJJGIIJJJJJHIJIGGGIJJJIJIIIJJJJJJJIJJJGIJJEIIIJJJJFHGIFIIGHIHHHFDD@CDDEEDDDDDDDDEDD
@HWI-D00:74:H1493:2:1101:1186:2441_2
TTTTCTGCTACACTTCGAAAAACATATGATTCGTCTTTTCAGTTAGTTAAATATGTCTATAAGATGCCATCAATTAAAAAAAGTAACTTCACTATAATCG
+
CCCFFFFFGHHHGIEIJIJJGIIJJJJJHIJIGGGIJJJIJIIIJJJJJJJIJJJGIJJEIIIJJJJFHGIFIIGHIHHHFDD@CDDEEDDDDDDDDEDD
Log in to answer this question.
What have you tried? Create a model input from your FASTQ (with ~10 unique reads and maybe 1-2 duplicates) and test against it - the manual is pretty straightforward on how to use the tool. Pro-tip: Use the
-njust in case. Try the-nwith the examples below to see the difference:Note that
seqkit renamewill not give you<full_name_line>_Nbut<id_part>_N <rest_of_name_line>.