From 33c329b8c4ec60bb3ec64b14335b4f33ce879347 Mon Sep 17 00:00:00 2001 From: Neil Shephard Date: Wed, 4 Dec 2024 10:35:49 +0000 Subject: [PATCH] refactor: Remove cgat[core] imports and dependencies Removing unused imports and switching to `argparse.ArgumentParse` in `all_introns_counts_and_info.py` means we can now remove the import and dependency on `cgat` and `cgatcore`. --- isoslam/all_introns_counts_and_info.py | 18 ++---------------- pyproject.toml | 3 --- 2 files changed, 2 insertions(+), 19 deletions(-) diff --git a/isoslam/all_introns_counts_and_info.py b/isoslam/all_introns_counts_and_info.py index 091a740..db61f31 100644 --- a/isoslam/all_introns_counts_and_info.py +++ b/isoslam/all_introns_counts_and_info.py @@ -12,14 +12,10 @@ about it's event assignment, number of conversions, coverage etc. """ +from argparse import ArgumentParser import sys -from collections import defaultdict -import cgat.GTF as GTF -import cgatcore.experiment as E -import cgatcore.iotools as iotools import pandas as pd -import pysam as pysam from isoslam import isoslam, io @@ -31,9 +27,7 @@ def main(argv=None): if argv is None: argv = sys.argv - # setup command line parser - parser = E.ArgumentParser(description=__doc__) - + parser = ArgumentParser(description=__doc__) parser.add_argument( "-b", "--bam", @@ -41,15 +35,12 @@ def main(argv=None): type=str, help="Supply a path to the bam file that has undergone read assignment with featureCounts", ) - parser.add_argument( "-g", "--gtf", dest="gtf_path", type=str, help="Supply a path to the transcript assembly gtf file" ) - parser.add_argument( "-bed", dest="utron_bed", type=str, help="Supply a path to the utron bed file. Must be bed6 format" ) - parser.add_argument( "-o", "--out", @@ -58,7 +49,6 @@ def main(argv=None): help="""Supply a path to the output file. This file will contain conversions per pair, accounting for stranding""", ) - parser.add_argument("-vcf", "--vcf", dest="vcf_path", type=str, help="""Supply a path to the VCF.gz file""") argv_as_dictionary = vars(argv) @@ -118,8 +108,6 @@ def fragment_iterator(read_iterator): i_progress += 1 if i_progress == 10000: - # E.debug(str(i_total_progress) + " pairs processed") - # E.debug(str(i) + "spliced/retained pairs processed") i_progress = 0 read1_start = read1.reference_start @@ -506,8 +494,6 @@ def fragment_iterator(read_iterator): results = pd.concat([results, row]) return results.sort_values(by=["read_uid", "transcript_id", "chr", "start", "end"]) - # write footer and output benchmark information. - # E.stop() if __name__ == "__main__": diff --git a/pyproject.toml b/pyproject.toml index 1bf5778..f89d0f2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,8 +36,6 @@ keywords = [ ] dependencies = [ "apsw", - # "cgat", - # "cgatcore", "gevent", "loguru", "matplotlib", @@ -45,7 +43,6 @@ dependencies = [ "pandas", "pysam", "ruamel.yaml", - # "ruffus", "sqlalchemy", ]