importing .SAM files into R (Rstudio)
1
0
Entering edit mode
7.3 years ago
Amirosein ▴ 70

Hi

I have some .sam files as output of bowtie run. i want to read them into Rstudio. i searched for it but all i can find is about importing .bam files. some suggest converting .sam into .bam. is it the only way? and is this convertion lossless?

thanks

R sam bowtie • 8.2k views
ADD COMMENT
1
Entering edit mode

The main question is "why would you want to do that?" Sam and bam contain the same information, bam is just binary of sam.

ADD REPLY
4
Entering edit mode
7.3 years ago

Sam file is a text file. So you can read it directly in R. But there is no point.

Best way is to convert sam to bam and then use a library like RSamtools to read the bam files.

ADD COMMENT
0
Entering edit mode

so why i should convert it ? if i can read it directly ?

ADD REPLY
0
Entering edit mode

You could read it. Its a text file. But to have an easy and quick access the information it has, better to use some libraries, rather than writing something from scratch. Converting to bam file has many other advantages, which is not the question here.

This might be useful, http://davetang.org/wiki/tiki-index.php?page=SAMTools

ADD REPLY

Login before adding your answer.

Traffic: 1944 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6