import MySQLdb as mdb import csv import sys import smModule.misc as misc with open("config.txt") as c: config = misc.readConfig(c.readlines()) def flatl(l): """ Flattening lists made easy! Or unpacking tuples made easy! Try: a = ['a','b',[1,2,3,4]] print flatl(a) """ return([item for subl in l for item in subl]) def merge_intv(intervals, distance = 6): """ An algorithm to sort tuples with (start, end) coordinates the last element is compared with the upper element and a new one is generated on the fly in case the coordinates are adjacent to each other Default argument for distance is 6, can be modified by providing a dist argument """ sorted_by_lower_bound = sorted(intervals, key=lambda tup: tup[0]) merged = [] global lower
action="store_true", default=False, help="This command uses non subsetted tables") parser.add_argument( "--cluster_and_visualize", "-cv", dest="cluster_and_visualize", action="store_true", default=False, help= "If you only want to rerun clustering and visualization, choose this option" ) args = parser.parse_args() with open("config.txt") as c: config = readConfig(c.readlines()) print("Queries to format smurf databases") if args.otherBlast: print("%s -in smurf.fasta -dbtype prot" % config['makeblastdbPath']) else: print("%s -i smurf.fasta" % config['formatDbPath']) ######## # LOADING ORGS filename = args.filename biblastBaseTable = args.bibase smurfBidirHitsName = args.biFinal testLogName = args.logFile