Question: Consensus fasta file with uncovered bases set to Ns
0
gravatar for deepti1rao
19 months ago by
deepti1rao20
deepti1rao20 wrote:

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?

ADD COMMENTlink modified 19 months ago by Matt Shirley8.9k • written 19 months ago by deepti1rao20
1
gravatar for geek_y
19 months ago by
geek_y9.3k
Barcelona/CRG/London/Imperial
geek_y9.3k wrote:

bedtools maskfasta

Just provide the bed file with 0 coverage regions

ADD COMMENTlink modified 19 months ago • written 19 months ago by geek_y9.3k
0
gravatar for Matt Shirley
19 months ago by
Matt Shirley8.9k
Cambridge, MA
Matt Shirley8.9k wrote:

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 COMMENTlink written 19 months ago by Matt Shirley8.9k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1622 users visited in the last hour