convert tabular data to fasta
2
0
Entering edit mode
6 weeks ago
zahra • 0

Hello all,

I have a text file whose first column is the name of the transcript and the second column is the nucleotide sequence. My question is how to convert this text file to fasta in Linux ?

TCONS_00000128
CGTAACCTGAGGTTTATTCCGGATATGGCTCAGAGCAgtgatcattatcaaatgaGTTGTCAGCGTCAACAGTGATCTCGTTGAATTCTGGCATCCGGCAGCTGGTCTGGGGATTTCTGAAGA
TCONS_00000042
GATTGATGACCGTCGCCGAAGAGATAGTATTCCGGGTCCATTCGGCCTATACCGACGACGTTGACGGACTGGTGGCGATATAACTATCGAGGTTCCTCGTTCGAAGGTATCGGTTAT
linux forum convert fasta • 309 views
ADD COMMENT
1
Entering edit mode
6 weeks ago
sed 's/^/>/;s/[ \t]/\n/' in.txt
ADD COMMENT
0
Entering edit mode

Thank you for your response

ADD REPLY
0
Entering edit mode
6 weeks ago
$ seqkit -w 0 tab2fx <input.fa> -o <output.fa(.gz)>
$ awk -v OFS="\n" '{print ">"$1,$2}' test.txt
$ awk -v OFS="\n" '{$1=">"$1}1' test.txt
$ sed  's/^/>/;s/\t/\n/' test.txt 
$ sed -r 's/^(.*)\t(.*)/>\1\n\2/' test.txt
$ parallel --colsep '\t' echo '\>'{1}'\\n'{2} :::: test.txt
ADD COMMENT
0
Entering edit mode

Thank you for your complete answer

ADD REPLY

Login before adding your answer.

Traffic: 1019 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