convert unique tags to fasta
I have a large fasta file of microRNA where unique tag is there in form of
>sequence1_x5
AGCTAGCTAGCTAGCT
>sequence2_x15
ATCTATCTATCT
and i want to convert into individual fasta file as
>1
AGCTAGCTAGCTAGCT
>2
AGCTAGCTAGCTAGCT
>3
AGCTAGCTAGCTAGCT
>4
AGCTAGCTAGCTAGCT
>5
AGCTAGCTAGCTAGCT
>6
ATCTATCTATCT
>7
ATCTATCTATCT
and so on....
I am new to bioinformatics kindly help
• 1,425 views
•
link
1 answer
Hi manishbiotechie,
You can try:
$ cat input.fasta
>sequence1_x5
AGCTAGCTAGCTAGCT
>sequence2_x15
ATCTATCTATCT
$ cat input.fasta | awk 'BEGIN{RS=">"; i=1} NR>1 {gsub(".+_x", "", $1); {while ($1--) {print ">" i "\n" $2; i++}}}'
>1
AGCTAGCTAGCTAGCT
>2
AGCTAGCTAGCTAGCT
>3
AGCTAGCTAGCTAGCT
>4
AGCTAGCTAGCTAGCT
>5
AGCTAGCTAGCTAGCT
>6
ATCTATCTATCT
>7
ATCTATCTATCT
>8
ATCTATCTATCT
>9
ATCTATCTATCT
>10
ATCTATCTATCT
>11
ATCTATCTATCT
>12
ATCTATCTATCT
>13
ATCTATCTATCT
>14
ATCTATCTATCT
>15
ATCTATCTATCT
>16
ATCTATCTATCT
>17
ATCTATCTATCT
>18
ATCTATCTATCT
>19
ATCTATCTATCT
>20
ATCTATCTATCT
• 0 views
•
link
Log in to answer this question.
its not taking the right format i have asked question in fasta format but some error is there while posting
Please use the formatting bar (especially the

codeoption) to present your post better. I've done it for you this time.Thank you!
See the first answer in this thread: Renaming Entries In A Fasta File
This returns:
Without considering
x5andx15.Indeed. Left here as an inspiration. Useful for anyone else who may find this thread by search.