<commit_before>#!/usr/bin/env python3

"""
This housekeeping script reads a GFF3 file and writes a new one, excluding any features
which aren't related to another feature.

The initial use-case here was a GFF file with gene features that had no mRNA children.

Warning: Because feature parentage can be anywhere in the file, this has to hold the
whole file into memory.  So don't run this on your phone with a huge file.  (Actually,
phones now could handle it just fine.)

Author: <NAME>
"""

import argparse
import os
import biocodegff

def main():
    parser = argparse.ArgumentParser( description='Removes orphaned features in a GFF3 file')

    ## output file to be written
    parser.add_argument('-i', '--input', type=str, required=True, help='Path to the input GFF3 file' )
    parser.add_argument('-o', '--output', type=str, required=True, help='Output GFF3 file to write' )
    #parser.add_argument('-t', '--type', type=str, required=False, help='Type of features to remove' )
    args = parser.parse_args()<commit_msg>minor: Documentation update with respect to memory use<commit_after>#!/usr/bin/env python3

"""
This housekeeping script reads a GFF3 file and writes a new one, excluding any features
which aren't related to another feature.

The initial use-case here was a GFF file with gene features that had no mRNA children.

Warning: Because feature parentage can be anywhere in the file, it can be difficult to
do some things like this without holding the whole file into memory.  Instead, this makes
two passes over the file and just stores line indexes to keep, along with a few IDs to
track parentage.  A bit more processing time, much less memory needed.

Author: <NAME>
"""

import argparse
import os
import biocodegff

def main():
    parser = argparse.ArgumentParser( description='Removes orphaned features in a GFF3 file')

    ## output file to be written
    parser.add_argument('-i', '--input', type=str, required=True, help='Path to the input GFF3 file' )
    parser.add_argument('-o', '--output', type=str, required=True, help='Output GFF3 file to write' )
    #parser.add_argument('-t', '--type', type=str, required=False, help='Type of features to remove' )
    args = parser.parse_args()
{'fraction_non_alphanumeric': 0.09455200360198109, 'fraction_numerical': 0.004502476361999099, 'mean_word_length': 4.328537170263789, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5372346', 'n_tokens_mistral': 647, 'n_tokens_neox': 626, 'n_words': 289}