Extract chromosome 1 - 22 fasta file
1
0
Entering edit mode
28 days ago

Hello guys I have a fasta file called hg19.fa.gz and it contains chromosomes like

zcat hg19.fa.gz | grep ">"

chr1

chr2

chr3

chrUn_gl000211

chrUn_gl000221

chrUn_gl000214

chrUn_gl000228

chrUn_gl000227

chr1_gl000191_random

chr19_gl000208

and many more

Now I just want chromosomes from 1 to 22 including X and Y

Thank you

fasta • 194 views
ADD COMMENT
2
Entering edit mode
28 days ago
seqkit grep -i -r -p '^chr[\dXY]+$' h19.fa.gz -o result.fa.gz
ADD COMMENT
0
Entering edit mode

Thank you for your response! It worked !!!

ADD REPLY
1
Entering edit mode
28 days ago

Hello, you I am not really sure if you want to see only chromosome names or the sequences it self. But as of the example you can try.

zcat hg19.fa.gz | egrep "> chr([1-9]$|[1-9]_|1[0-9]|2[0-2]|X|Y)"

ADD COMMENT

Login before adding your answer.

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