示例#1
0
def main():
    e = Environment(version=VERSION, doc=__doc__)
    e.set_filename_parser(BowtieFilenameParser)
    # let bwa do the multiprocessing
    parser = e.argument_parser
    parser.add_argument('--path-to-bwa', nargs='?',
                        default=path_to_executable('bwa', '/usr/local/bwa*',
                                                   environ='SOT_PATH_TO_BWA'),
                        help='The path to the bwa executable')
    parser.add_argument('--path-to-samtools', nargs='?',
                        default=path_to_executable('samtools',
                                                   '/usr/local/samtools*',
                                                   environ=
                                                   'SOT_PATH_TO_SAMTOOLS'),
                        help='The path to the samtools executable')
    # fix aliases, should be --ref too
    parser.add_argument('--reference', dest='references', action='append',
                        help=dedent('''\
    Reference genome to align against (should be a
    fasta file indexed by bwa). This flag may be called multiple times
    (which will cause each reference to be aligned to separately). If no
    references are specified, we'll look the for environment variable
    SOT_DEFAULT_REFERENCES, which should be given as a list,
    e.g. "foo foo2 foo3"'''),
                        )
    parser.add_argument('--passthru-args', nargs='*',
                        help='A list of arguments to be passed through to bwa '
                             'Substitute + '
                             'for - (e.g., --passthru-args +m 4 50')
    context = e.get_context()
    new_references = validate_references(**context)
    e.update_context({'references': new_references})
    sequence = e.get_sequence(**context)
    e._sequence = merge_pairs(sequence)
    e.do_action(align_bwa)
示例#2
0
def main():
    e = Environment(version=VERSION, doc=__doc__)
    e.set_filename_parser(BowtieFilenameParser)
    # let bowtie2 do the multiprocessing
    e.override_num_cpus(1)
    parser = e.argument_parser
    parser.add_argument('--path-to-bowtie2', nargs='?',
                        default=path_to_executable('bowtie2',
                                                   '/usr/local/bowtie2-*',
                                                   environ=
                                                   'SOT_PATH_TO_BOWTIE2'),
                        help='The path to the bowtie2 executable')
    parser.add_argument('--path-to-samtools', nargs='?',
                        default=path_to_executable('samtools',
                                                   '/usr/local/samtools*',
                                                   environ=
                                                   'SOT_PATH_TO_SAMTOOLS'),
                        help='The path to the samtools executable')
    # fix aliases, should be --ref too
    parser.add_argument('--reference', dest='references', action='append',
                        help=dedent('''\
    Reference genome to align against (either a bowtie2 index name or file,
    or a fasta file). This flag may be called multiple times (which will
    cause each reference to be aligned to separately). If no references are
    specified, we'll look the for environment variable
    SOT_DEFAULT_REFERENCES, which should be given as a list,
    e.g. "foo foo2 foo3"'''),
                        )
    parser.add_argument('--ignore-quality', dest='use_quality',
                        action='store_false',
                        help=dedent('''\
    Ignore quality scores if available. Also applies to
    counter-references if any are called'''))
    cparser = parser.add_argument_group('counter-alignments',
                                        description=dedent('''\
    specify counter-reference genome(s)/sequence(s) to use for filtering out
    unwanted reads.'''))
    cparser.add_argument('--counter-reference', dest='counter_references',
                         action='append',
                         help=dedent('''\
    Optional counter-reference genome/sequences to align against (either a
    bowtie2 index name or file, or a fasta file). This flag may be called
    multiple times. All counter-references will be concatenated into one
    index, and reads will
    be aligned in --fast mode. Any reads which align will be saved
    in a separate directory called 'counteraligned' and not aligned against the
    reference genomes/sequences. If no counter-references are specified, we'll
    look the for environment variable SOT_DEFAULT_COUTNER_REFERENCES,
    which should be given as a list, e.g. "foo foo2 foo3"'''),
                         )
    parser.add_argument('--passthru-args', nargs='*',
                        help='A list of arguments to be passed through to '
                             'bowtie2 [alignment and counter-alignment]. '
                             'Substitute + for - (e.g., --passthru-args '
                             '+m 4 50')
    context = e.get_context()
    new_references = validate_references(**context)
    new_counter_references = cat_counter_references(**context)
    e.update_context({'references': new_references,
                      'counter_references': new_counter_references})
    sequence = e.get_sequence(**context)
    e._sequence = merge_pairs(sequence)
    e.do_action(align2)