fast way to change the title name
2
0
Entering edit mode
7.5 years ago

Dear all,

I want to change the header of big fasta file as this:

>JH208680.1 dna:scaffold scaffold:PelSin_1.0:JH208680.1:1:16024077:1 REF

CTACCCATTCCTTTCCTTTGGTGTACTGTAGTCCTTCTATTAGGGGAACTAATGGGGAAC
TTTTCTTTATGCACCCTCTCCACACCACTCTTGCTTTTATAGACCTCTATCATATCCCCC
CTCCGTCTCCTCTTCTCTAAGCTGAAAAGTCCCAGTCTCTTTAGCCTCTCTTCATATGGG
ACCTGTTCCAAACCC

And change it to

>JH208680.1 

CTACCCATTCCTTTCCTTTGGTGTACTGTAGTCCTTCTATTAGGGGAACTAATGGGGAAC
TTTTCTTTATGCACCCTCTCCACACCACTCTTGCTTTTATAGACCTCTATCATATCCCCC
CTCCGTCTCCTCTTCTCTAAGCTGAAAAGTCCCAGTCTCTTTAGCCTCTCTTCATATGGG
ACCTGTTCCAAACCC

I use this command, but take a little time as:

awk '{if($1 ~ /^>/){split($1,a,"\s"); print a[1]}else{print}}' input.fasta > input.rename.fasta

Did this fast or not? did any one have better solution for faster?

thanks

P.S. the ">" was not shown here, but it is as fasta file ZQ

genome • 3.6k views
ADD COMMENT
0
Entering edit mode

Did this fast or not? did any one have better solution for faster?

Are you losing money on this. Why worry if it is working :)

ADD REPLY
0
Entering edit mode

it is working, but slow. so I want some better one.

ADD REPLY
7
Entering edit mode
7.5 years ago
cut -d ' ' -f 1 in.fa > out.fa
ADD COMMENT
0
Entering edit mode

This would be fast. Send some of that money @Pierre's way.

ADD REPLY
0
Entering edit mode

Hi dear Genomax2 and Pierre, As I helped in this post, please send me the rest of money :- )

By the way, we (me and @Goutham Atla) suggested awk in that post because the header has different orders.

Take care

ADD REPLY
0
Entering edit mode

thanks, this one is more faster than I used.

ADD REPLY
0
Entering edit mode
7.5 years ago
sacha ★ 2.4k
  seqtk rename file.fasta

Or you can use http://bioinf.shenwei.me/seqkit/

ADD COMMENT

Login before adding your answer.

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