Exemplo n.º 1
0
data_pca = pcreode.PCA(data_raw)
data_pca.get_pca()

pca_test_data = data_pca.pca_set_components(5)
pca_reduced_data = data_pca.pca_set_components(3)

dens = pcreode.Density(pca_reduced_data)
density_1 = dens.get_density(radius=1.0)
noise = 8.0
target = 50.0
file_path = './myeloid_w_ids/'

#pdb.set_trace()
out_graph, out_ids = pcreode.pCreode(data=pca_reduced_data,
                                     density=density_1,
                                     noise=noise,
                                     target=target,
                                     file_path=file_path,
                                     num_runs=10)

pcreode.pCreode_Scoring(data=pca_reduced_data,
                        file_path=file_path,
                        num_graphs=10)

seed = 123
gid = 9

#Plot graph
pcreode.plot_save_graph(seed=seed,
                        file_path=file_path,
                        graph_id=gid,
                        data=pca_reduced_data,
Exemplo n.º 2
0
pca_reduced_data = data_pca.pca_set_components(min(params["n_pca_components"],expression.shape[1]))

# calculate density
dens = pcreode.Density(pca_reduced_data)
best_guess = dens.radius_best_guess()
density = dens.get_density(radius = best_guess, mute=True)

# get downsampling parameters
noise, target = pcreode.get_thresholds( pca_reduced_data)

# run pCreode
out_graph, out_ids = pcreode.pCreode(
  data = pca_reduced_data,
  density = density,
  noise = noise,
  target = target,
  file_path = "/ti/workspace/.",
  num_runs = params["num_runs"],
  mute=True
)

# score graphs, returns a vector of ranks by similarity
graph ranks = pcreode.pCreode_Scoring(data = pca_reduced_data, file_path = "/ti/workspace/.", num_graphs = params["num_runs"], mute=True)
# select most representative graph
gid = graph_ranks[0]

# extract cell graph
# Wrapper's note: This is actually a cluster graph and a grouping, but none of the objects contain this grouping
# the only thing that is available is a cell graph of only a subset of cells
# so we use this cell graph as milestone network, and then project all cells onto this
analysis = pcreode.Analysis(
Exemplo n.º 3
0
data_pca.get_pca()

pca_reduced_data = data_pca.pca_set_components(params["n_pca_components"])

# calculate density
dens = pcreode.Density(pca_reduced_data)
density = dens.get_density(radius=params["radius"])

# downsample
downed, downed_ind = pcreode.Down_Sample(pca_reduced_data, density,
                                         params["noise"], params["target"])

# run pCreode
out_graph, out_ids = pcreode.pCreode(data=pca_reduced_data,
                                     density=density,
                                     noise=params["noise"],
                                     target=params["target"],
                                     file_path="/.",
                                     num_runs=params["num_runs"])

# score graphs
# Wrapper's note: There is currently no way of extracting the best graph ordering, even though it is printed. Will select random graph.
pcreode.pCreode_Scoring(data=pca_reduced_data,
                        file_path="/.",
                        num_graphs=params["num_runs"])

gid = np.random.choice(range(params["num_runs"]), 1)[0]

# extract cell graph
# Wrapper's note: This is actually a cluster graph and a grouping, but none of the objects contain this grouping
# the only thing that is available is a cell graph of only a subset of cells
# so we use this cell graph as milestone network, and then project all cells onto this