INNER CODE UNIT · Python
combine_annotations
BortonWrightonLabs/DRAM · bin/combine_annotations.py:182
def combine_annotations(annotations_dir, genes_dir, dbcan_dir, output):
"""Combine annotation files with ranks and avoid duplicating specific columns."""
annotations = sorted(Path(annotations_dir).glob("*")) if annotations_dir else []
genes_faa = sorted(Path(genes_dir).glob("*")) if genes_dir else []
dbcan_paths = (
sorted(Path(dbcan_dir).glob("*dbCAN_hmm_results.tsv")) if dbcan_dir else []
)
dbcan_sub_paths = (
sorted(Path(dbcan_dir).glob("*dbCANsub_hmm_results.tsv")) if dbcan_dir else []
)
annotation_frames = [
frame
for frame in (
read_and_preprocess(path, input_fasta=input_fasta_from_filepath(path))
for path in annotations
)
if frame is not None
]