Get the App
SLTechnology News&Howtos  ›  Development  › 

How to convert the format of files in Bedtools

Shulou Source: shulou.com Published: 2022-06-02 01:07:11 10月04日 Update

This article is to share with you about how to convert the file format in Bedtools, the editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.

Using Bedtools to convert file format

Bedtools is a set of genome algorithm tools developed by the Quinlan Laboratory of the University of Utah. It can intersect, merge, count and transform widely used genomic data formats such as BAM, BED, GFF, VCF and so on. To learn more about Bedtools, please refer to the official tutorial: bedtools: a powerful toolset for genome arithmetic-bedtools 2.30.0 documentation.

Genomic features can be functional elements (such as genes) and gene polymorphisms (SNP, INDEL, SV). The most basic genomic features are their chromosomes, starting position, terminating position, positive and negative chain characteristics. The widely used genome formats are BED files and GFF files.

The Bedtools bamtobed command converts a BAM file to a BED file:

$bedtools bamtobed-I test.bam

-bedpe parameter, you can convert BAM format to BEDPE format. Only reads in pairs will be output. The default output format is BED format.

-bed12, which can output in BED12 format. The default output format is BED6 format.

-tag. You can use other tag in BAM as BED score. The default BED score value is the MAPQ value in the BAM file.

-cigar, which outputs the cigar value as the seventh column of the BED file.

The Bedtools bedtobam command is used to convert BED files to BAM files:

$bedtools bedtobam-I test.bed-g human.hg18.genome > test.bam

-mapq, sets the mapping quality of the output BAM file. The default mapping quality is 255mm.

-ubam, output the uncompressed BAM file, the default output is the compressed BAM file.

The Bedtools bamtofastq command is used to extract the fastq file from the matched BAM file:

$bedtools bamtofastq-I test.bam-fq test.fastq

-fq2, you can export pairs of fastq files to two files respectively, but the input BAM files need to sort reads by name first. Default-fq outputs fastq files.

The above is how to convert the file format in Bedtools. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.

Tags: File format output gene genome command feature location more knowledge article polymorphism utility two intersection element function parameter name polymorphism Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information NVidia Microsoft vpn MariaDB