예제 #1
0
    
            for files in param['input']:
                ce.check_input(files, 'for paired end data')
                
                
        # DELETE UNNECESSARY KEYS which have None for value --------------------
        
        for key, value in param.items():
            if value==None:
                del param[key]
        
        
        # CHECK OUTPUT DIRECTORY -----------------------------------------------
        
        if 'output' in param :
            param['output'] = ce.check_output_dir(param['output'])


        # CHECK PARAMETERS -----------------------------------------------------
        
            # check illuminaclip
        if 'illuminaclip' in param :
            pa.check_illuminaclip(param['illuminaclip'])
            
            # check slidingwindow 
        if 'slidingwindow' in param :
            pa.check_slidingwindow(param['slidingwindow'])
            
            # check maxingo
        if 'maxinfo' in param :
            pa.check_maxinfo(param['maxinfo'])
예제 #2
0
def get_input_output_parameters(Puts, param):
    """
    Function that gets inputs and outputs parameters
    
    Takes two arguments : - Puts [ElementTree] : subtree which contains inputs 
                            and outputs information's
                          - param [dict] : dictionnary containing all 
                            parameters
    
    Returns param[dict] where have been added inputs and outputs parameters
    """
    
    # check if the section 'input-output' contains 4 parameters
    if not check_child_number(Puts,4):
        sys.exit("/!\ Warning : The XML file must contain exactly 4 parameters \
in the section 'input-output'!")
    

    # LAYOUT -------------------------------------------------------------------
    
    # get the layout text
    layout = Puts.find('layout').text

    # check that the layout is not empty and is 'SE' or 'PE'
    layout = ce.check_layout(layout)
    
    # add the layout to the dictionnary
    param['layout'] = layout
    

    # INPUTS -------------------------------------------------------------------

    # get input(s)

    if(checked_layout == 'SE') :

        # get the subtree which contain SE input and get the input file
        SE = Puts.find('single-ends')
        filename=SE.find('input').text    
        
        # check if the file exists
        filename = ce.check_input(filename, 'for single-end data')
        
        # add the checked input file
        param['input'] = filename
        
    else:
        # get the subtree which contain PE input
        PE = Puts.find('paired-ends')
        
        # get input files
        for filename in PE.findall('input') :
        
            if(filename.get('name') == 'read 1') :
                
                # check the input file for read 1
                Read1 = ce.check_input(filename.text, 'reads 1 for paired-end data')
                
            elif(filename.get('name') == 'read 2') :
                
                # check the input file for read 2
                Read2 = ce.check_input(filename.text, 'reads 2 for paired-end data')
            
            else :
                sys.exit("/!\ The value of 'name' in paired-end section have been \
modified")
        
        # add the checked input files 
        param['input']= Read1, Read2
        

    # OUTPUTS ------------------------------------------------------------------    
    
    # get the working-directory where the new files must be generated
    directory = Puts.find('output-directory').text
    
    # check that output-directory is given and if it exists
    directory =  ce.check_output_dir(directory)

    # add into the dictionnary
    param['output']= directory

    return param