# only_chunks is used when we fragment the mapping into small aliquots
            # to use the short_queue on the cluster (it's a hack). [0] means all
            # chunks, automatically detected by the presence of the input files;
            # [None] means normal mapping, [1, 2, ..] means to map only those chunks.
            if only_chunks == [0]:
                only_chunks_sample = range(1, get_number_chunks(pname, samplename, fragment, VERBOSE=VERBOSE) + 1)
            else:
                only_chunks_sample = only_chunks

            for only_chunk in only_chunks_sample:
    
                # If the input file if missing, skip
                input_filename = get_input_filename(sample.seqrun_folder,
                                                    sample.adapter,
                                                    sample.convert_region(fragment),
                                                    type='bam',
                                                    only_chunk=only_chunk,
                                                    filtered=filtered)
                if not os.path.isfile(input_filename):
                    if VERBOSE:
                        print 'WARNING: input file not found'
                    continue

                if submit:
                    fork_self(samplename, fragment,
                              VERBOSE=VERBOSE, threads=threads,
                              n_pairs=n_pairs,
                              summary=summary,
                              only_chunks=[only_chunk],
                              filtered=filtered)