INNER CODE UNIT · Python

hamming_dist

cbg-ethz/V-pipe · workflow/scripts/alignmentBias.py:83

def hamming_dist(s1, s2):
    """Return the Hamming distance between sequences"""
    assert len(s1) == len(s2), (
        "Hamming distance is undefined for sequences " "differing in their lengths"
    )
    return sum(el1 != el2 for el1, el2 in zip(s1, s2))


def main():
    args = parse_args()
    reference = SeqIO.read(args.reference_file, "fasta")
    reference_len = len(reference)
    start = None
    end = None

    hap_cnt = {}
    hap_coverage = {}
    with pysam.AlignmentFile(args.bamfile, "rb") as alnfile:

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…