<jupyter_start><jupyter_text>Data import from .fcs files<jupyter_code>yLB256 = pd.DataFrame()

time_stamps = ['plus', '0', '1', '2', '3', '4', '6', '24']
times = [-1, 0, 1, 2, 3, 4, 6, 24]

for t in range(len(times)):
    datafile = '2019_01_04/yLB256_t' + time_stamps[t] + '.fcs'
    sample = fct.FCMeasurement(ID = 'yLB256_' + str(time_stamps[t]), datafile = datafile)
    subset = sample.data[['FSC-A', 'SSC-A',
                         'PE-Texas Red-A', 'mCherry-A', 'DsRed-A', 'FITC-A']]
    subset['time'] = times[t]
    yLB256 = pd.concat([yLB256, subset])

yLB297 = pd.DataFrame()

time_stamps = ['plus', '0', '1', '2', '3', '4', '6', '24']
times = [-1, 0, 1, 2, 3, 4, 6, 24]

for t in range(len(times)):
    datafile = '2019_01_04/yLB297_t' + time_stamps[t] + '.fcs'
    sample = fct.FCMeasurement(ID = 'yLB297_' + str(time_stamps[t]), datafile = datafile)
    subset = sample.data[['FSC-A', 'SSC-A',
                         'PE-Texas Red-A', 'mCherry-A', 'DsRed-A', 'FITC-A']]
    subset['time'] = times[t]
    yLB297 = pd.concat([yLB297, subset])


yLB299 = pd.DataFrame()

time_stamps = ['plus', '0', '1', '2', '3', '4', '6', '24']
times = [-1, 0, 1, 2, 3, 4, 6, 24]

for t in range(len(times)):
    datafile = '2019_01_04/yLB299_t' + time_stamps[t] + '.fcs'
    sample = fct.FCMeasurement(ID = 'yLB299_' + str(time_stamps[t]), datafile = datafile)
    subset = sample.data[['FSC-A', 'SSC-A',
                         'PE-Texas Red-A', 'mCherry-A', 'DsRed-A', 'FITC-A']]
    subset['time'] = times[t]
    yLB299 = pd.concat([yLB299, subset])


datafile = '2019_01_04/yLB256_tplus.fcs'
sample = fct.FCMeasurement(ID = 'yLB256_plus', datafile = datafile)

#sample.view_interactively()
scatter_gate = fct.PolyGate([(2.528e+04, 2.864e+04),
                                 (4.752e+04, 1.108e+05),
                                 (9.293e+04, 1.849e+05),
                                 (1.402e+05, 2.503e+05),
                                 (1.951e+05, 2.565e+05),
                                 (2.382e+05, 2.453e+05),
                                 (2.467e+05, 1.426e+05),
                                 (2.121e+05, 8.717e+04),
                                 (1.677e+05, 2.739e+04),
                                 (1.279e+05, 1.431e+04),
                                 (5.698e+04, 1.182e+04),
                                 (2.623e+04, 1.992e+04),
                                 (2.576e+04, 2.988e+04)],
                                ('FSC-A', 'SSC-A'), region='in', name='scatter_gate')
yLB256_gated = pd.DataFrame()

time_stamps = ['plus', '0', '1', '2', '3', '4', '6', '24']
times = [-1, 0, 1, 2, 3, 4, 6, 24]

for t in range(len(times)):
    datafile = '2019_01_04/yLB256_t' + time_stamps[t] + '.fcs'
    sample = fct.FCMeasurement(ID = 'yLB256_' + str(time_stamps[t]), datafile = datafile)
    sample = sample.gate(scatter_gate)
    subset = sample.data[['FSC-A', 'SSC-A',
                         'PE-Texas Red-A', 'mCherry-A', 'DsRed-A', 'FITC-A']]
    subset['time'] = times[t]
    yLB256_gated = pd.concat([yLB256_gated, subset])

yLB256_gated.head()
yLB256_gated.tail()
yLB256_gated.sample(n = 5)
yLB297_gated = pd.DataFrame()

time_stamps = ['plus', '0', '1', '2', '3', '4', '6', '24']
times = [-1, 0, 1, 2, 3, 4, 6, 24]

for t in range(len(times)):
    datafile = '2019_01_04/yLB297_t' + time_stamps[t] + '.fcs'
    sample = fct.FCMeasurement(ID = 'yLB297_' + str(time_stamps[t]), datafile = datafile)
    sample = sample.gate(scatter_gate)
    subset = sample.data[['FSC-A', 'SSC-A',
                         'PE-Texas Red-A', 'mCherry-A', 'DsRed-A', 'FITC-A']]
    subset['time'] = times[t]
    yLB297_gated = pd.concat([yLB297_gated, subset])

yLB299_gated = pd.DataFrame()

time_stamps = ['plus', '0', '1', '2', '3', '4', '6', '24']
times = [-1, 0, 1, 2, 3, 4, 6, 24]

for t in range(len(times)):
    datafile = '2019_01_04/yLB299_t' + time_stamps[t] + '.fcs'
    sample = fct.FCMeasurement(ID = 'yLB299_' + str(time_stamps[t]), datafile = datafile)
    sample = sample.gate(scatter_gate)
    subset = sample.data[['FSC-A', 'SSC-A',
                         'PE-Texas Red-A', 'mCherry-A', 'DsRed-A', 'FITC-A']]
    subset['time'] = times[t]
    yLB299_gated = pd.concat([yLB299_gated, subset])

yLB297_gated.head()
yLB297_gated.tail()
yLB297_gated.sample(n = 5)
yLB299_gated.head()
yLB299_gated.tail()
yLB299_gated.sample(n = 5)
yLB256_pos = yLB256_gated.copy(deep = True)
yLB256_pos.loc[yLB256_pos['FITC-A'] < 1, 'FITC-A'] = 1
yLB256_pos.loc[yLB256_pos['mCherry-A'] < 1, 'mCherry-A'] = 1
yLB297_pos = yLB297_gated.copy(deep = True)
yLB297_pos.loc[yLB297_pos['FITC-A'] < 1, 'FITC-A'] = 1
yLB297_pos.loc[yLB297_pos['mCherry-A'] < 1, 'mCherry-A'] = 1
yLB299_pos = yLB299_gated.copy(deep = True)
yLB299_pos.loc[yLB299_pos['FITC-A'] < 1, 'FITC-A'] = 1
yLB299_pos.loc[yLB299_pos['mCherry-A'] < 1, 'mCherry-A'] = 1
yLB256_joyplot = yLB256_pos[['FITC-A', 'time']]
yLB256_joyplot['FITC-A'] = np.log10(yLB256_joyplot['FITC-A'])
yLB297_joyplot = yLB297_pos[['FITC-A', 'time']]
yLB297_joyplot['FITC-A'] = np.log10(yLB297_joyplot['FITC-A'])
yLB299_joyplot = yLB299_pos[['FITC-A', 'time']]
yLB299_joyplot['FITC-A'] = np.log10(yLB299_joyplot['FITC-A'])
yLB297_joyplot = yLB297_joyplot.assign(genotype = 'hxk2')
yLB299_joyplot = yLB299_joyplot.assign(genotype = 'snf1')
yLB256_joyplot = yLB256_joyplot.assign(genotype = 'wildtype')

combo = pd.concat([yLB299_joyplot, yLB297_joyplot, yLB256_joyplot])
sns.set(style="ticks", rc={"axes.facecolor": (0, 0, 0, 0)})
sns.set_context('paper', font_scale = 1.5)

pal = [blues[5], reds[5], grays[5]]
sns.set_palette(pal)

combo_6h = combo[combo['time'] != 24]
combo_6h = combo_6h[combo_6h['FITC-A'] >= 1]


g = sns.FacetGrid(combo_6h, row = 'time', palette = pal, hue = 'genotype', 
                  aspect = 5, height = 0.75, legend_out = True);
g.map(sns.kdeplot, 'FITC-A', clip_on = False, shade = True, alpha = 0.8, lw = 0);
g.map(plt.axhline, y = 0, lw = 2, color = 'black');

#placeholder_pH = yLB416_pH[['pH', 'time']]



time_labels = ['plus', '0h', '1h', '2h', '3h', '4h', '6h']
times = [-1, 0, 1, 2, 3, 4, 6]

#def label(x, color, label):
#    ax = plt.gca()
#    ax.text(0, 0.2, time_labels[times.index(int(label))], fontweight = 'bold', color = 'black', fontsize = 16,
#           ha = 'left', va = 'center', transform = ax.transAxes)

#g.map(label, 'time')
axes = g.axes
for ax in range(len(axes)):
    axes[ax,0].set_xlim(1,5)
    if ax == 6:
        axes[ax,0].set_xlabel('Hxt3-mNeonGreen ($\mathregular{log_{10}au}$)')

# Set the subplots to overlap
g.fig.subplots_adjust(hspace=-.25)

g.fig.suptitle('')

# Remove axes details that don't play well with overlap
g.set_titles('')
g.set(yticks=[])
g.despine(bottom=True, left=True)

yLB297_joyplot.tail()
sns.set(style="ticks", rc={"axes.facecolor": (0, 0, 0, 0)})
sns.set_context('paper', font_scale = 1.5)

pal = sns.cubehelix_palette(10, rot=-.25, light=.7)

yLB297_joyplot = yLB297_pos[['FITC-A', 'time']]
yLB297_joyplot['FITC-A'] = np.log10(yLB297_joyplot['FITC-A'])
yLB297_joyplot = yLB297_joyplot[yLB297_joyplot['time'] != 24]

g = sns.FacetGrid(yLB297_joyplot, row = 'time', hue = 'time', 
                  aspect = 5, height = 0.75, legend_out = True);
g.map(sns.kdeplot, 'FITC-A', color = reds[5], shade = True, alpha = 0.8, lw = 0);
g.map(plt.axhline, y = 0, lw = 2, color = 'black');

time_labels = ['plus', '0h', '1h', '2h', '3h', '4h', '6h']
times = [-1, 0, 1, 2, 3, 4, 6]

#def label(x, color, label):
#    ax = plt.gca()
#    ax.text(0, 0.2, time_labels[times.index(int(label))], fontweight = 'bold', color = 'black', fontsize = 16,
#           ha = 'left', va = 'center', transform = ax.transAxes)

#g.map(label, 'time')
axes = g.axes
for ax in range(len(axes)):
    axes[ax,0].set_xlim(1,5)
    if ax == 6:
        axes[ax,0].set_xlabel('Hxt3-mNeonGreen ($\mathregular{log_{10}au}$)')

# Set the subplots to overlap
g.fig.subplots_adjust(hspace=-.25)

g.fig.suptitle('')

# Remove axes details that don't play well with overlap
g.set_titles('')
g.set(yticks=[])
g.despine(bottom=True, left=True)
sns.set(style="ticks", rc={"axes.facecolor": (0, 0, 0, 0)})
sns.set_context('paper', font_scale = 1.5)

pal = sns.cubehelix_palette(10, rot=-.25, light=.7)

yLB256_joyplot = yLB256_pos[['FITC-A', 'time']]
yLB256_joyplot['FITC-A'] = np.log10(yLB256_joyplot['FITC-A'])
yLB256_joyplot = yLB256_joyplot[yLB256_joyplot['time'] != 24]

g = sns.FacetGrid(yLB256_joyplot, row = 'time', hue = 'time', 
                  aspect = 5, height = 0.75, legend_out = True);
g.map(sns.kdeplot, 'FITC-A', color = grays[5], shade = True, alpha = 0.8, lw = 0);
g.map(plt.axhline, y = 0, lw = 2, color = 'black');

time_labels = ['plus', '0h', '1h', '2h', '3h', '4h', '6h']
times = [-1, 0, 1, 2, 3, 4, 6]

#def label(x, color, label):
#    ax = plt.gca()
#    ax.text(0, 0.2, time_labels[times.index(int(label))], fontweight = 'bold', color = 'black', fontsize = 16,
#           ha = 'left', va = 'center', transform = ax.transAxes)

#g.map(label, 'time')
axes = g.axes
for ax in range(len(axes)):
    axes[ax,0].set_xlim(1,5)
    if ax == 6:
        axes[ax,0].set_xlabel('Hxt3-mNeonGreen ($\mathregular{log_{10}au}$)')

# Set the subplots to overlap
g.fig.subplots_adjust(hspace=-.25)

g.fig.suptitle('')

# Remove axes details that don't play well with overlap
g.set_titles('')
g.set(yticks=[])
g.despine(bottom=True, left=True)
sns.set(style="ticks", rc={"axes.facecolor": (0, 0, 0, 0)})
sns.set_context('paper', font_scale = 1.5)

pal = sns.cubehelix_palette(10, rot=-.25, light=.7)

yLB299_joyplot = yLB299_pos[['FITC-A', 'time']]
yLB299_joyplot['FITC-A'] = np.log10(yLB299_joyplot['FITC-A'])
yLB299_joyplot = yLB299_joyplot[yLB299_joyplot['time'] != 24]

g = sns.FacetGrid(yLB299_joyplot, row = 'time', hue = 'time', 
                  aspect = 5, height = 0.75, legend_out = True);
g.map(sns.kdeplot, 'FITC-A', color = blues[5], shade = True, alpha = 0.8, lw = 0);
g.map(plt.axhline, y = 0, lw = 2, color = 'black');

time_labels = ['plus', '0h', '1h', '2h', '3h', '4h', '6h']
times = [-1, 0, 1, 2, 3, 4, 6]

#def label(x, color, label):
#    ax = plt.gca()
#    ax.text(0, 0.2, time_labels[times.index(int(label))], fontweight = 'bold', color = 'black', fontsize = 16,
#           ha = 'left', va = 'center', transform = ax.transAxes)

#g.map(label, 'time')
axes = g.axes
for ax in range(len(axes)):
    axes[ax,0].set_xlim(1,5)
    if ax == 6:
        axes[ax,0].set_xlabel('Hxt3-mNeonGreen ($\mathregular{log_{10}au}$)')

# Set the subplots to overlap
g.fig.subplots_adjust(hspace=-.25)

g.fig.suptitle('')

# Remove axes details that don't play well with overlap
g.set_titles('')
g.set(yticks=[])
g.despine(bottom=True, left=True)
sns.set(style="ticks", rc={"axes.facecolor": (0, 0, 0, 0)})
sns.set_context('talk')

pal = sns.cubehelix_palette(10, rot=-.25, light=.7)

yLB256_joyplot = yLB256_pos[['FITC-A', 'time']]
yLB256_joyplot['FITC-A'] = np.log10(yLB256_joyplot['FITC-A'])
yLB256_joyplot = yLB256_joyplot[yLB256_joyplot['time'] != 24]

g = sns.FacetGrid(yLB256_joyplot, row = 'time', hue = 'time', 
                  aspect = 5, height = 0.75, legend_out = True);
g.map(sns.kdeplot, 'FITC-A', color = grays[5], shade = True, alpha = 0.8, lw = 0);
g.map(plt.axhline, y = 0, lw = 2, color = 'black');

time_labels = ['plus', '0h', '1h', '2h', '3h', '4h', '6h']
times = [-1, 0, 1, 2, 3, 4, 6]

#def label(x, color, label):
#    ax = plt.gca()
#    ax.text(0, 0.2, time_labels[times.index(int(label))], fontweight = 'bold', color = 'black', fontsize = 16,
#           ha = 'left', va = 'center', transform = ax.transAxes)

#g.map(label, 'time')
axes = g.axes
for ax in range(len(axes)):
    axes[ax,0].set_xlim(1,5)
    if ax == 6:
        axes[ax,0].set_xlabel('Hxt3-mNeonGreen ($\mathregular{log_{10}au}$)')

# Set the subplots to overlap
g.fig.subplots_adjust(hspace=-.25)

g.fig.suptitle('')

# Remove axes details that don't play well with overlap
g.set_titles('')
g.set(yticks=[])
g.despine(bottom=True, left=True)
sns.set(style="ticks", rc={"axes.facecolor": (0, 0, 0, 0)})
sns.set_context('talk')

pal = sns.cubehelix_palette(10, rot=-.25, light=.7)

yLB297_joyplot = yLB297_pos[['FITC-A', 'time']]
yLB297_joyplot['FITC-A'] = np.log10(yLB297_joyplot['FITC-A'])
yLB297_joyplot = yLB297_joyplot[yLB297_joyplot['time'] != 24]

g = sns.FacetGrid(yLB297_joyplot, row = 'time', hue = 'time', 
                  aspect = 5, height = 0.75, legend_out = True);
g.map(sns.kdeplot, 'FITC-A', color = reds[5], shade = True, alpha = 0.8, lw = 0);
g.map(plt.axhline, y = 0, lw = 2, color = 'black');

time_labels = ['plus', '0h', '1h', '2h', '3h', '4h', '6h']
times = [-1, 0, 1, 2, 3, 4, 6]

#def label(x, color, label):
#    ax = plt.gca()
#    ax.text(0, 0.2, time_labels[times.index(int(label))], fontweight = 'bold', color = 'black', fontsize = 16,
#           ha = 'left', va = 'center', transform = ax.transAxes)

#g.map(label, 'time')
axes = g.axes
for ax in range(len(axes)):
    axes[ax,0].set_xlim(1,5)
    if ax == 6:
        axes[ax,0].set_xlabel('Hxt3-mNeonGreen ($\mathregular{log_{10}au}$)')

# Set the subplots to overlap
g.fig.subplots_adjust(hspace=-.25)

g.fig.suptitle('')

# Remove axes details that don't play well with overlap
g.set_titles('')
g.set(yticks=[])
g.despine(bottom=True, left=True)
sns.set(style="ticks", rc={"axes.facecolor": (0, 0, 0, 0)})
sns.set_context('talk')

pal = [blues[5], reds[5], grays[5]]
sns.set_palette(pal)

combo_6h = combo[combo['time'] != 24]
combo_6h = combo_6h[combo_6h['FITC-A'] >= 1]


g = sns.FacetGrid(combo_6h, row = 'time', palette = pal, hue = 'genotype', 
                  aspect = 5, height = 0.75, legend_out = True);
g.map(sns.kdeplot, 'FITC-A', clip_on = False, shade = True, alpha = 0.8, lw = 0);
g.map(plt.axhline, y = 0, lw = 2, color = 'black');

#placeholder_pH = yLB416_pH[['pH', 'time']]



time_labels = ['plus', '0h', '1h', '2h', '3h', '4h', '6h']
times = [-1, 0, 1, 2, 3, 4, 6]

#def label(x, color, label):
#    ax = plt.gca()
#    ax.text(0, 0.2, time_labels[times.index(int(label))], fontweight = 'bold', color = 'black', fontsize = 16,
#           ha = 'left', va = 'center', transform = ax.transAxes)

#g.map(label, 'time')
axes = g.axes
for ax in range(len(axes)):
    axes[ax,0].set_xlim(1,5)
    if ax == 6:
        axes[ax,0].set_xlabel('Hxt3-mNeonGreen ($\mathregular{log_{10}au}$)')

# Set the subplots to overlap
g.fig.subplots_adjust(hspace=-.25)

g.fig.suptitle('')

# Remove axes details that don't play well with overlap
g.set_titles('')
g.set(yticks=[])
g.despine(bottom=True, left=True)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.209054685353119, 'fraction_numerical': 0.07371530640285792, 'mean_word_length': 3.5194039118286247, 'pattern_counts': {'":': 7, '<': 11, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '149070', 'license': 'MIT', 'n_tokens_mistral': 7251, 'n_tokens_neox': 6254, 'n_words': 1254, 'path': 'jupyter-notebook-files/flow_cytometry_hxt3_2019_01_04_analysis.ipynb', 'repo_name': 'bagitmery/yeast_mitochondria_and_metabolism', 'size': '14556'}