Last active
August 17, 2020 03:18
-
-
Save gitUmaru/1c84a372d9332aeea8c43df823b19566 to your computer and use it in GitHub Desktop.
Protein Absorbance Heatmap--- This makes a 2d density plot of your absorbance plot, attempting to show you what your data looks like. The first file visualizes the entire microwell plate, and the second file visualizes the entire plate AND experiemntal data/standards; making for better figures. BCA absorbance visualizer for assay.
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
import matplotlib.pyplot as plt | |
import numpy as np | |
from numpy import genfromtxt | |
import os | |
path = os.path.abspath("A3.csv") | |
def main(): | |
X = genfromtxt(path,delimiter=',') | |
max = np.amax(X) | |
min = np.amin(X) | |
print(X) | |
plt.imshow(X, cmap='gray_r',interpolation='nearest', vmin=0, vmax=2) | |
# Choose vmin and vmax based on your data set min and max absorbance values | |
# I found that generally going under both max/min of absorbance yielded better visual results | |
plt.title("BCA_Assay_Visualization") | |
plt.gcf().canvas.set_window_title('BCA_Assay_Visualization') | |
plt.show() | |
main() |
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
import matplotlib.pyplot as plt | |
from mpl_toolkits.axes_grid1 import make_axes_locatable | |
import numpy as np | |
from numpy import genfromtxt | |
import os | |
microwell_path = os.path.abspath("A3.csv") | |
exp_axis = ['0','A','B','C','D','E','F','G','H'] | |
def plot_absorb(): | |
data = genfromtxt(microwell_path,delimiter=',') | |
microwell_data = data[0:6,0:11] | |
standard_data = data[6:8,0:11] | |
max, min, maxS, minS = range_of_arr(microwell_data,standard_data) | |
print(data) | |
fig, axs = plt.subplots(2) | |
axs[0].set_title("Absorbance data for experimental samples") | |
im1 = axs[0].imshow(microwell_data,cmap="gray_r") | |
divider1 = make_axes_locatable(axs[0]) | |
cax1 = divider1.append_axes("right", size="20%", pad=0.05) | |
cbar1 = plt.colorbar(im1, cax=cax1) | |
axs[0].set_yticklabels(exp_axis) | |
axs[1].set_title("Absorbance data for standards") | |
im2 = axs[1].imshow(standard_data,cmap="gray_r") | |
divider2 = make_axes_locatable(axs[1]) | |
cax2 = divider2.append_axes("right", size="20%", pad=0.05) | |
cbar2 = plt.colorbar(im2, cax=cax2) | |
axs[1].set_yticklabels(['0','G','H']) | |
fig, axs = plt.subplots(1) | |
axs.set_title("Full Visual Image of 96 well plate") | |
im3 = axs.imshow(data,cmap="gray_r") | |
divider3 = make_axes_locatable(axs) | |
cax3 = divider3.append_axes("right", size="20%", pad=0.05) | |
cbar3 = plt.colorbar(im3, cax=cax3) | |
axs.set_yticklabels(exp_axis) | |
plt.show() | |
def range_of_arr(arr1,arr2): | |
return np.amax(arr1),np.amin(arr1),np.amax(arr2),np.amin(arr2) | |
if __name__ == "__main__": | |
plot_absorb() |
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
0.1493 | 0.1546 | 0.1458 | 0.0966 | 0.0961 | 0.0971 | 0.2218 | 0.2272 | 0.2201 | 0.0969 | 0.0959 | 0.096 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|
0.0948 | 0.0974 | 0.0956 | 0.1028 | 0.1011 | 0.0956 | 0.0958 | 0.0971 | 0.0963 | 0.0972 | 0.096 | 0.1109 | |
0.1302 | 0.1354 | 0.1413 | 0.0961 | 0.0974 | 0.0975 | 0.1985 | 0.1938 | 0.1871 | 0.0955 | 0.107 | 0.1515 | |
0.0951 | 0.0962 | 0.0951 | 0.0958 | 0.0969 | 0.0974 | 0.0958 | 0.0944 | 0.0952 | 0.0952 | 0.0957 | 0.1005 | |
0.1533 | 0.1406 | 0.1571 | 0.0938 | 0.096 | 0.0931 | 0.165 | 0.1787 | 0.1496 | 0.0946 | 0.0951 | 0.0954 | |
0.1303 | 0.1306 | 0.1532 | 0.0954 | 0.0963 | 0.0999 | 0.1409 | 0.1557 | 0.1573 | 0.0945 | 0.0946 | 0.0948 | |
2.508 | 2.4896 | 2.5122 | 0.0993 | 0.9126 | 0.9138 | 0.9432 | 0.1024 | 0.3561 | 0.3816 | 0.3884 | 0.0949 | |
1.4991 | 1.5008 | 1.5559 | 0.0959 | 0.5785 | 0.564 | 0.5744 | 0.0975 | 0.1473 | 0.1366 | 0.1421 | 0.0945 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Figure 1. Experimental Data and Standards Visuallized Seperately
Figure 2. Full 96 well microplate visualization