Iterator of reference contigs and lengths from a reference file.

def file_contigs(ref_file, config=None):
    """Iterator of reference contigs and lengths from a reference file.
    """
    ContigInfo = collections.namedtuple("ContigInfo", "name size")
    with open(fasta_idx(ref_file, config)) as in_handle:
        for line in (l for l in in_handle if l.strip()):
            name, size = line.split()[:2]
            yield ContigInfo(name, int(size))