Mercurial > repos > iuc > bbgbigwig
view gff_to_bed_converter.py @ 0:65a296d558e7 draft default tip
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bbgbigwig commit decf6daa4769664f779bc088b83b0f89ac1df147
| author | iuc |
|---|---|
| date | Fri, 12 Dec 2025 21:28:28 +0000 |
| parents | |
| children |
line wrap: on
line source
#!/usr/bin/env python import sys assert sys.version_info[:2] >= (2, 6) def __main__(): skipped_lines = 0 first_skipped_line = None # was sys.argv[2] but we need stdout for a pipe in bam_bed_gff_to_bigwig.xml for i, line in enumerate(sys.stdin): line = line.rstrip("\r\n") if line and not line.startswith("#"): try: elems = line.split("\t") start = str(int(elems[3]) - 1) endoff = str(int(elems[4]) - 1) # GFF format: chrom, source, name, chromStart, chromEnd, score, strand # bedtools puts out only 4 fields: chrom, chromStart, chromEnd, score sys.stdout.write(f"{elems[0]}\t{start}\t{endoff}\t0\n") except Exception: skipped_lines += 1 if not first_skipped_line: first_skipped_line = i + 1 else: skipped_lines += 1 if not first_skipped_line: first_skipped_line = i + 1 if __name__ == "__main__": __main__()
