Skip to content
Snippets Groups Projects
Commit e5e21cfe authored by Aaron's avatar Aaron
Browse files

Version 2.3. Just before paper submission.

parent dfa0070d
No related branches found
No related tags found
No related merge requests found
Version 2.3.0 (11/18/2009)
1. Added four new tools:
- shuffleBed. Randomly permutes the locations of a BED file among a genome. Useful for testing for significant overlap enrichments.
- slopBed. Adds a requested number of base pairs to each end of a BED feature. Constrained by the size of each chromosome.
- maskFastaFromBed. Masks a FASTA file based on BED coordinates. Useful making custom genome files from targeted capture experiment, etc.
- pairToPair. Returns overlaps between two paired-end BED files. This is great for finding structural variants that are
private or shared among samples.
2. Increased the speed of intersectBed by nearly 50%.
3. Improved /corrected some of the help messages.
4. Improved sanity checking for BED entries.
Version 2.2.4 (10/27/2009) Version 2.2.4 (10/27/2009)
1. Updated the mergeBed documentation to describe the -names option which allows one to report the names of the 1. Updated the mergeBed documentation to describe the -names option which allows one to report the names of the
features that were merged (separated by semicolons). features that were merged (separated by semicolons).
......
============================== ==============================
=== BEDTools Version 2.1.2 === === BEDTools ===
============================== ==============================
Created by Aaron Quinlan Spring 2009. Created by Aaron Quinlan Spring 2009.
Copyright 2009 Aaron Quinlan. All rights reserved. Copyright 2009 Aaron Quinlan. All rights reserved.
http://people.virginia.edu/~arq5x/bedtools.html http://code.google.com/p/bedtools
Free for non-profit or academic use. Please contact me for commercial use.
===Example Usage=== ===Example Usage===
......
...@@ -15,9 +15,9 @@ import re ...@@ -15,9 +15,9 @@ import re
help_message = ''' help_message = '''
gffToBed -g <gff> gffToBed.py -g <gff>
OPTIONS: ABSTRACT: Converts genome annotations in GFF format to BED format.
''' '''
""" """
......
...@@ -16,15 +16,30 @@ import re ...@@ -16,15 +16,30 @@ import re
help_message = ''' help_message = '''
samToBed -s <sam> -t <alignment type> samToBed.py -s <sam> -t <alignment type>
ABSTRACT: Converts aligned reads in SAM format to BED format.
OPTIONS: OPTIONS:
-s The SAM file to be converted to BED -s The SAM file to be converted to BED (use "stdin" for piped input)
-t What types of alignments should be reported? -t What types of alignments should be reported?
"all" all aligned reads will be reported (Default) "all" all aligned reads will be reported (Default)
"con" only concordant pairs will be reported "con" only concordant pairs will be reported
"dis" only discordant pairs will be reported "dis" only discordant pairs will be reported
EXAMPLE:
Can be used with samtools to extract alignments and compare them to BED
annotations.
(1) Land a BED file first.
$ samtools view reads.sorted.bam > read.sorted.sam
$ samToBed.py -s reads.sorted.sam -t all > reads.sorted.bed
$ intersectBed -a reads.sorted.bed -b refseq.bed > reads.intersect.refseq.bed
(2) "One-liner.
$ samtools view reads.sorted.bam | samToBed.py -s stdin -t all | \
intersectBed -a stdin -b refseq.bed > reads.intersect.refseq.bed
''' '''
...@@ -35,15 +50,17 @@ class Usage(Exception): ...@@ -35,15 +50,17 @@ class Usage(Exception):
def processSAM(file, alignType): def processSAM(file, alignType):
""" """
Load a SAM file and convert each line to BED format. Read a SAM file (or stdin) and convert each line to BED format.
"""
We avoid readlines() in this case, as SAM files can if (file != "stdin"):
be HUGE, and thus loading it into memory could be painful. for line in open(file,'r'):
""" samLine = splitLine(line.strip())
for line in open(file,'r'): makeBED(samLine, alignType)
samLine = splitLine(line.strip()) f.close()
makeBED(samLine, alignType) else:
f.close() for line in sys.stdin:
samLine = splitLine(line.strip())
makeBED(samLine, alignType)
def makeBED(samFields, aType): def makeBED(samFields, aType):
...@@ -116,17 +133,18 @@ def main(argv=None): ...@@ -116,17 +133,18 @@ def main(argv=None):
samFile = value samFile = value
if option in ("-t", "--type"): if option in ("-t", "--type"):
aType = value aType = value
try: if (samFile != "stdin"):
f = open(samFile, 'r') try:
except IOError, msg: f = open(samFile, 'r')
raise Usage(help_message) except IOError, msg:
raise Usage(help_message)
except Usage, err: except Usage, err:
print >> sys.stderr, sys.argv[0].split("/")[-1] + ": " + str(err.msg) print >> sys.stderr, str(err.msg)
return 2 return 2
# make a BED file of the SAM file.
processSAM(samFile, aType) processSAM(samFile, aType)
if __name__ == "__main__": if __name__ == "__main__":
......
...@@ -3,6 +3,6 @@ ...@@ -3,6 +3,6 @@
// define the version. All tools in the // define the version. All tools in the
// suite carry the same version number. // suite carry the same version number.
#define VERSION "2.2.4" #define VERSION "2.3.0"
#endif /* VERSION_H */ #endif /* VERSION_H */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment