#!/usr/bin/env python3

# std import
import os
import sys
import configparser
from subprocess import call

# project import
from . import logger
from .mapping import hisat2

def main(config_path):
    """ Main function of programme read configuration and run enable step """
    config = configparser.ConfigParser(interpolation =
                                       configparser.ExtendedInterpolation())

    config.read(config_path)

    logger.setup_logging(**config)

    for key in config['options']['steps'].split(","):
        for key2 in config[key]:
            print(key2 + ' : ' + config[key][key2])

def trimming(files_dir, rep_out , paired=1) :
    file_list = os.listdir(files_dir)
    for fastq in file_list :
        call(['cmd', 'options...'])


if __name__ == "__main__":
    main(sys.argv[1])

@@ -37,17 +37,18 @@
 %0Aimport 
-o
+sy
 s%0Aimport
@@ -40,35 +40,39 @@
 port sys%0Aimport 
-sys
+pkgutil
 %0Aimport configpa
@@ -79,36 +79,8 @@
 rser
-%0Afrom subprocess import call
 %0A%0A# 
@@ -118,36 +118,8 @@
 gger
-%0Afrom .mapping import hisat2
 %0A%0Ade
@@ -424,19 +424,25 @@
     for 
-key
+step_name
  in conf
@@ -476,24 +476,25 @@
 t(%22,%22):%0A
+%0A
         
 for key2
@@ -489,233 +489,1088 @@
     
-for key2 in config%5Bkey%5D:%0A            print(key2 + ' : ' + config%5Bkey%5D%5Bkey2%5D)%0A%0Adef trimming(files_dir, rep_out , paired=1) :%0A    file_list = os.listdir(files_dir)%0A    for fastq in file_list :%0A        call(%5B'cmd', 'options...'%5D
+if step_name in %5Bmodname for importer, modname, ispkg in %0A                         pkgutil.iter_modules(%0A                             sys.modules%5B__package__%5D.__path__)%5D:%0A%0A            appli_name = config%5Bstep_name%5D%5B'name'%5D%0A            module_step = __import__(%22.%22.join(%5B%22pysingcells%22, step_name%5D),%0A                                     fromlist=%22pysingcells%22)%0A%0A            if appli_name in %5Bmodname for importer, modname, ispkg in %0A                              pkgutil.iter_modules(module_step.__path__)%5D:%0A%0A                appli_module = __import__(%22.%22.join(%5B%22pysingcells%22, step_name, %0A                                                    appli_name%5D), %0A                                          fromlist=%22.%22.join(%5B%22pysingcells%22, %0A                                                             step_name%5D))%0A                appli_class = getattr(appli_module, appli_name.title())%0A                appli_instance = appli_class()%0A                appli_instance.read_configuration(**config)%0A%0A                if appli_instance.check_configuration():%0A                    appli_instance.run(
 )%0A%0A%0A

load and running of step is dynamic