Пример #1
0
from micall.core import project_config
from micall.utils.externals import Bowtie2, Bowtie2Build, LineCounter

BOWTIE_THREADS = 1    # Bowtie performance roughly scales with number of threads
BOWTIE_VERSION = '2.2.8'        # version of bowtie2, used for version control
BOWTIE_PATH = 'bowtie2-align-s'         # path to executable, so you can install more than one version
BOWTIE_BUILD_PATH = 'bowtie2-build-s'
# Read and reference gap open/extension penalties.
READ_GAP_OPEN = 10
READ_GAP_EXTEND = 3
REF_GAP_OPEN = 10
REF_GAP_EXTEND = 3

logger = logging.getLogger(__name__)
line_counter = LineCounter()


def prelim_map(fastq1,
               fastq2,
               prelim_csv,
               nthreads=BOWTIE_THREADS,
               rdgopen=READ_GAP_OPEN,
               rfgopen=REF_GAP_OPEN,
               stderr=sys.stderr,
               gzip=False,
               work_path='',
               excluded_seeds=None):
    """ Run the preliminary mapping step.

    @param fastq1: the file name for the forward reads in FASTQ format
Пример #2
0
    def __init__(self, parent, *args, **kwargs):
        self.pssm = Pssm(
            path_to_lookup=AssetWrapper('micall/g2p/g2p_fpr.txt').path,
            path_to_matrix=AssetWrapper('micall/g2p/g2p.matrix').path)

        tk.Frame.__init__(self, parent, *args, **kwargs)
        self.parent = parent
        parent.report_callback_exception = self.report_callback_exception

        self.rundir = None  # path to MiSeq run folder containing data
        self.workdir = gettempdir()  # default to temp directory
        os.chdir(self.workdir)

        self.line_counter = LineCounter()

        self.run_info = None
        self.target_files = []

        self.button_frame = tk.Frame(self)
        self.button_frame.pack(side='top')
        self.console_frame = tk.Frame(self)
        self.console_frame.pack(side='top', fill='both', expand=True)

        try:
            with open(MiCall.CONFIG_FILE, 'rU') as f:
                self.config = json.load(f)
        except:
            self.config = {}

        self.nthreads = self.config.get('threads', None)
        if not self.nthreads:
            self.nthreads = int(round(cpu_count() * 0.5))
            self.config['threads'] = self.nthreads
            self.write_config()

        self.button_run = tk.Button(self.button_frame,
                                    text="Run",
                                    command=self.process_files)
        self.button_run.grid(row=0, column=1, sticky='W')

        self.progress_bar = Progressbar(self.button_frame,
                                        orient='horizontal',
                                        length=500,
                                        mode='determinate')
        self.progress_bar.grid(row=1, columnspan=5)

        scrollbar = tk.Scrollbar(self.console_frame)
        scrollbar.pack(side=tk.RIGHT, fill=tk.Y)
        self.console = tk.Text(self.console_frame,
                               bg='black',
                               fg='white',
                               yscrollcommand=scrollbar.set)
        self.console.pack(side=tk.LEFT, fill=tk.BOTH)
        self.console.tag_configure('ERROR', foreground="red")
        scrollbar.config(command=self.console.yview)

        # redirect stderr to Text widget
        #sys.stderr = Redirector(self.console)

        self.write('Welcome to MiCall v{}, running with {} threads.\n'.format(
            pipeline_version, self.nthreads))