GUI apps are nice, but please consider carefully the use of Windows apps (or Microsoft apps on a Mac) to edit text files. These tools tend to add CR (carriage return) characters that are easy to remove (if you know about them) but otherwise can cause hidden misery for some open-source bioinformatics tools when used on Linux or OS X (or other UNIXes).
Hello,
I am struggling to convert a file with nucleotide sequences into an actual fasta file (i.e. with the ">" seq_name / enter sequence format). I am following the strategy below, but any other suggestion is warmly welcome. I am trying to convert the following type of file:
>kmer_1 AAAAAAAAAAAAAAAAAAAAAAAACCCACCCA
>kmer_2 AAAAAAAAAAAAAAAAAAAAAAACAGAGATGT
>kmer_3 AAAAAAAAAAAAAAAAAAAAAAACCCACCCAC
>kmer_4 AAAAAAAAAAAAAAAAAAAAAACAGAGATGTA
>kmer_5 AAAAAAAAAAAAAAAAAAAAAACCCACCCACA
>kmer_6 AAAAAAAAAAAAAAAAAAAAAAGAAGAGAAAA
> kmer_7 AAAAAAAAAAAAAAAAAAAAACCCACCCACAT
>kmer_8 AAAAAAAAAAAAAAAAAAAAAGAAGAGAAAAA
>kmer_9 AAAAAAAAAAAAAAAAAAAAAGAGAACGACAC
>kmer_10 AAAAAAAAAAAAAAAAAAAACCCACCCACATG
Into something like this:
>kmer_1
AAAAAAAAAAAAAAAAAAAAAAAACCCACCCA
>kmer_2
AAAAAAAAAAAAAAAAAAAAAAACAGAGATGT
>kmer_3
AAAAAAAAAAAAAAAAAAAAAAACCCACCCAC
>kmer_4
AAAAAAAAAAAAAAAAAAAAAACAGAGATGTA
>kmer_5
AAAAAAAAAAAAAAAAAAAAAACCCACCCACA
>kmer_6
AAAAAAAAAAAAAAAAAAAAAAGAAGAGAAAA
>kmer_7
AAAAAAAAAAAAAAAAAAAAACCCACCCACAT
>kmer_8
AAAAAAAAAAAAAAAAAAAAAGAAGAGAAAAA
>kmer_9
AAAAAAAAAAAAAAAAAAAAAGAGAACGACAC
>kmer_10
AAAAAAAAAAAAAAAAAAAACCCACCCACATG
Any idea on how to do it by using either paste, awk, etc? Thanks in advance
3 answers
Assuming tab as delimiter:
tr "\t" "\n" < your.file
For this type of simple conversion , I would use regex based find-and-replace features of text editors like Notepad++, provided the file is not too big for the editor to open .

No problem for Notepad++, you can convert EOLs to unix style '\n' to windows '\r\n' and vice versa, under the EDIT-> EOL Conversion menu
I'd still recommend against GUI for such minor low-context edits. GUI apps make sense when editing scripts (where there is a bunch of back-and-forth navigation and the context of the edit matters a lot), but delimited files are seldom complicated enough to warrant GUI editing.
Hi, thanks to those who replied this question. I ended up doing it differently:
cat kmer_name.txt
>kmer_1
>kmer_2
>kmer_3
>kmer_4
>kmer_5
>kmer_6
>kmer_7
>kmer_8
>kmer_9
>kmer_10
cat kmer_seq.txt
AAAAAAAAAAAAAAAAAAAAAAAACCCACCCA
AAAAAAAAAAAAAAAAAAAAAAACAGAGATGT
AAAAAAAAAAAAAAAAAAAAAAACCCACCCAC
AAAAAAAAAAAAAAAAAAAAAACAGAGATGTA
AAAAAAAAAAAAAAAAAAAAAACCCACCCACA
AAAAAAAAAAAAAAAAAAAAAAGAAGAGAAAA
AAAAAAAAAAAAAAAAAAAAACCCACCCACAT
AAAAAAAAAAAAAAAAAAAAAGAAGAGAAAAA
AAAAAAAAAAAAAAAAAAAAAGAGAACGACAC
AAAAAAAAAAAAAAAAAAAACCCACCCACATG
And then simply changed the way I pasted both files:
paste -d '\n' kmer_name.txt kmer_seq.txt > kmer_name_seq.txt
cat kmer_name_seq.txt
>kmer_1
AAAAAAAAAAAAAAAAAAAAAAAACCCACCCA
>kmer_2
AAAAAAAAAAAAAAAAAAAAAAACAGAGATGT
>kmer_3
AAAAAAAAAAAAAAAAAAAAAAACCCACCCAC
>kmer_4
AAAAAAAAAAAAAAAAAAAAAACAGAGATGTA
>kmer_5
AAAAAAAAAAAAAAAAAAAAAACCCACCCACA
>kmer_6
AAAAAAAAAAAAAAAAAAAAAAGAAGAGAAAA
>kmer_7
AAAAAAAAAAAAAAAAAAAAACCCACCCACAT
>kmer_8
AAAAAAAAAAAAAAAAAAAAAGAAGAGAAAAA
>kmer_9
AAAAAAAAAAAAAAAAAAAAAGAGAACGACAC
>kmer_10
AAAAAAAAAAAAAAAAAAAACCCACCCACATG
Your question speaks about a single file with tab-delimited content whereas your solution refers to 2 separate files. I think your question should have been clearer, because otherwise it is a waste of contributors' time. Please be more careful in the future.
Log in to answer this question.
C: fasta file to tab delimited file
tab to fasta file conversion
What strategy? You didn't show anything you tried.