Created
February 4, 2019 11:37
-
-
Save ekg/18587dd22f77ac525c41c298d5e0bd89 to your computer and use it in GitHub Desktop.
summarize the softclips in a SAM/BAM file
This file contains 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
#!/usr/bin/python | |
import sys; | |
import pysam | |
bamFile = sys.argv[1]; | |
bamFP = pysam.Samfile(bamFile, "rb"); | |
for read in bamFP: | |
if( not( read.is_unmapped ) ): #if it's mapped | |
cigarLine=read.cigar; | |
for (cigarType,cigarLength) in cigarLine: | |
try: | |
if cigarType == 4: | |
print cigarLength | |
except: | |
print "Problem"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment