param = px.get_input_output_parameters(in_out, param) param = px.get_fastqc_choice(fastqc,param) param = px.get_adapter_parameters(adapter, param) param = px.get_quality_parameters(quality, param) param = px.get_useful_parameters(useful, param) else : # get parameters from argparse # copy arguments [dict] param = arguments # CHECK LAYOUT --------------------------------------------------------- layout = ce.check_layout(param['layout']) param['layout'] = layout # CHECK INPUT(s) ACCORDING TO LAYOUT ----------------------------------- # For Single Ends, one input file is expected if(layout=='SE'): if not len(param['input']) == 1 : sys.exit("/!\ Only one file containing reads must be given for \ SE data.") ce.check_input(param['input'][0], 'for single end data') # For Paired Ends, two input files are expected
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