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
# Some gene names have aliases; those can be found using gget. | |
import gget | |
import pandas as pd | |
gene_list = ['1190002N15Rik', '1700019L22Rik', '1700086L19Rik', '2610100L16Rik', '2900055J20Rik', '2900092D14Rik', '3110035E14Rik', '5031426D15Rik', '5930412G12Rik', '6330403A02Rik', '6430573F11Rik', 'A230070E04Rik', 'A330050F15Rik', 'AF529169', 'Ak3l2-ps', 'Apitd1', 'BC030499', 'BC048546', 'Bai2', 'Cecr6', 'Ctgf', 'Cxx1a', 'E130012A19Rik', 'E530001K10Rik', 'Epb4.1', 'Epb4.1l4a', 'Fam150b', 'Fam196a', 'Fam19a1', 'Fam19a2', 'Fam19a5', 'Fam212b', 'Fam46a', 'Fam84a', 'Fam84b', 'Gad1-ps', 'Gpr123', 'Gpr125', 'Gpr126', 'Gpr133', 'Gucy1a3', 'Hrasls', 'Hyi', 'I830012O16Rik', 'LOC100503338', 'LOC101056001', 'LOC102632463', 'LOC102633357', 'LOC102633724', 'LOC102634132', 'LOC102634502', 'LOC102635502', 'LOC102636041', 'LOC102636700', 'LOC102638670', 'LOC102638890', 'LOC102640573', 'LOC102643175', 'LOC105242578', 'LOC105242710', 'LOC105242740', 'LOC105243130', 'LOC105243282', 'LOC105243425', 'LOC105243542', 'LOC105244000', |
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
GO_id | description | |
---|---|---|
GO:0006623 | protein targeting to vacuole | |
GO:0006626 | protein targeting to mitochondrion | |
GO:0006627 | protein processing involved in protein targeting to mitochondrion | |
GO:0006672 | ceramide metabolic process | |
GO:0031647 | regulation of protein stability | |
GO:0006744 | ubiquinone biosynthetic process | |
GO:0006734 | NADH metabolic process | |
GO:0006783 | heme biosynthetic process | |
GO:0006506 | GPI anchor biosynthetic process |
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
function tree_lengths=TreeLengths(AM,r) | |
%Returns total length measured for each of the L trees defined by the labeled adjacency matrix. | |
%Inputs: | |
% AM : (NxN) matrix labeled adjacency matrix (assumed symmetric) | |
% r : (Nx3) position vector for the N nodes | |
%Outputs: | |
% tree_lengths : (1xL) | |
AMlbl_direct=triu(AM,1); | |
tree_labels=unique(AMlbl_direct(AMlbl_direct>0)); |
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
#Some simple file IO related operations | |
from pathlib import Path | |
#Below takes care of os based differences | |
dir_name = '/Users/Fruity/Local/datasets' | |
file_name = 'CTX_Hip_10x_counts.h5' | |
dir_path = Path(dir_name) | |
#Use forward slashes to combine path |
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
sudo apt-get install imagemagick | |
convert -delay 200 -loop 0 *.png output.gif | |
#Order of files as specified in file_list.txt | |
convert -delay 20 @file_list.txt -loop 0 animation.gif |
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
from sklearn.cross_decomposition import CCA | |
from sklearn.utils import check_array | |
from sklearn.utils.validation import check_is_fitted, FLOAT_DTYPES | |
class CCA_extended(CCA): | |
def __init__(self,*args,**kwargs): | |
super().__init__(*args,**kwargs) | |
return | |
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
#Ref: http://akuederle.com/create-numpy-array-with-for-loop | |
import numpy as np | |
n_results_per_iter = 4 | |
result_array = np.empty((0, n_results_per_iter)) | |
for iter in [1,2,3]: | |
result_this_iter = np.array([0,1,2,3]) | |
result_array = np.append(result_array, [result_this_iter], axis=0) | |
#Slicing rows and columns from a matrix simultaneously. The key is to use broadcasting. |
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
#File will be executed for every new instance of ipython | |
#Place file in: ~/.ipython/profile_default/startup/startupscript.py | |
print('loading packages and magics from ~/.ipython/profile_default/startup/startupscript.py') | |
from IPython import get_ipython | |
get_ipython().run_line_magic("load_ext","autoreload") | |
print('%load_ext autoreload') | |
get_ipython().run_line_magic("autoreload", "2") | |
print('%autoreload 2') |