Mercurial > repos > bgruening > chemfp
diff chemfp_clustering/nxn_clustering.py @ 22:6c496b524b41
ChemicalToolBoX update.
author | Bjoern Gruening <bjoern.gruening@gmail.com> |
---|---|
date | Sun, 02 Jun 2013 19:53:56 +0200 |
parents | 7c84cfa515e0 |
children | 1868005213a1 |
line wrap: on
line diff
--- a/chemfp_clustering/nxn_clustering.py Sat Jun 01 20:03:04 2013 +0200 +++ b/chemfp_clustering/nxn_clustering.py Sun Jun 02 19:53:56 2013 +0200 @@ -12,8 +12,6 @@ import scipy.cluster.hierarchy as hcluster import pylab import numpy -import tempfile - def distance_matrix(arena, tanimoto_threshold = 0.0): n = len(arena) @@ -39,7 +37,6 @@ return 1.0 - similarities - if __name__ == "__main__": parser = argparse.ArgumentParser(description="""NxN clustering for fps files. For more details please see the chemfp documentation: @@ -64,13 +61,8 @@ args = parser.parse_args() - # make sure that the file ending is fps - temp_file = tempfile.NamedTemporaryFile() - temp_link = "%s.%s" % (temp_file.name, 'fps') - temp_file.close() - os.symlink(args.input_path, temp_link) - - arena = chemfp.load_fingerprints( temp_link ) + targets = chemfp.open( args.input_path, format='fps' ) + arena = chemfp.load_fingerprints( targets ) distances = distance_matrix( arena, args.tanimoto_threshold ) linkage = hcluster.linkage( distances, method="single", metric="euclidean" ) @@ -78,5 +70,3 @@ pylab.savefig( args.output_path, format=args.oformat ) - -