Question: importing .SAM files into R (Rstudio)
0
gravatar for Amirosein
3.7 years ago by
Amirosein70
UBC, Vancouver, CA.
Amirosein70 wrote:

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

bowtie sam R • 3.5k views
ADD COMMENTlink modified 3.7 years ago by geek_y11k • written 3.7 years ago by Amirosein70
1

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 REPLYlink written 3.7 years ago by WouterDeCoster44k
4
gravatar for geek_y
3.7 years ago by
geek_y11k
Barcelona
geek_y11k wrote:

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 COMMENTlink written 3.7 years ago by geek_y11k

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

ADD REPLYlink written 3.7 years ago by Amirosein70

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 REPLYlink modified 3.7 years ago • written 3.7 years ago by geek_y11k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1424 users visited in the last hour