INNER CODE UNIT · Python

split_contigs

BigDataBiology/SemiBin · SemiBin/main.py:1408

def split_contigs(logger, contig_fasta, *, output, min_length):
    from .utils import possibly_compressed_write
    os.makedirs(output, exist_ok=True)

    oname = f"{output}/split_contigs.fna.gz"
    with possibly_compressed_write(oname) as ofile:
        for h, seq in fasta_iter(contig_fasta):
            if len(seq) < min_length:
                continue
            half = len(seq) // 2
            h1 = h + "_1"
            seq1 = seq[:half]
            h2 = h + "_2"
            seq2 = seq[half:]
            ofile.write(f">{h1}\n{seq1}\n")
            ofile.write(f">{h2}\n{seq2}\n")
    return oname

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…