Created
April 16, 2019 01:19
-
-
Save adamewing/90f1f57985a2033f292debb2e2e5b25f to your computer and use it in GitHub Desktop.
Generate volcano plot for Stevenson et al.
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/env python | |
import sys | |
import pandas as pd | |
import matplotlib as mpl | |
# Force matplotlib to not use any Xwindows backend. | |
mpl.use('Agg') | |
import matplotlib.pyplot as plt | |
import seaborn as sns | |
import logging | |
FORMAT = '%(asctime)s %(message)s' | |
logging.basicConfig(format=FORMAT) | |
logger = logging.getLogger(__name__) | |
logger.setLevel(logging.INFO) | |
if len(sys.argv) == 2: | |
de = pd.read_csv(sys.argv[1], header=0, index_col=False) | |
outfn = '.'.join(sys.argv[1].split('.')[:-1]) + '.volcano.eps' | |
de['sig'] = de['FDR'] < 0.05 | |
de=de.sample(frac=1) | |
pal = [(0.7,0.7,0.7), (1.0,0.27,0.0)] | |
ax = sns.scatterplot(x='logFC', y='logCPM', data=de, hue='sig', palette=pal, size=2, legend=False) | |
fig = ax.figure | |
fig.savefig(outfn, bbox_inches='tight') | |
else: | |
sys.exit('usage: %s <DE table>' % sys.argv[0]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment