Exemplo n.º 1
0
    def Builder(self, fasta_file, aligner, aligner_path, ref_path):
        """
        Function to submit the FASTA file for the reference sequence and build
        the required index file used by the aligner.
        
        This only needs to be done once, so there needs to be a check to ensure
        that if the index file have already been generated then they do no need
        to be analysed again
        """
        builder_exec = os.path.join(
            aligner_path,
            {
                BOWTIE: 'bowtie-build',
                BOWTIE2: 'bowtie2-build',
                SOAP: '2bwt-builder',
                RMAP: ''  # do nothing
            }[aligner])

        build_command = builder_exec + {
            BOWTIE: ' -f %(fname)s.fa %(fname)s',
            BOWTIE2: ' -f %(fname)s.fa %(fname)s',
            SOAP: ' %(fname)s.fa'
        }[aligner]

        wg_build(fasta_file, build_command, ref_path, aligner)
Exemplo n.º 2
0
            BOWTIE2: 'bowtie2-build',
            SOAP: '2bwt-builder'
        }[options.aligner])

    build_command = builder_exec + {
        BOWTIE: ' -f %(fname)s.fa %(fname)s',
        BOWTIE2: ' -f %(fname)s.fa %(fname)s',
        SOAP: ' %(fname)s.fa'
    }[options.aligner]

    print "Reference genome file: %s" % fasta_file
    print "Reduced Representation Bisulfite Sequencing: %s" % rrbs
    print "Builder path: %s" % builder_exec
    #---------------------------------------------------------------

    ref_path = options.dbpath

    if os.path.exists(ref_path):
        if not os.path.isdir(ref_path):
            error(
                "%s must be a directory. Please, delete it or change the -d option."
                % ref_path)
    else:
        os.mkdir(ref_path)

    if rrbs:  # RRBS preprocessing
        rrbs_build(fasta_file, build_command, ref_path, options.low_bound,
                   options.up_bound, options.aligner)
    else:  # Whole genome preprocessing
        wg_build(fasta_file, build_command, ref_path, options.aligner)
Exemplo n.º 3
0
        error('-a option should be: %s' % ' ,'.join(supported_aligners)+'.')

    builder_exec = os.path.join(options.aligner_path or aligner_path[options.aligner],
                                {BOWTIE   : 'bowtie-build',
                                 BOWTIE2  : 'bowtie2-build',
                                 SOAP     : '2bwt-builder'}[options.aligner])

    build_command = builder_exec + { BOWTIE   : ' -f %(fname)s.fa %(fname)s',
                                     BOWTIE2  : ' -f %(fname)s.fa %(fname)s',
                                     SOAP     : ' %(fname)s.fa'
                                   }[options.aligner]


    print "Reference genome file: %s" % fasta_file
    print "Reduced Representation Bisulfite Sequencing: %s" % rrbs
    print "Builder path: %s" % builder_exec
    #---------------------------------------------------------------

    ref_path = options.dbpath

    if os.path.exists(ref_path):
        if not os.path.isdir(ref_path):
            error("%s must be a directory. Please, delete it or change the -d option." % ref_path)
    else:
        os.mkdir(ref_path)

    if rrbs: # RRBS preprocessing
        rrbs_build(fasta_file, build_command, ref_path, options.low_bound, options.up_bound, options.aligner)
    else: # Whole genome preprocessing
        wg_build(fasta_file, build_command, ref_path, options.aligner)