Example #1
0
def run_glimmerhmm(record: Record) -> None:
    """ Run glimmerhmm on the record, parse the results and add all detected
        genes to the record
    """
    with TemporaryDirectory(change=True):
        # Write FASTA file and run GlimmerHMM
        fasta_file = write_search_fasta(record)
        results_text = run_external(fasta_file)

    handle = StringIO(results_text)
    features = get_features_from_file(record, handle)
    for feature in features:
        record.add_biopython_feature(feature)
Example #2
0
def run_glimmerhmm(record: Record) -> None:
    """ Run glimmerhmm on the record, parse the results and add all detected
        genes to the record
    """
    with TemporaryDirectory(change=True):
        # glimmerHMM/gff_parser handles some record names poorly (e.g. leading - or only '.')
        orig_id = record.id
        record.id = "input"
        # Write FASTA file and run GlimmerHMM
        fasta_file = write_search_fasta(record)
        record.id = orig_id
        results_text = run_external(fasta_file)

    if not "CDS" in results_text:
        return

    handle = StringIO(results_text)
    features = get_features_from_file(handle)["input"]
    for feature in features:
        record.add_biopython_feature(feature)
Example #3
0
def run(record: Record, single_entry: bool, options: ConfigType) -> None:
    """ The entry point of gff_parser.
        Generates new features and adds them to the provided record.

        Arguments:
            record: the secmet.Record instance to alter
            single_entry: if True, record and GFF ids must match
            options: an antismash.Config object, used only for fetching the GFF path

        Returns:
            None
    """
    # If there's only one sequence in both, read all, otherwise, read only appropriate part of GFF3.
    limit_info = False  # type: Union[bool, Dict[str, List[str]]]
    if not single_entry:
        limit_info = {'gff_id': [record.id]}

    with open(options.genefinding_gff3) as handle:
        features = get_features_from_file(record, handle, limit_info)
        for feature in features:
            try:
                record.add_biopython_feature(feature)
            except SecmetInvalidInputError as err:
                raise AntismashInputError from err