Created
March 1, 2019 05:25
-
-
Save antikytheraton/a5e5895f1414399f610228d65d93a3aa to your computer and use it in GitHub Desktop.
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
import pandas as pd | |
import numpy as np | |
points = [(-0.0249436820467418, 0.464245476374713),] | |
csv_data = pd.read_csv('./data/PCA_LEU2.csv') | |
class Diferencia: | |
def __init__(self, points, data, threshold): | |
self.threshold = threshold | |
self.DF1 = data[data['LIBRARY']=='PPI'] | |
self.DF2 = data[data['LIBRARY']=='Cyclic Methylated'] | |
self.X_coords = list(map(lambda point: point[0], points)) | |
self.Y_coords = list(map(lambda point: point[1], points)) | |
self.X_values = list(self.DF1.PC1) | |
self.Y_values = list(self.DF1.PC2) | |
def _diferencia(self, references, values): | |
for ref in references: | |
for val in values: | |
difference = abs(ref-val) | |
if difference < self.threshold: | |
yield values.index(val) | |
def closer(self): | |
x = list(self._diferencia(self.X_coords, self.X_values)) | |
y = list(self._diferencia(self.Y_coords, self.Y_values)) | |
return set(x).intersection(y) | |
dif = Diferencia(points, csv_data, 0.5) | |
print(dif.closer()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment