<p>[Here is the link.][1]. Instructions are very clear at the website<br />
[1]: https://bedtools.readthedocs.io/en/latest/content/tools/getfasta.html</p>

CC BY-SA 4.0
2022-07-20T02:46:22.773Z
Ah, perfect @Supertech! Thank  you, both answers helpful... the link included here is the exact answer I was looking for: bedtools getfasta converts index range start_index-end_index into it's equivalent sequence of nucleotides indicated in the input *.fa file. I just need to figure out how to create the "fa" file for an entire genome like mm10, where it's usually in chromosomal chunks (i.e. Chr2.fa).
Zebra Fish
CC BY-SA 4.0
2022-07-20T03:04:20.873Z
I believe each chromosome is independently numbered. If you want to generate a single genome file with all the chromosomes, download individual chromosomes and simply concatenate them. For example using Linux command "cat". >cat chr1.fa chr2.fa ...
Supertech
CC BY-SA 4.0
2022-07-20T03:06:52.640Z
It looks like they may have single file. I have not downloaded to check it though. It has been long that I did not work with mouse genome. http://hgdownload.cse.ucsc.edu/goldenpath/mm10/bigZips/
Supertech
CC BY-SA 4.0
2022-07-20T05:51:31.683Z
Yes, I am trying to think why/how that would work: I guess the *.fa file has the chrX indicator at each line which would be matched along with the index (I assume a complete index needs to include chromosome number as well)! Thank you again.
Zebra Fish
CC BY-SA 4.0
2022-07-20T10:05:59.170Z
Try samtools faidx. Check bedtools manual. https://bedtools.readthedocs.io/en/latest/content/general-usage.html
Supertech
CC BY-SA 4.0
2022-07-20T01:33:55.447Z
2022-07-20T01:33:55.447Z
Supertech
<p>Bedtools can take a list of coordinates and a fasta and return a multifasta of the specified regions.</p>

CC BY-SA 4.0
2022-07-19T14:48:04.013Z
2022-07-19T14:48:04.013Z
swbarnes2
<p>A BigWig file for something like Chip-seq, or ATAC data has the following format for each line i:</p>
<p>chrom_i - start_i - end_i - value_i</p>
<p><a href="https://i.sstatic.net/buiri.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/buiri.png" alt="enter image description here" /></a></p>
<p>I need to convert for each line the (start_i -&gt; end_i) reference to the actual DNA sequence 'ATATCCTAG...' so that at the end I have a list of DNA sequences like 'ATATCCTAG...' and the Chip-seq activity value associated with that sequence segment. What are the ways to do this? For example, what tool(s) can I use to generate the (sequence, value) pairs from browser tracks for the Chip-seq or ATAC etc. And in fact, going from BigWig browser track files for Chip-seq the most direct way to produce this kind of (seq,value) data? Thank you.</p>

<r><python><chip-seq><atac-seq><macs2>
How to extract DNA sequence from browser track input files (BigWig, bed etc.) files
# How to extract DNA sequence from browser track input files (BigWig, bed etc.) files

(Asked by: username_0 on 2022-07-19)

A BigWig file for something like Chip-seq, or ATAC data has the following format for each line i:

chrom\_i - start\_i - end\_i - value\_i

[![enter image description here](https://i.sstatic.net/buiri.png)](https://i.sstatic.net/buiri.png)

I need to convert for each line the (start\_i -> end\_i) reference to the actual DNA sequence 'ATATCCTAG...' so that at the end I have a list of DNA sequences like 'ATATCCTAG...' and the Chip-seq activity value associated with that sequence segment. What are the ways to do this? For example, what tool(s) can I use to generate the (sequence, value) pairs from browser tracks for the Chip-seq or ATAC etc. And in fact, going from BigWig browser track files for Chip-seq the most direct way to produce this kind of (seq,value) data? Thank you.

**Tags:** r, python, chip-seq, atac-seq, macs2

---

## 2 answers

### Answer by username_1 on 2022-07-20. Score: 1 | Accepted answer

[Here is the link.][1]. Instructions are very clear at the website  
[1]: https://bedtools.readthedocs.io/en/latest/content/tools/getfasta.html

> **Comments:**
> **username_0**: Ah, perfect @Supertech! Thank  you, both answers helpful... the link included here is the exact answer I was looking for: bedtools getfasta converts index range start_index-end_index into it's equivalent sequence of nucleotides indicated in the input *.fa file. I just need to figure out how to create the "fa" file for an entire genome like mm10, where it's usually in chromosomal chunks (i.e. Chr2.fa).  
> **username_1**: I believe each chromosome is independently numbered. If you want to generate a single genome file with all the chromosomes, download individual chromosomes and simply concatenate them. For example using Linux command "cat". >cat chr1.fa chr2.fa ...  
> **username_1**: It looks like they may have single file. I have not downloaded to check it though. It has been long that I did not work with mouse genome. http://hgdownload.cse.ucsc.edu/goldenpath/mm10/bigZips/  
> **username_0**: Yes, I am trying to think why/how that would work: I guess the *.fa file has the chrX indicator at each line which would be matched along with the index (I assume a complete index needs to include chromosome number as well)! Thank you again.  
> **username_1**: Try samtools faidx. Check bedtools manual. https://bedtools.readthedocs.io/en/latest/content/general-usage.html  

---

### Answer by username_2 on 2022-07-19. Score: 1

Bedtools can take a list of coordinates and a fasta and return a multifasta of the specified regions.


---

