예제 #1
0
                                             RNA_data_scaled.columns)]
Imp_Genes = pd.DataFrame(columns=Common_data.columns)
precise_time = []
knn_time = []
for i in Common_data.columns:
    print(i)
    start = tm.time()
    from principal_vectors import PVComputation

    n_factors = 50
    n_pv = 50
    dim_reduction = 'pca'
    dim_reduction_target = 'pca'

    pv_FISH_RNA = PVComputation(n_factors=n_factors,
                                n_pv=n_pv,
                                dim_reduction=dim_reduction,
                                dim_reduction_target=dim_reduction_target)

    pv_FISH_RNA.fit(Common_data.drop(i, axis=1),
                    seqFISH_data_scaled[Common_data.columns].drop(i, axis=1))

    S = pv_FISH_RNA.source_components_.T

    Effective_n_pv = sum(np.diag(pv_FISH_RNA.cosine_similarity_matrix_) > 0.3)
    S = S[:, 0:Effective_n_pv]

    Common_data_t = Common_data.drop(i, axis=1).dot(S)
    FISH_exp_t = seqFISH_data_scaled[Common_data.columns].drop(i,
                                                               axis=1).dot(S)
    precise_time.append(tm.time() - start)
예제 #2
0
    
RNA_data = datadict['RNA_data']
RNA_data_scaled = datadict['RNA_data_scaled']
del datadict

Common_data = RNA_data_scaled[np.intersect1d(osmFISH_data_scaled.columns,RNA_data_scaled.columns)]

n_factors = 30
n_pv = 30
n_pv_display = 30
dim_reduction = 'pca'
dim_reduction_target = 'pca'

pv_FISH_RNA = PVComputation(
        n_factors = n_factors,
        n_pv = n_pv,
        dim_reduction = dim_reduction,
        dim_reduction_target = dim_reduction_target
)

pv_FISH_RNA.fit(Common_data,osmFISH_data_scaled[Common_data.columns])

fig = plt.figure()
sns.heatmap(pv_FISH_RNA.initial_cosine_similarity_matrix_[:n_pv_display,:n_pv_display], cmap='seismic_r',
            center=0, vmax=1., vmin=0)
plt.xlabel('osmFISH',fontsize=18, color='black')
plt.ylabel('Allen_SSp',fontsize=18, color='black')
plt.xticks(np.arange(n_pv_display)+0.5, range(1, n_pv_display+1), fontsize=12)
plt.yticks(np.arange(n_pv_display)+0.5, range(1, n_pv_display+1), fontsize=12, rotation='horizontal')
plt.gca().set_ylim([n_pv_display,0])
plt.show()
예제 #3
0
for i in [10,30,50,100,200,500,len(Variance)]:
    Imp_New_Genes = pd.DataFrame(np.zeros((Starmap_data.shape[0],len(genes_to_impute))),columns=genes_to_impute)
    
    if(i>=50):
        n_factors = 50
        n_pv = 50
    else:
        n_factors = i
        n_pv = i
    
    dim_reduction = 'pca'
    dim_reduction_target = 'pca'
    
    pv_FISH_RNA = PVComputation(
            n_factors = n_factors,
            n_pv = n_pv,
            dim_reduction = dim_reduction,
            dim_reduction_target = dim_reduction_target
    )
    
    source_data = RNA_data_scaled[Variance.index[0:i]]
    target_data = Starmap_data_scaled[Variance.index[0:i]]
    
    pv_FISH_RNA.fit(source_data,target_data)
    
    S = pv_FISH_RNA.source_components_.T
    
    Effective_n_pv = sum(np.diag(pv_FISH_RNA.cosine_similarity_matrix_) > 0.3)
    S = S[:,0:Effective_n_pv]
    
    RNA_data_t = source_data.dot(S)
    FISH_exp_t = target_data.dot(S)