Skip to content

Commit

Permalink
fixed aei_plots
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffhsu3 committed Jul 13, 2015
1 parent 81bf509 commit b88a8e3
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 40 deletions.
52 changes: 14 additions & 38 deletions genda/AEI/AEI_plot.py
Original file line number Diff line number Diff line change
@@ -1,46 +1,21 @@
import copy
from math import ceil

import numpy as np
import pandas as pd
import pysam
from scipy.stats import ttest_ind, pearsonr
import matplotlib.pyplot as plt
import mpld3
from mpld3 import plugins
from math import ceil
import matplotlib.patches as patches
from genda.formats.dosages import grab_gene_location
from mpld3.plugins import PluginBase
import jinja2
import json
import matplotlib
from matplotlib.path import Path

def make_rectangle(start, end, y1, y2):
verts = [(start, y1),
(start, y2),
(end, y2),
(end, y1),
(start, y1),
]
codes = [
Path.MOVETO,
Path.LINETO,
Path.LINETO,
Path.LINETO,
Path.CLOSEPOLY,
]
return (Path(verts, codes))


def should_not_plot(x):
if x is None:
return True
elif isinstance(x, np.ndarray):
return x.size==0
elif isinstance(x, pd.DataFrame):
return True
else:
return(bool(x))
import matplotlib.patches as patches

#from mpld3.plugins import PluginBase
#import jinja2
#import json

from genda.formats import grab_gene_location
from genda.plotting import (make_rectangle, should_not_plot)


def dosage_round(geno, threshold = 0.5):
""" Rounds dosage to threshold
Expand All @@ -54,7 +29,7 @@ def dosage_round(geno, threshold = 0.5):
def multiple_snp_aei_test(geno, outliers, allelic_ration, num_threshold=5):
"""
"""
pass
raise NotImplementedError


def single_snp_aei_test(geno, outliers, allelic_ratio, num_threshold=5):
Expand Down Expand Up @@ -91,7 +66,8 @@ def aei_bar_plot(self, dosage, cis_snp, tag_snp, gene_name=None):
sharey=False, sharex=True,
subplot_kw=dict(axisbg='#FFFFFF'))
if gene_name:
title = 'AEI at tag %s for %s and\ncolored by genotype at %s' % (gene_name, tag_snp, cis_snp)
title = ('AEI at tag %s for %s and\n'
'colored by genotype at %s') % (gene_name, tag_snp, cis_snp)
else:
title = "AEI at tag %s and\ncolored by genotype at %s" % (tag_snp,
cis_snp)
Expand Down
1 change: 0 additions & 1 deletion genda/plotting/plotting_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,4 +231,3 @@ def get_path_max_and_min(gene_dict):
for k in j.vertices:
points.append(k[0])
return(min(points), max(points))

1 change: 0 additions & 1 deletion tests/genotype_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ def main():
unittest.main()

if __name__ == '__main__':
print(__file__)
main()


0 comments on commit b88a8e3

Please sign in to comment.