Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use samtools to intercept the sequence of specified position

Shulou Source: shulou.com Published: 2022-06-01 04:39:18 09月22日 Update

This article introduces the relevant knowledge of "how to use samtools to intercept the sequence of a specified location". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Samtools faidx can create a file with the suffix .fai for the fasta sequence. According to this .fai file and the original fastsa file, it can quickly extract the sequence of any region.

Usage:

Samtools faidx input.fa

This command has certain requirements for the input fasta sequence: for each sequence, except for the last line, the length of other lines must be the same.

> one ATGCATGCATGCATGCATGCATGCATGCAT GCATGCATGCATGCATGCATGCATGCATGC ATGCAT > two another chromosome ATGCATGCATGCATGCATGCATGCATGC

The final generated .fai file is as follows, with 5 columns, separated by\ t

One 66 5 30 31two 28 98 14 15

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 the last line, represents the length of the line of the sequence, including the newline character, which is\ r\ n in the windows system. Add 2 to the length of the sequence.

Extraction sequence:

Samtools faidx input.fa chr1 > chr1.fasamtools faidx input.fa chr1:100-200 > chr1.fa "how to use samtools to intercept the sequence of a specified location" is introduced here, thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Tags: Sequence file length line content newline character location representative unit more knowledge base original practical same learned next region name suffix Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info Linux Apple Microsoft MariaDB