La estructura de .mat en Python
Aquí descubrirás lo que hay en el MATLAB que has cargado en el punto anterior ejercicio.
El archivo 'albeck_gene_expression.mat'
ya está cargado
en la variable mat
. Las siguientes bibliotecas ya han
se han importado de la siguiente manera:
import scipy.io
import matplotlib.pyplot as plt
import numpy as np
Una vez más, este archivo contiene datos de expresión génica del laboratorio Albeck en UCDavis.
Este ejercicio forma parte del curso
Introducción a la importación de datos en Python
Instrucciones de ejercicio
- Utiliza el método
.keys()
en el diccionariomat
para imprimir las claves. La mayoría de estas claves (de hecho, las que sí NOT empiezan y acaban con '__') son variables del entorno MATLAB correspondiente. - Imprime el tipo del valor correspondiente a la clave
'CYratioCyt'
enmat
. Recuerda quemat['CYratioCyt']
accede al valor. - Imprime la forma del valor correspondiente a la clave
'CYratioCyt'
utilizando la funciónnumpy
shape()
. - ¡Ejecuta el script completo para ver algunos datos de expresión génica oscilatoria!
Ejercicio interactivo práctico
Pruebe este ejercicio completando este código de muestra.
# Print the keys of the MATLAB dictionary
print(____)
# Print the type of the value corresponding to the key 'CYratioCyt'
# Print the shape of the value corresponding to the key 'CYratioCyt'
# Subset the array and plot it
data = mat['CYratioCyt'][25, 5:]
fig = plt.figure()
plt.plot(data)
plt.xlabel('time (min.)')
plt.ylabel('normalized fluorescence (measure of expression)')
plt.show()