#! /usr/bin/python3 # -*- coding: utf-8 -*- last_edit = "Last edited on 2026-09-12 08:29:21 by stolfi" import sys, re, os, string, glob from sys import stderr as err import html_gen as h from process_funcs import bash, run_command, basic_line_loop import html_report_funcs as hr import bencao_starps_report_funcs as repf import bencao_starps_standard_bipatterns as stdbip from math import sqrt, hypot, exp, log, floor, ceil, isfinite, isnan, inf, nan def fetch_starps_line(ivt_file, loc_starps): # Reads fle {ivt_file} (assumed to be UTF-8) and looks for a line with # locus ID "<{loc_starps}>". Returns that line, minus the locus D, stripped. # Also returns the line number (from 1). # # If the {loc_starps} is not found, returns {None,None}. # Just in case: loc_starps = re.sub(r"[<>]", "", loc_starps) loc_pat = f"<{loc_starps}>" rd = open(ivt_file, "r") rd.reconfigure(encoding='utf-8') text = None nlin = 0 for line in rd: nlin += 1 if re.match(loc_pat, line): text = re.sub(loc_pat, "", line) text = text.strip() break rd.close() return text, nlin # ---------------------------------------------------------------------- def test_stuff(): err.write("BEGIN TESTING\n") err.write("----------------------------------------\n") err.write("END TESTING\n") return # ---------------------------------------------------------------------- if len(sys.argv) == 2 and sys.argv[1] == "R70.TEST": test_stuff()