Skip to content

Instantly share code, notes, and snippets.

View malonge's full-sized avatar

Michael Alonge malonge

View GitHub Profile
#!/usr/bin/env python
import argparse
def delta2paf():
"""
Essentially a translation of paftools.js delta2paf
https://github.com/lh3/minimap2/tree/master/misc
"""
import re
import gzip
import argparse
def main():
message = """
Summarize the rate of edits (insertion, deletion, mismatch) from minimap2 alignments of a query to a target.
For each alignment, the rate is defined as the number of edits divided by the alignment length
with respect to the query.
@malonge
malonge / sam2delta.py
Created December 29, 2018 03:43
Convert a SAM file to a MUMmer delta file
#!/usr/bin/python3
import argparse
from collections import defaultdict
"""
This utility converts a SAM file to a nucmer delta file.
SAM files must contain an NM tag, which is default in minimap2 alignments.
"""
#!/usr/bin/env python
import re
import gzip
import argparse
from collections import defaultdict
class Alignment:
def __init__(self, in_r_start, in_r_end, in_q_start, in_q_end, in_cigar, in_strand, in_num_matches, in_aln_len, in_num_mismatches):