Question: fasta file to tab delimited file
0
gravatar for nakanomasayuki265
8 months ago by
nakanomasayuki26510 wrote:

I want to change the format of the fasta file.

>Name
AAAAAAAAAAAAAAAAAAAAAAAAA
>Fasta
BBBBBBBBBBBBBBBBBBBBBBBBBB
·
·
·

Fasta files are in a state with no line breaks except for> lines.

I would like to do this as tab delimited.

#Name AAAAAAAAAAAAAAAAAAAAAAAAA
#Fasta BBBBBBBBBBBBBBBBBBBBBBBBB
#·
#·
#·

What kind of commands and scripts are there? Could you please tell me?

sequence • 742 views
ADD COMMENTlink modified 8 months ago by Alex Reynolds21k • written 8 months ago by nakanomasayuki26510

This sounds like an XY problem. Can you explain what you are trying to accomplish?

ADD REPLYlink written 8 months ago by Brian Bushnell14k
2
gravatar for Alex Reynolds
8 months ago by
Alex Reynolds21k
Seattle, WA USA
Alex Reynolds21k wrote:

Sure, just use awk:

$ awk 'BEGIN{RS=">"}{print "#"$1"\t"$2;}' in.fa | tail -n+2 > out.txt
ADD COMMENTlink modified 8 months ago • written 8 months ago by Alex Reynolds21k

Alternative: awk 'BEGIN{RS=">";OFS="\t"}NR>1{print "#"$1,$2}' inFile > outFile

ADD REPLYlink modified 8 months ago • written 8 months ago by 5heikki6.7k

Hey, do you know how to change tab delimited back to fasta format?

ADD REPLYlink written 4 months ago by yangzituo0

like:

seq1  AAAATTTT
seq2 CCCCGGGG

convert it back to:

>seq1
AAAATTTT
>seq2
CCCCGGGG

Thanks~

ADD REPLYlink modified 4 months ago • written 4 months ago by yangzituo0

seqkit

seqkit tab2fx xxx.tab > xxx.fasta
ADD REPLYlink written 4 months ago by shenwei3563.4k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 759 users visited in the last hour