SEQanswers

Go Back   SEQanswers > Bioinformatics > Bioinformatics



Similar Threads
Thread Thread Starter Forum Replies Last Post
Filtering SNPs by coverage in HapMap format Nick Bell Bioinformatics 3 03-04-2015 05:15 AM
What tools can convert sequence file from tabular format to fasta format? yangjianhunt Bioinformatics 5 03-26-2014 01:48 PM
Calculating sequence coverage tahamasoodi Bioinformatics 2 12-08-2012 09:28 AM
Need Sequence Format Converter byou678 Bioinformatics 5 10-23-2012 12:17 PM
reference sequence coverage please sbsusers Bioinformatics 1 09-05-2012 08:51 AM

Reply
 
Thread Tools
Old 01-23-2014, 01:02 PM   #1
OTU
Member
 
Location: Utah

Join Date: May 2013
Posts: 44
Default sequence coverage format trouble

Hi everyone!

I am using bowtie2 to map my reads on scaffolds and I would like to know, is there a way to get a coverage calculation in samtools? I know that I can use BEDTools, but how can I get .bed format from bam? And for my analysis pipeline I need .csv format of coverage information, which is not created in BEDTools.
Any ideas how I can do this?


Help!:

Last edited by OTU; 01-23-2014 at 01:13 PM.
OTU is offline   Reply With Quote
Old 01-23-2014, 02:36 PM   #2
GenoMax
Senior Member
 
Location: East Coast USA

Join Date: Feb 2008
Posts: 7,077
Default

There are several solutions on this biostars page including a "samtools depth" one: http://www.biostars.org/p/5165/
GenoMax is offline   Reply With Quote
Old 01-24-2014, 09:01 AM   #3
OTU
Member
 
Location: Utah

Join Date: May 2013
Posts: 44
Default

Thank you!
However, I wasn't able to find a way to get the information on coverage to be in csv format.
I used this:
samtools depth *bamfile* | awk '{sum+=$3} END { print "Average = ",sum/NR}'

And got the number. Is there a way to get it in csv format?
OTU is offline   Reply With Quote
Old 01-24-2014, 10:40 AM   #4
dpryan
Devon Ryan
 
Location: Freiburg, Germany

Join Date: Jul 2011
Posts: 3,480
Default

Code:
samtools depth *bamfile* | awk '{sum+=$3} END { printf("Average,%f\n",sum/NR)}' > some_file.csv
Will make the output comma separated (csv is just a text file with commas as column separators).
dpryan is offline   Reply With Quote
Old 01-24-2014, 10:53 AM   #5
GenoMax
Senior Member
 
Location: East Coast USA

Join Date: Feb 2008
Posts: 7,077
Default

That awk script only prints a single number for the whole bam so that is probably not the output OTU is looking for.

@OTU Are you looking to get a "depth" number for each scaffold?
GenoMax is offline   Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off




All times are GMT -8. The time now is 07:34 AM.


Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Single Sign On provided by vBSSO