Consensus fasta file with uncovered bases set to Ns
2
0
Entering edit mode
6.7 years ago
deepti1rao ▴ 50

I am looking forward to generating a consensus fasta file by providing my BED file and the reference fasta as inputs.I want to have the bases in my reference genome, showing 0 coverage to be substituted by Ns. Is there any script/tool available to do this?

reference genome BED fasta consensus • 2.3k views
ADD COMMENT
2
Entering edit mode
6.7 years ago

bedtools maskfasta

Just provide the bed file with 0 coverage regions

ADD COMMENT
1
Entering edit mode
6.7 years ago

You can do this with pyfaidx as well.

$ pip install pyfaidx
$ faidx -m -b regions.bed file.fa  # mask with "N"
$ faidx -s X -m -b regions.bed file.fa  # mask with "X"
$ faidx -M -b regions.bed file.fa  # soft-mask with lowercase characters

These all modify file.fa in-place, so make sure you're either testing on a copy or ready to change the file.

ADD COMMENT

Login before adding your answer.

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