Exemplo n.º 1
0
def main():
    #Get the parameters from the command line, using printInfo() as a fallback
    #Minimun 2 parameters: [0] = name file python, [1] = name file of the list of the gene (.csv/.zip)
    if len(sys.argv) >= 2:
        if sys.argv[1] == '--help':
            ut.printInfo()
        elif sys.argv[1] == '-vitis':
            #read parameters
            cmd = ut.readParameters(sys.argv)
            #print(type(cmd[1]))
            #build matrix of genes
            matrixGenes = vitis.buildMatrixGenesVitis(cmd[0], cmd[1])
            #print(matrixGenes)
            print('Build matrix successfully', flush=True)
            #build graph of interaction between genes
            print("Building complete graph...", flush=True)
            graphGenes = ut.manageDuplicates(ut.buildGraph(matrixGenes))
            print('Build graph successufully', flush=True)
            #find core of graphGenes
            print("Searching core network...", flush=True)
            coreGraph = ut.findCoreGraph(graphGenes)
            print('Core find successufully', flush=True)
            #print in output complete graph and core
            vitis.printOutput(coreGraph, graphGenes)
        else:
            print('ERROR: Need 1 parameters')
            print(
                'Usage: python3 managerList.py -vitis [FILTERS]... -files [FILES]...'
            )
    else:
        print('ERROR: wrong format')
        ut.printInfo()
Exemplo n.º 2
0
def applyFilter(listGenes, filter):
    if filter[0] == '-f' and len(filter) == 2:
        listGenes = filters.filterFrel(listGenes, float(filter[1]))
        global min_frel
        min_frel = float(filter[1])
    elif filter[0] == '-t' and len(filter) >= 2:
        listGenes = filters.filterType(listGenes, filter[1:])
    elif filter[0] == '-a' and len(filter) == 1:
        global autoSaveImg
        autoSaveImg = True
    else:
        print('ERROR: incorrect parameters filter')
        ut.printInfo()
    return listGenes
Exemplo n.º 3
0
def applyFilter(listGenes, filter):
    if filter[0] == '-f' and len(filter) == 2:
        listGenes = filters.filterFrel(listGenes, float(filter[1]))
        global min_frel
        min_frel = float(filter[1])
    elif filter[0] == '-t':
        print('ERROR: incorrect parameters filter. -t only for Vitis')
        ut.printInfo()
    elif filter[0] == '-a' and len(filter) == 1:
        global autoSaveImg
        autoSaveImg = True
    elif filter[0] == '-i' and len(filter) == 2:
        global ignoreEdgesIsoform
        ignoreEdgesIsoform = True
        if filter[1] == 'comp':
            global comprimeNode
            comprimeNode = True
        elif filter[1] != 'notcomp':
            print('ERROR: incorrect parameters filter -i')
            ut.printInfo()
    #elif other filter
    else:
        print('ERROR: incorrect parameters filter')
        ut.printInfo()
    return listGenes
def main():
    #Get the parameters from the command line, using printInfo() as a fallback
    #Minimun 2 parameters: [0] = name file python, [1] = name file of the list of the gene (.csv/.zip)
    if len(sys.argv) >= 2:
        if sys.argv[1] == '--help':
            ut.printInfo()
        elif sys.argv[1] == '-vitis':
            #read parameters
            cmd = ut.readParameters(sys.argv)
            #build matrix of genes
            matrixGenes = vitis.buildMatrixGenesVitis(cmd[0], cmd[1])
            print('Build matrix successfully', flush=True)
            #build graph of interaction between genes
            print("Building complete graph...", flush=True)
            graphGenes = ut.manageDuplicates(ut.buildGraph(matrixGenes))
            print('Build graph successufully', flush=True)
            #find core of graphGenes
            print("Searching core network...", flush=True)
            coreGraph = ut.findCoreGraph(graphGenes)
            print('Core find successufully', flush=True)
            #print in output complete graph and core
            vitis.printOutput(coreGraph, graphGenes)
        elif sys.argv[1] == '-human':
            #check the DB
            fantom = False
            if sys.argv[2] == '-fantom':
                pass# fantom = True
            elif sys.argv[2] == '-TCGA':
                pass
            else:
                print('ERROR: need to specify -fantom or -TCGA')
                ut.printInfo()
            #read parameters
            cmd = ut.readParameters(sys.argv)
            #build matrix of genes
            matrixGenes = human.buildMatrixGenesHuman(cmd[0], cmd[1], fantom)
            print('Build matrix successfully', flush=True)
            #build graph of interaction between genes
            print("Building complete graph...", flush=True)
            graphGenes = ut.manageDuplicates(human.removeIsoformEdges(ut.buildGraph(matrixGenes[0])))
            graphGenesOld = []
            if matrixGenes[2]:
                graphGenesOld = ut.manageDuplicates(ut.buildGraph(matrixGenes[1]))
            print('Build graph successufully', flush=True)
            #find core of graphGenes
            print("Searching core network...", flush=True)
            coreGraph = ut.findCoreGraph(graphGenes)
            print('Core find successufully', flush=True)
            #print in output complete graph and core
            human.printOutput(coreGraph, graphGenes, graphGenesOld)
        else:
            print('ERROR: Need 1 parameters')
            print('Usage: python3 managerList.py PARAM [FILTERS]... -files [FILES]...')
            print('PARAM:')
            print('\t-vitis\tLists of vitis')
            print('\t-human\tLists of human')
    else:
        print('ERROR: wrong format')
        ut.printInfo()