This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Change accession number to chromosome number in reference genome

I have a reference genome explained by accession number instead of chromosome number. Any clue how to convert it into a chromosome number in the Linux terminal? Any suggestion is kindly appreciated.

fasta chromosome

Could you provide an example for your question, including the input and desired output? This will make it easier to assist you.

Thanks for the reply. As displayed below, the fasta reference file is starting with >NC_, but what I'm looking for is I need to substitute the accession number by Chromosome number. For-example, the accession number NC_056070.1 stands for chromosome 17. instead of starting the first column with NC_056070.1 I need Chromosome 17. The fast file has 26 chromosomes, X chromosome and mitochondrial sequence as well.

kindly.

>NC_056070.1 Ovis aries strain OAR_USU_Benz2616 breed Rambouillet chromosome 17, ARS-UI_Ramb_v2.0, whole genome shotgun sequence
>NC_056071.1 Ovis aries strain OAR_USU_Benz2616 breed Rambouillet chromosome 18, ARS-UI_Ramb_v2.0, whole genome shotgun sequence
>NC_056072.1 Ovis aries strain OAR_USU_Benz2616 breed Rambouillet chromosome 19, ARS-UI_Ramb_v2.0, whole genome shotgun sequence
>NC_056073.1 Ovis aries strain OAR_USU_Benz2616 breed Rambouillet chromosome 20, ARS-UI_Ramb_v2.0, whole genome shotgun sequence
>NC_056074.1 Ovis aries strain OAR_USU_Benz2616 breed Rambouillet chromosome 21, ARS-UI_Ramb_v2.0, whole genome shotgun sequence
>NC_056075.1 Ovis aries strain OAR_USU_Benz2616 breed Rambouillet chromosome 22, ARS-UI_Ramb_v2.0, whole genome shotgun sequence
>NC_056076.1 Ovis aries strain OAR_USU_Benz2616 breed Rambouillet chromosome 23, ARS-UI_Ramb_v2.0, whole genome shotgun sequence
>NC_056077.1 Ovis aries strain OAR_USU_Benz2616 breed Rambouillet chromosome 24, ARS-UI_Ramb_v2.0, whole genome shotgun sequence
>NC_056078.1 Ovis aries strain OAR_USU_Benz2616 breed Rambouillet chromosome 25, ARS-UI_Ramb_v2.0, whole genome shotgun sequence
>NC_056079.1 Ovis aries strain OAR_USU_Benz2616 breed Rambouillet chromosome 26, ARS-UI_Ramb_v2.0, whole genome shotgun sequence
>NC_056080.1 Ovis aries strain OAR_USU_Benz2616 breed Rambouillet chromosome X, ARS-UI_Ramb_v2.0, whole genome shotgun sequence

If the above is a consistent pattern, edit the header so it has just the chromosome [^,]+ but as chromosome_[^,]+ like so:

sed -Ee '^>s/.+chromosome ([^,]+),.+/chromosome_\1/' in.fasta > renamed.fasta

Test before running on the whole file and double check headers once done.

0 answers

No answers yet.

Log in to answer this question.