Last active
August 29, 2015 14:22
-
-
Save kudkudak/f7087f81d9d527d98d9c to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| protein = "beta2" | |
| fingerprint = "KlekFP" | |
| # Read data, not important | |
| actives, inactives = get_protein_fingerprint_cluster_files(protein, fingerprint) | |
| clusters_active = [] | |
| for a, _ in actives: | |
| clusters_active.append(pd.io.parsers.read_csv(os.path.join(c["DATA_DIR"], a), header=None).as_matrix().astype("float32")) | |
| inactive = pd.io.parsers.read_csv(os.path.join(c["DATA_DIR"], inactives), header=None).as_matrix().astype("float32") | |
| print "Sizes: ", [cl.shape[0] for cl in clusters_active] | |
| # Report when found shared example | |
| for A, B in product(clusters_active, clusters_active): | |
| if A is not B: | |
| # Distances between cluster A and B using L1 | |
| D = np.min(pairwise_distances(A, B, metric='l1'), axis=1) | |
| print "Shared examples: ", (D==0).sum() | |
| print "A.shape[0]=", A.shape[0], "B.shape[0]=", B.shape[0] | |
| """ | |
| OUT: | |
| Sizes: [408, 548, 548, 22, 2, 114] | |
| Shared examples : 408 | |
| A.shape[0]= 408 B.shape[0]= 548 | |
| Shared examples : 408 | |
| A.shape[0]= 408 B.shape[0]= 548 | |
| Shared examples : 0 | |
| A.shape[0]= 408 B.shape[0]= 22 | |
| Shared examples : 0 | |
| A.shape[0]= 408 B.shape[0]= 2 | |
| Shared examples : 0 | |
| A.shape[0]= 408 B.shape[0]= 114 | |
| Shared examples : 408 | |
| A.shape[0]= 548 B.shape[0]= 408 | |
| Shared examples : 546 | |
| A.shape[0]= 548 B.shape[0]= 548 | |
| Shared examples : 22 | |
| A.shape[0]= 548 B.shape[0]= 22 | |
| Shared examples : 2 | |
| A.shape[0]= 548 B.shape[0]= 2 | |
| Shared examples : 114 | |
| A.shape[0]= 548 B.shape[0]= 114 | |
| Shared examples : 408 | |
| A.shape[0]= 548 B.shape[0]= 408 | |
| Shared examples : 546 | |
| A.shape[0]= 548 B.shape[0]= 548 | |
| Shared examples : 22 | |
| A.shape[0]= 548 B.shape[0]= 22 | |
| Shared examples : 2 | |
| A.shape[0]= 548 B.shape[0]= 2 | |
| Shared examples : 114 | |
| A.shape[0]= 548 B.shape[0]= 114 | |
| Shared examples : 0 | |
| A.shape[0]= 22 B.shape[0]= 408 | |
| Shared examples : 22 | |
| A.shape[0]= 22 B.shape[0]= 548 | |
| Shared examples : 22 | |
| A.shape[0]= 22 B.shape[0]= 548 | |
| Shared examples : 0 | |
| A.shape[0]= 22 B.shape[0]= 2 | |
| Shared examples : 0 | |
| A.shape[0]= 22 B.shape[0]= 114 | |
| Shared examples : 0 | |
| A.shape[0]= 2 B.shape[0]= 408 | |
| Shared examples : 2 | |
| A.shape[0]= 2 B.shape[0]= 548 | |
| Shared examples : 2 | |
| A.shape[0]= 2 B.shape[0]= 548 | |
| Shared examples : 0 | |
| A.shape[0]= 2 B.shape[0]= 22 | |
| Shared examples : 0 | |
| A.shape[0]= 2 B.shape[0]= 114 | |
| Shared examples : 0 | |
| A.shape[0]= 114 B.shape[0]= 408 | |
| Shared examples : 114 | |
| A.shape[0]= 114 B.shape[0]= 548 | |
| Shared examples : 114 | |
| A.shape[0]= 114 B.shape[0]= 548 | |
| Shared examples : 0 | |
| A.shape[0]= 114 B.shape[0]= 22 | |
| Shared examples : 0 | |
| A.shape[0]= 114 B.shape[0]= 2 | |
| """ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment