예제 #1
0
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()

plt.figure()
sns.heatmap(pv_FISH_RNA.cosine_similarity_matrix_[:n_pv_display,:n_pv_display], cmap='seismic_r',
            center=0, vmax=1., vmin=0)
for i in range(n_pv_display-1):
예제 #2
0
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)

    start = tm.time()
    nbrs = NearestNeighbors(n_neighbors=50, algorithm='auto',
                            metric='cosine').fit(Common_data_t)
    distances, indices = nbrs.kneighbors(FISH_exp_t)
예제 #3
0
     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)
     
 nbrs = NearestNeighbors(n_neighbors=50, algorithm='auto',
                         metric = 'cosine').fit(RNA_data_t)
 distances, indices = nbrs.kneighbors(FISH_exp_t)
  
 for j in range(0,Starmap_data.shape[0]):
     weights = 1-(distances[j,:][distances[j,:]<1])/(np.sum(distances[j,:][distances[j,:]<1]))
예제 #4
0
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),
                    Starmap_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 = Starmap_data_scaled[Common_data.columns].drop(i,
                                                               axis=1).dot(S)
    precise_time.append(tm.time() - start)

    start = tm.time()
    nbrs = NearestNeighbors(n_neighbors=50, algorithm='auto',
                            metric='cosine').fit(Common_data_t)
    distances, indices = nbrs.kneighbors(FISH_exp_t)
예제 #5
0
Common_data = RNA_data_scaled[np.intersect1d(Starmap_data_scaled.columns,
                                             RNA_data_scaled.columns)]

n_factors = 50
n_pv = 50
n_pv_display = 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, Starmap_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('Starmap', fontsize=18, color='black')
plt.ylabel('Allen_VISp', 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),
예제 #6
0
Common_data = RNA_data_scaled[np.intersect1d(Starmap_data_scaled.columns,
                                             RNA_data_scaled.columns)]

n_factors = 50
n_pv = 50
n_pv_display = 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, Starmap_data_scaled[Common_data.columns])

plt.figure(figsize=(4, 4))
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('Starmap', fontsize=12, color='black')
plt.ylabel('Allen_VISp', fontsize=12, color='black')
plt.xticks(np.arange(4, n_pv_display, 5) + 0.5,
           range(5, n_pv_display + 1, 5),
           fontsize=8)
plt.yticks(np.arange(4, n_pv_display, 5) + 0.5,
           range(5, n_pv_display + 1, 5),