-
Venkat Malladi authoredefc49c07
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
Forked from
Venkat Malladi / TFSEE
19 commits behind the upstream repository.
cutoff_analysis.py 1.96 KiB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/usr/bin/env python
# -*- coding: latin-1 -*-
'''Take an TSV file make a plot graph'''
EPILOG = '''
For more details:
%(prog)s --help
'''
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import argparse
import seaborn as sns
def get_args():
parser = argparse.ArgumentParser(
description=__doc__, epilog=EPILOG,
formatter_class=argparse.RawDescriptionHelpFormatter,
)
parser.add_argument('-r', '--rpkm',
help="The file with RPKM values.",
required = True)
parser.add_argument('-c','--color',
help="The hex color to make the graph",
required = True)
parser.add_argument('-f','--factor',
help="Factor that is being analyzed.",
required = True)
parser.add_argument('-l','--limit',
help="The RPKM limit to plot",
type=float,
required = True)
parser.add_argument('-p', '--protein',
help="The file with Protein coding gnese.")
args = parser.parse_args()
return args
def main():
sns.set_style("white")
sns.set_style("ticks")
args = get_args()
rpkm_file = pd.read_csv(args.rpkm, sep='\t')
if args.protein is not None:
pc_genes = pd.read_csv(args.protein, sep='\t', header=None)
filtered_rpkm = rpkm_file[rpkm_file['gene_id'].isin(pc_genes[0].values)]
else:
filtered_rpkm = rpkm_file
locations = np.array(filtered_rpkm['ES_D0'])
locations = np.append(locations, np.array(filtered_rpkm['ES_D2']))
locations = np.append(locations, np.array(filtered_rpkm['ES_D5']))
locations = np.append(locations, np.array(filtered_rpkm['ES_D7']))
locations = np.append(locations, np.array(filtered_rpkm['ES_D10']))
sns.kdeplot(np.log2(locations[locations !=0] + 0.00001),color=args.color)
sns.despine()
plt.axvline(np.log2(args.limit), color='black', linestyle='dashed', linewidth=1)
plt.savefig(args.factor + '_distribution.png')
plt.clf()
if __name__ == '__main__':
main()