In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the fasta index file, sequence extraction example analysis, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor with you to understand.
Fasta is a commonly used sequence storage format, and many software (such as GATK, IGV, etc.) usually need to establish index files when importing sequences and searching quickly. Here's how to use samtools to easily index fasta files and quickly extract sequences.
1 build an index
To build an index, simply enter the command under Linux: samtools faidx input.fa
Here the sequence file is input.fa, and the generated index file ends with .fai. It should be noted that except for the last line, the length of each line in the input fasta file must be the same, otherwise an error will be reported. The resulting .fai file is as follows, with five columns, separated by tabs
The first column NAME: the name of the sequence, leaving only the contents after ">" and before the first blank.
The second column LENGTH: the length of the sequence in bp
The third column OFFSET: the offset of the first base, counted from 0, and the newline character also counted.
The fourth column LINEBASES: except for the last line, the base number of rows representing the sequence, in bp
The fifth column LINEWIDTH: line width, except for the last line, represents the length of the line of the sequence, including the newline character, which is\ r\ n in the windows system, adding 2 to the length of the sequence.
2 extraction sequence
In addition to indexing, you can also use samtools to easily extract sequences, such as:
Samtools faidx input.fa chr2 > chr2.fa, you will get a file in fasta format containing the sequence of chr2. If there are multiple sequences, you only need to list the sequence ID to be extracted after the file, separated by spaces, such as samtools faidx input.fa chr1 chr2 chr3 > chr.fa.
For example: samtools faidx input.fa chr2:1-1000 > chr2.fa, we can get the fasta format file of the 1st to 1000th base of chr2 sequence, and we can also extract multiple sequences.
Samtools installation
1. Download it at: http://www.htslib.org/doc/samtools.html.
two。 Install, use the command tar-jxvf samtools-1.6.tar.bz2 to extract the downloaded package, and finally use the make command.
Thank you for reading this article carefully. I hope the article "sample Analysis of fasta Index File and sequence extraction" shared by the editor will be helpful to you. At the same time, I also hope that you will support and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 206
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.