#!/usr/bin/env python import pandas as pd import numpy as np import sklearn.decomposition import dynclipy import time checkpoints = {} ##################################### ### LOAD DATA ### ##################################### task = dynclipy.main(definition_location = "/tests/python/definition.yml") expression = task["expression"] params = task["parameters"] cell_ids = expression.index if "start_id" in task["priors"]: start_id = task["priors"]["start_id"] else: start_id = None checkpoints["method_afterpreproc"] = time.time() ##################################### ### INFER TRAJECTORY ### ##################################### # do PCA
#!/usr/local/bin/python import dynclipy task = dynclipy.main() import pandas as pd import numpy as np import json from pymatcher import matcher import time checkpoints = {} # ____________________________________________________________________________ # Load data #### expression = task["expression"] parameters = task["parameters"] # ____________________________________________________________________________ # Infer trajectory #### m = matcher.MATCHER([expression.values]) m.infer(quantiles=parameters["quantiles"], method=parameters["method"]) checkpoints["method_aftermethod"] = time.time() # ____________________________________________________________________________ # Save output #### dataset = dynclipy.wrap_data(cell_ids=expression.index) # pseudotime
#!/usr/bin/env python import dynclipy dataset = dynclipy.main() import pandas as pd import sklearn.decomposition # infer trajectory pca = sklearn.decomposition.PCA() dimred = pca.fit_transform(dataset['expression']) pseudotime = pd.Series(dimred[:, dataset['parameters']['component'] - 1], index=dataset['expression'].index) # build trajectory trajectory = dynclipy.wrap_data(cell_ids=dataset['expression'].index) trajectory.add_linear_trajectory(pseudotime=pseudotime) # save output trajectory.write_output(dataset['output'])