<jupyter_start><jupyter_text>Figure 3<jupyter_code>#colors = [(.5019,.8078,0.8549), (.298,.6862,.8823), (.0,.3372,.7450)]
#colors = ["#74DBEF", "#5E88FC", "#264E86"]
#colors = ["#11CBD7", "#C6F1E7", "#F0FFF3"]
#pal = sns.set_palette(sns.color_palette(colors))

sns.set_context("talk", font_scale=3.4)
fig, ax = plt.subplots(figsize=(36, 25))

# Plot panel bars
ax = sns.barplot(x="Patient", y="Panel^Somatic", hue="Panel Name", 
                 data=sub, palette="Blues", alpha=1, linewidth=15, 
                 errwidth=7)
# Outline panel bars in black
for i,patch in enumerate(ax.patches[0:]):
    # Set the linecolor on the artist to the facecolor, and set the facecolor to None
    patch.set_edgecolor("#FFFFFF")

sns.despine()
ax.set_ylabel("# Detected Somatic Mutations")
#ax.set_xticklabels(ax.get_xticklabels(), rotation=45);
ax.set_ylim(0,25);<jupyter_output><empty_output><jupyter_text>**Better feature weights (modeled independently)**<jupyter_code>mutations = load_matrix("../SVMv4_Enrichment_20171107/prostate23_mutations.pkl")
new_features = pd.read_csv("../SVMv4_Enrichment_20171107/features.csv")[0:21]['Feature']
## Repeat for dann, phlyloP, cadd, cadd_raw, funseq2, and aa_class_change|unchanged
fws = pd.DataFrame(np.nan, index=new_features, columns=['Weight'])
fws.index.name='Feature'
fws = fws.reset_index()
for fea in new_features:
    print "Evaluating", fea
    feature_test = mutations.copy()
    feature_test.normalize_options['scaler_strat']='mms'
    feature_test.normalize_options['nan_strat']='mean'
    feature_test.set_features([fea])
    feature_test = feature_test.dropna(subset=[fea])
    feature_test.svm(cross_validate=False, test_size=0.0)
    ff  = feature_test.show_feature_importances('table')
    fws.loc[fws['Feature']==fea,'Weight'] \
      = feature_test.show_feature_importances('table').ix['False',fea]
fws = fws.sort_values('Weight', ascending=True)
fws
import matplotlib.pyplot as plt
import matplotlib.colors as mcolors

cvals  = [-2., 0, 2]
colors = ['#9CECFB', '#65C7F7', '#0052D4']

norm=plt.Normalize(min(cvals),max(cvals))
tuples = list(zip(map(norm,cvals), colors))
cmap = mcolors.LinearSegmentedColormap.from_list("", tuples)<jupyter_output><empty_output><jupyter_text>Figure 1D<jupyter_code># And plot them
span, bot, top = (20,0,21)
mod = sns.color_palette(cmap(map(lambda k: k/float(top-bot), range(0,top-bot))))

sns.set_context("poster")
sns.set_style("white")
fig, ax = plt.subplots(figsize=(11.7, 8.27))

ax=sns.barplot(y='Feature', x='Weight', data=fws,
                linewidth=2, palette=mod)
#ax.set_xlim(-3,3)


for i,artist in enumerate(ax.artists):
    # Set the linecolor on the artist to the facecolor, and set the facecolor to None
    col = artist.get_facecolor()
    artist.set_edgecolor(col)
    artist.set_facecolor('None')
    artist.set_zorder(10)

    # Each box has 6 associated Line2D objects (to make the whiskers, fliers, etc.)
    # Loop over them here, and use the same colour as above
    for j in range(i*6,i*6+6):
        line = ax2.lines[j]
        line.set_color(col)
        line.set_mfc(col)
        line.set_mec(col)

sns.despine()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1569620253164557, 'fraction_numerical': 0.041455696202531644, 'mean_word_length': 5.173828125, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '454787', 'license': 'MIT', 'n_tokens_mistral': 1289, 'n_tokens_neox': 1209, 'n_words': 220, 'path': 'notebooks/reanalysis.ipynb', 'repo_name': 'Wittelab/cfdna-panel-publication', 'size': '3160'}