Question: fasta file to tab delimited file
0
gravatar for nakanomasayuki265
6 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 • 527 views
ADD COMMENTlink modified 6 months ago by Alex Reynolds20k • written 6 months ago by nakanomasayuki26510

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

ADD REPLYlink written 6 months ago by Brian Bushnell13k
2
gravatar for Alex Reynolds
6 months ago by
Alex Reynolds20k
Seattle, WA USA
Alex Reynolds20k wrote:

Sure, just use awk:

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

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

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

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

ADD REPLYlink written 11 weeks ago by yangzituo0

like:

seq1  AAAATTTT
seq2 CCCCGGGG

convert it back to:

>seq1
AAAATTTT
>seq2
CCCCGGGG

Thanks~

ADD REPLYlink modified 11 weeks ago • written 11 weeks ago by yangzituo0

seqkit

seqkit tab2fx xxx.tab > xxx.fasta
ADD REPLYlink written 11 weeks ago by shenwei3563.2k
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: 1465 users visited in the last hour