Hello,

Sorry in advance for my English.

I want extract all positions of non-sequenced nucleotides for each chromosomes from a genome sequence file (Fasta).

To do that, I have a fasta file with the genome sequences, like this:

```
>chr1
NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNtaaattgttt
taaattgtttctgtttgcagttgacatgatcttatatatagaaaacacca
ataactctgccaaaaaatttagaattcataaatgaatttagtaaagttgc
```

I want find all N positions and obtain this position in bed format, e.g.:

    chr1 1 200 ...

I didn't found how to do that in Bedtools.

If you have any idea, could you help me?

Thank you
<p>Well, this should not be a problematic task if I understood the question correctly. All you need to do is slide along your input fasta file and count the swithches N-&gt; something and something to -&gt;N</p>

<pre>
perl -ne &#39;chomp;if( /&gt;(.*)/){$head = $1; $i=0; next};@a=split(&quot;&quot;,$_); foreach(@a){$i++;if($_ eq &quot;N&quot; &amp;&amp; $s ==0 ){print &quot;$head\t$i&quot;; $s =1}elsif($s==1 &amp;&amp; $_ ne &quot;N&quot;){print &quot;\t$i\n&quot;;$s=0}}&#39; <code>infile</code>.fa</pre>

<p>This should do the trick.</p>

<p>cheers</p>

<p>mxs</p>
