pytbmate/tbmate/tbmate.py
def read_idx_from_tbk(fi,tbk_file,line_num,fmt,total_size=8,\
                       single_size=4,base_idx=8192):
    """
    single_size: size of a single f in fmt:
    total_size: total size of bytes in fmt.
    fmt: 'fi' of 'ff' for methylation and depth, 'f' for methylation without depth.
    """
    begain=total_size*line_num+base_idx
    result=[]
    fi.seek(begain)
    for f in fmt:
        r=fi.read(single_size)
        result.append(struct.unpack(f,r)[0])
    return result

    single_size: size of a single f in fmt:
    total_size: total size of bytes in fmt.
    fmt: 'fi' of 'ff' for methylation and depth, 'f' for methylation without depth.
    
size of a single f in fmt:
total_size: total size of bytes in fmt.
size of a single f in fmt : total_size : total size of bytes in fmt .
def read_idx_from_tbk(fi,tbk_file,line_num,fmt,total_size=8,\
                       single_size=4,base_idx=8192):
    begain=total_size*line_num+base_idx
    result=[]
    fi.seek(begain)
    for f in fmt:
        r=fi.read(single_size)
        result.append(struct.unpack(f,r)[0])
    return result
def read_idx_from_tbk ( fi , tbk_file , line_num , fmt , total_size = 8 , single_size = 4 , base_idx = 8192 ) : begain = total_size * line_num + base_idx result = [ ] fi . seek ( begain ) for f in fmt : r = fi . read ( single_size ) result . append ( struct . unpack ( f , r ) [ 0 ] ) return result
single_size: size of a single f in fmt:
total_size: total size of bytes in fmt.
single_size : size of a single f in fmt : total_size : total size of bytes in fmt .
"""
    single_size: size of a single f in fmt:
    total_size: total size of bytes in fmt.
    fmt: 'fi' of 'ff' for methylation and depth, 'f' for methylation without depth.
    """
fi
tbk_file
line_num
fmt
total_size
single_size
base_idx