Protocol // Sequences
Bedtools
Tool to edit and extract information from fasta files.
Installation
Get the latest version of the program from the source:
wget https://github.com/arq5x/bedtools2/releases/download/v2.29.1/bedtools-2.29.1.tar.gz
Decompress the file:
tar -zxvf bedtools-2.29.1.tar.gz
Go to the new folder:
cd bedtools2
Install:
make
Alternative
In Linux you can install it using a package manager:
apt-get install bedtools
Run
Bedtools have a lot of different utilities.
You can have a more detailed explanation on the flags, and the input files you need to execute these commands by typing:
bedtools <tool name>
The most straightforward and useful tools on a daily basis:
GetFasta
Extract a specific region of a fasta sequence according to coordinates (position) provided in a file in bed format:
bedtools getfasta -fi Source.fna -bed header_coordinate.bed -s -fo Selected_seq_region.fna
Bed file format for header_coordinate.bed in this case:
The file must have 4 columns:
header of the fasta sequences to be cut
start
end
name of the extracted sequence between start and end
The file should look like this:
chr1 5 10 myseq
chr2 12 28 myseq2