Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
james
committed
Apr 29, 2014
1 parent
082d1dc
commit 52d2155
Showing
6 changed files
with
135 additions
and
11 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/usr/bin/env python | ||
|
||
|
||
## | ||
#Attempts to print split reads from m4 file | ||
## | ||
|
||
|
||
|
||
import sys | ||
from m4io import getAlignments, longestNonOverlapping | ||
from nucio import recordToString | ||
|
||
if not len(sys.argv) == 2: | ||
sys.exit("getSplitReads.py in.m4") | ||
|
||
|
||
inm4 = sys.argv[1] | ||
|
||
for read,alignments in getAlignments(inm4, longestNonOverlapping): | ||
if len(alignments) > 1: | ||
astrings = map(recordToString, alignments) | ||
print "\n".join(astrings) |
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#!/usr/bin/env python | ||
|
||
import sys | ||
|
||
from operator import itemgetter,attrgetter | ||
from itertools import imap, starmap, repeat,izip | ||
from pbcore.io import BasH5Reader | ||
from collections import Counter | ||
|
||
import matplotlib as mpl | ||
mpl.use('Agg') | ||
import matplotlib.pyplot as plt | ||
from matplotlib.backends.backend_pdf import PdfPages | ||
|
||
|
||
if not len(sys.argv) == 2: | ||
sys.exit("zmwProductivityHeatmap.py input.bas.h5\n") | ||
|
||
infile = sys.argv[1] | ||
cell = BasH5Reader(infile) | ||
|
||
get_prod = lambda o : getattr(o, "zmwMetric")("Productivity") | ||
|
||
zmwgetters = map(itemgetter, cell.allSequencingZmws) | ||
all_seq_zmws = list(starmap(apply,zip(zmwgetters, repeat([cell])))) | ||
zmw_prods = map(get_prod, all_seq_zmws) | ||
print Counter(zmw_prods) | ||
|
||
print filter( lambda (prod,l): prod == 2 , zip( zmw_prods, map(lambda z: len(z.read()), all_seq_zmws))) | ||
|
||
#print zmw_prods[:20] | ||
xy = map(attrgetter("holeXY"), all_seq_zmws) | ||
xyl = map(list,xy) | ||
print "length:" + str(len(xyl)) | ||
colors="rgy" | ||
|
||
(x,y) = zip(*xyl) | ||
|
||
pp = PdfPages(infile.split(".")[0] + ".pdf") | ||
colormap = map(lambda c: colors[c], zmw_prods) | ||
plt.scatter(x, y, marker='o', s=3,lw=0, c=colormap, edgecolor=colormap) | ||
#plt.legend(["0","1","2"]) | ||
|
||
plt.savefig(pp, format="pdf") | ||
|
||
pp.close() | ||
|
||
|
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