i indexed bam file with command
samtools index o_sorted.bam
and it has extension of .bia ..now i want to convert it in to tsv format how to do this.i searched it on INTERNET but cant find any helpful answer
i indexed bam file with command
samtools index o_sorted.bam
and it has extension of .bia ..now i want to convert it in to tsv format how to do this.i searched it on INTERNET but cant find any helpful answer
The index file contains information that is not easily or usefully represented in tab separated value format; see section 5.2 of the SAM specification for details on the bai format. You could get a text representation of a bam file with Rsamtools::asSam()
or at the command line using samtools view
. Maybe you want to read in specific sequences; use GenomicAlignments::readGAlignments()
with the 'param' argument specifying range, or use samtools view
at the command line.
I guess you are interested in the R / Bioconductor command, since this is a Bioconductor help forum. I guess also that you have installed the Rsamtools package
source("http://bioconductor.org/biocLite.R") biocLite("Rsamtools")
Load the Rsamtools library
library(Rsamtools)
and look at the help page for asSam()
?asSam
It says that you can make a BAM file into a SAM file by specifying the BAM file name, and the destination name. On _my_ computer I might write
asSam("/home/mtmorgan/tmp/0.bam", "/home/mtmorgan/tmp/0.sam")
On windows I would probably have file paths like "c:/Users/mtmorgan/Documents/0.bam"
.
Since BAM files are very large, it is not helpful to do this.
Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
What information, specifically, are you trying to get into tsv format? The .bai file contains no useful information in a tsv format.