How to create the node..??
Let us consider I have a file (Notepad or MS-doc) having 10 sequences with ID's A, B, C, D, E, F, G, H, I, J. I want to replace the ID's with K, L, M, N, O ,P, Q, R, S, T i.e., A to re replaced with K, B to be replaced with M and so on. How can I do this? I am a Biologist who have newly started analyzing Large data's and having this problem. Any form of advice/help will be highly appreciated.
3 answers
Your question give me the opportunity to answer using the Knime workbench and the 'fasta node' I've recently described: http://plindenbaum.blogspot.fr/2015/02/automatic-code-generation-for-knime.html
- Download knime from https://www.knime.org/downloads/overview
- Download my fasta extension from http://cardioserve.nantes.inserm.fr/~lindenb/knime/fasta/ and put the *.jar file in the plugin directory of knime : something like
.../knime_2.11.1/plugins/com.github.lindenb.xsltsandbox_2015.02.18.jar - Open knime
- Create a node to read the fasta, a node reading a file with two columns (old-name,new-name). Join both file, save the result as fasta. I've uploaded a full example on myexperiment.org: http://www.myexperiment.org/workflows/4643.html?version=1
create a new project, drag the nodes from the bottom-left pane to the project area.
You should read the manual for Knime and/or watch a few videos....
Thanks a lot...
... and you can download a pre-defined workflow from http://www.myexperiment.org/workflows/4643.html?version=1 click on
[Download Workflow]
If you are already using Galaxy you could ask your Galaxy Admin to install this tool of mine:
https://github.com/peterjc/pico_galaxy/tree/master/tools/seq_rename
http://toolshed.g2.bx.psu.edu/view/peterjc/seq_rename
This takes a sequence file (FASTA, FASTQ or even SFF format) and a name mapping table, just a tabular file where you have the old names in one column, and the new names in another column. Of course, you may still have to do some work to get the renaming information into this format...
Large data! I think you eventually have to use linux. You may have to write a a script if the fastafile is bigger to change header names.
Following command should work in linux for your case.
sed -i -e 's/>A/>K/;s/>B/>L/;s/>C/>M/;s/>D/>N/;s/>E/>O/;s/>F/>P/;s/>G/>Q/;s/>H/>R/;s/>I/>S/;s/>J/>T/' filename.fasta
I think `tr` may be useful here.
Log in to answer this question.
See Useful Bash Commands To Handle Fasta Files and http://stackoverflow.com/questions/23280240/how-to-rename-fasta-file-headers-using-sed