Qianjiang Hu
2022-01-01
Python is a popular programming language,being of a large opensource presence with many powerful projects that receives contribution from developers around the world.
However, current developed packages/modules can not always meet the requirement for data analysis or project develping. It is quite common that we need to modify and adatp the current functions/modules into our project. On the other hand, checking the source code can garantee a clear understanding of the function we are using.
Via sys.modules files
¶import scanpy as sc
help(sc.pl.heatmap)
import sys
sys.modules['scanpy.plotting._anndata']
!cat ~miniconda3/lib/python3.7/site-packages/scanpy/plotting/_anndata.py
Via functionNama??
¶sc.pl.heatmap??
import inspect
source=inspect.getsource(sc.pl.heatmap)
Via Pycharm
¶Ctl(command) + mouseclick on the function name will show the source code