From 919c4f0ab3e1a9c8982ee0ecacf8dbbbf536eaa1 Mon Sep 17 00:00:00 2001 From: Andrey Prjibelski Date: Wed, 27 Dec 2023 17:26:07 +0300 Subject: [PATCH] remove low_memory --- README.md | 6 ++---- isoquant.py | 15 ++++++--------- src/alignment_processor.py | 4 ++-- src/dataset_processor.py | 2 +- 4 files changed, 11 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 80cfc1a3..7b18dc26 100644 --- a/README.md +++ b/README.md @@ -568,11 +568,9 @@ We recommend _not_ to modify these options unless you are clearly aware of their for storing the annotation database, because SQLite database cannot be created on a shared disks. The folder will be created automatically. -`--low_memory` - Deprecated, default behaviour since 3.2. - `--high_memory` - Cache read alignments instead for making several passes over a BAM file, noticeably increases RAM usage. + Cache read alignments instead for making several passes over a BAM file, noticeably increases RAM usage, +but may improve running time when disk I/O is relatively slow. `--min_mapq` Filers out all alignments with MAPQ less than this value (will also filter all secondary alignments, as they typically have MAPQ = 0). diff --git a/isoquant.py b/isoquant.py index c443a35a..4d5f5526 100755 --- a/isoquant.py +++ b/isoquant.py @@ -185,8 +185,6 @@ def add_hidden_option(*args, **kwargs): # show command only with --full-help help="align reads to reference without running further analysis") # ADDITIONAL - add_additional_option("--low_memory", help="decrease RAM consumption (deprecated, set by default)", - action='store_true', default=True) add_additional_option("--high_memory", help="increase RAM consumption (store alignment and the genome in RAM)", action='store_true', default=False) add_additional_option("--no_junc_bed", action="store_true", default=False, @@ -239,11 +237,13 @@ def add_hidden_option(*args, **kwargs): # show command only with --full-help type=str, required=True) resume_parser.add_argument('--debug', action='store_true', default=argparse.SUPPRESS, help='Debug log output.') - resume_parser.add_argument("--threads", "-t", help="number of threads to use", type=int, default=argparse.SUPPRESS) - resume_parser.add_argument("--low_memory", help="decrease RAM consumption (deprecated, set by default)", + resume_parser.add_argument("--threads", "-t", help="number of threads to use", + type=int, default=argparse.SUPPRESS) + resume_parser.add_argument("--high_memory", + help="increase RAM consumption (store alignment and the genome in RAM)", + action='store_true', default=False) + resume_parser.add_argument("--keep_tmp", help="do not remove temporary files in the end", action='store_true', default=argparse.SUPPRESS) - resume_parser.add_argument("--keep_tmp", help="do not remove temporary files in the end", action='store_true', - default=argparse.SUPPRESS) args, unknown_args = resume_parser.parse_known_args(sys.argv[1:]) if unknown_args: logger.error("You cannot specify options other than --output/--threads/--debug/--low_memory " @@ -294,9 +294,6 @@ def check_and_load_args(args, parser): elif not os.path.exists(args.genedb_output): os.makedirs(args.genedb_output) - if args.high_memory: - args.low_memory = False - if not check_input_params(args): parser.print_usage() exit(-1) diff --git a/src/alignment_processor.py b/src/alignment_processor.py index d916ff94..67df2262 100644 --- a/src/alignment_processor.py +++ b/src/alignment_processor.py @@ -229,7 +229,7 @@ def __init__(self, chr_id, bam_pairs, params, illumina_bam, genedb=None, chr_rec self.bam_merger = BAMOnlineMerger(self.bam_pairs, self.chr_id, 0, self.bam_pairs[0][0].get_reference_length(self.chr_id), - multiple_iterators=self.params.low_memory) + multiple_iterators=not self.params.high_memory) self.strand_detector = StrandDetector(self.chr_record) self.read_groupper = read_groupper self.polya_finder = PolyAFinder(self.params.polya_window, self.params.polya_fraction) @@ -238,7 +238,7 @@ def __init__(self, chr_id, bam_pairs, params, illumina_bam, genedb=None, chr_rec def process(self): current_region = None - alignment_storage = BAMAlignmentStorage(self.bam_merger) if self.params.low_memory else InMemoryAlignmentStorage() + alignment_storage = BAMAlignmentStorage(self.bam_merger) if not self.params.high_memory else InMemoryAlignmentStorage() for bam_index, alignment in self.bam_merger.get(): if alignment_storage.alignment_is_not_adjacent(alignment): diff --git a/src/dataset_processor.py b/src/dataset_processor.py index 9c16f82a..8559097a 100644 --- a/src/dataset_processor.py +++ b/src/dataset_processor.py @@ -90,7 +90,7 @@ def set_polya_requirement_strategy(flag, polya_requirement_strategy): def collect_reads_in_parallel(sample, chr_id, args): current_chr_record = Fasta(args.reference)[chr_id] - if not args.low_memory: + if args.high_memory: current_chr_record = str(current_chr_record) read_grouper = create_read_grouper(args, sample, chr_id) lock_file = reads_collected_lock_file_name(sample.out_raw_file, chr_id)