From 035c98f8fae824a7a7e746638b529b8e8454f681 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrb=C3=A1=C4=8D?= <david@hrbac.cz> Date: Fri, 20 Jan 2017 11:00:15 +0100 Subject: [PATCH] Script to create list of modulea for the clusters --- cluster_modules.py | 43 +++++++++++++++++++++++++++++++++++++++++++ get_cvs.sh | 4 ++++ 2 files changed, 47 insertions(+) create mode 100755 cluster_modules.py create mode 100755 get_cvs.sh diff --git a/cluster_modules.py b/cluster_modules.py new file mode 100755 index 000000000..dfa6400a5 --- /dev/null +++ b/cluster_modules.py @@ -0,0 +1,43 @@ +#!/usr/bin/python +import csv + +def get_data(filename): + '''function to read the data form the input csv file to use in the analysis''' + reader = [] # Just in case the file open fails + with open(filename, 'rb') as f: + reader = csv.reader(f,delimiter=',') + #returns all the data from the csv file in list form + #f.close() # May need to close the file when done + return list(reader) # only return the reader when you have finished. + +your_list = [] +your_list += get_data('modules-anselm.csv') +your_list += get_data('modules-salomon.csv') +#print your_list + +a=[["python/2.8.1",1],["python/2.9.1",2],["python/2.8.1",4],["python/3.0.1",4]] +counts = dict() +for i in your_list: + #print i[0] + #print int(i[1]) + counts[i[0]]=counts.get(i[0], 0) + int(i[1]) + +#print counts + +c=[ +"---", +"--A", +"-S-", +"-SA", +"U--", +"U-A", +"US-", +"USA", +] + +print "| Module | Clusters |" +print "| ------ | -------- |" + +for m,i in counts.iteritems(): + print "| %s | %s |" % (m,c[i]) + diff --git a/get_cvs.sh b/get_cvs.sh new file mode 100755 index 000000000..d6881b68e --- /dev/null +++ b/get_cvs.sh @@ -0,0 +1,4 @@ +#!/bin/bash +curl -s https://code.it4i.cz/hrb33/modules-anselm/raw/master/anselm.csv -o modules-anselm.csv +curl -s https://code.it4i.cz/hrb33/modules-salomon/raw/master/salomon.csv -o modules-salomon.csv +#curl -s https://code.it4i.cz/hrb33/modules-salomon/raw/master/salomon-uv.csv -o modules-salomon-uv.csv -- GitLab