<commit_before>#!/usr/bin/env python3

import sys, argparse, os, re
import subprocess
import uuid
from pathlib import Path
from datetime import datetime
import utilities.dockered_pipelines.container_option as container
from somaticseq._version import __version__ as VERSION

ts = re.sub(r'[:-]', '.', datetime.now().isoformat(sep='.', timespec='milliseconds') )


DEFAULT_PARAMS = {'bwa_image'               : 'lethalfang/bwa:0.7.17_samtools',
                  'MEM'                     : 4,
                  'output_directory'        : os.curdir,
                  'out_bam'                 : 'aligned.bam',
                  'bam_header'              : '@RG\tID:{ID}\tLB:{LB}\tPL:{PL}\tSM:{SM}',
                  'action'                  : 'echo',
                  'extra_docker_options'    : '',
                  'extra_bwa_arguments'     : '',
                  'threads'                 : 1,
                  'script'                  : 'align.{}.cmd'.format(ts),
                  }



def bwa( input_parameters, tech='docker' ):

    assert os.path.exists( input_parameters['in_fastq1'] )
    assert os.path.exists( input_parameters['genome_reference'] )
    
    if input_parameters['in_fastq2']:
        assert os.path.exists( input_parameters['in_fastq2'] )
        paired_end = True
    else:
        paired_end = False

    for param_i in DEFAULT_PARAMS:
        if param_i not in input_parameters:
            input_parameters[param_i] = DEFAULT_PARAMS[param_i]

    #
    logdir  = os.path.join( input_parameters['output_directory'], 'logs' )
    outfile = os.path.join( logdir, input_parameters['script'] )

    all_paths = []
    for path_i in input_parameters['output_directory'], input_parameters['genome_reference'], input_parameters['in_fastq1'], input_parameters['in_fastq2']:<commit_msg>remove file existence checking because they are not created until workflow is underway<commit_after>#!/usr/bin/env python3

import sys, argparse, os, re
import subprocess
import uuid
from pathlib import Path
from datetime import datetime
import utilities.dockered_pipelines.container_option as container
from somaticseq._version import __version__ as VERSION

ts = re.sub(r'[:-]', '.', datetime.now().isoformat(sep='.', timespec='milliseconds') )


DEFAULT_PARAMS = {'bwa_image'               : 'lethalfang/bwa:0.7.17_samtools',
                  'MEM'                     : 4,
                  'output_directory'        : os.curdir,
                  'out_bam'                 : 'aligned.bam',
                  'bam_header'              : '@RG\tID:{ID}\tLB:{LB}\tPL:{PL}\tSM:{SM}',
                  'action'                  : 'echo',
                  'extra_docker_options'    : '',
                  'extra_bwa_arguments'     : '',
                  'threads'                 : 1,
                  'script'                  : 'align.{}.cmd'.format(ts),
                  }



def bwa( input_parameters, tech='docker' ):
    
    if input_parameters['in_fastq2']:
        assert os.path.exists( input_parameters['in_fastq2'] )
        paired_end = True
    else:
        paired_end = False

    for param_i in DEFAULT_PARAMS:
        if param_i not in input_parameters:
            input_parameters[param_i] = DEFAULT_PARAMS[param_i]

    #
    logdir  = os.path.join( input_parameters['output_directory'], 'logs' )
    outfile = os.path.join( logdir, input_parameters['script'] )

    all_paths = []
    for path_i in input_parameters['output_directory'], input_parameters['genome_reference'], input_parameters['in_fastq1'], input_parameters['in_fastq2']:
{'fraction_non_alphanumeric': 0.11958647666946075, 'fraction_numerical': 0.006426376082704666, 'mean_word_length': 2.1569664902998236, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2134133', 'n_tokens_mistral': 1101, 'n_tokens_neox': 1036, 'n_words': 203}