Created
November 7, 2013 02:12
-
-
Save florin-chelaru/7347794 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.umd.assemblytest.readcoverage.samfile as sam | |
# Parse a file into a SamFile instance | |
samfile = sam.SamFile.read('../../../../../../tutorial/read_coverage/influenza-A.sam') | |
# In the background, the SamFile class partitions the alignments in the file | |
# by reference sequence, and organizes them in an IntervalTree, used for quick | |
# retrieval of overlaps. | |
# Compute the coverage of reference sequence '1' within the interval 1-100, and | |
# get all reads overlapping with it. | |
alns = samfile.coverage('1', 1, 100) | |
print 'Found {0} alignments overlapping with the given reference sequence. Here they are:'.format(len(alns)) | |
for aln in alns: | |
print '{0}\t{1}\t{2}\t{3}'.format(aln.reference(), aln.start(), aln.end(), aln.qname()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment