Package: cogclassifier
COGclassifierTable of ContentsOverviewInstallationWorkflowUsageOutput ContentsCustomize ChartsOverviewCOG(Cluster of Orthologous Genes) is a database that plays an important role in the annotation, classification, and analysis of microbial gene function.
Functional annotation, classification, and analysis of each gene in newly sequenced bacterial genomes using the COG database is a common task.
However, there was no COG functional classification command line software that is easy-to-use and capable of producing publication-ready figures.
Therefore, I developed COGclassifier to fill this need.
COGclassifier can automatically perform the processes from searching query sequences into the COG database, to annotation and classification of gene functions, to generation of publication-ready figures (See figure below).Fig.1: Barchart of COG funcitional category classification result for E.coliFig.2: Piechart of COG funcitional category classification result for E.coliInstallationCOGclassifier is implemented in Python3.
RPS-BLAST(v2.13.0) is bundled in COGclassifier (src/cogclassifier/bin).Install bioconda package:conda install -c bioconda -c conda-forge cogclassifierInstall PyPI stable package:pip install cogclassifierInstall latest development package:pip install git+https://github.com/moshi4/COGclassifier.gitWorkflowDescription of COGclassifier's automated workflow.1. Download COG & CDD resourcesDownload 4 required COG & CDD files from FTP site.fun-20.tab(https://ftp.ncbi.nih.gov/pub/COG/COG2020/data/fun-20.tab)Descriptions of COG functional categories.Show more informationTab-delimited plain text file with descriptions of COG functional categoriesColumns:1. Functional category ID (one letter)2. Hexadecimal RGB color associated with the functional category3. Functional category descriptionEach line corresponds to one functional category. The order of the categories is meaningful (reflects a hierarchy of functions; determines the order of display)(Fromhttps://ftp.ncbi.nih.gov/pub/COG/COG2020/data/Readme.2020-11-25.txt)cog-20.def.tab(https://ftp.ncbi.nih.gov/pub/COG/COG2020/data/cog-20.def.tab)COG descriptions such as 'COG ID', 'COG functional category', 'COG name', etc...Show more informationTab-delimited plain text file with COG descriptionsColumns:1. COG ID2. COG functional category (could include multiple letters in the order of importance)3. COG name4. Gene associated with the COG (optional)5. Functional pathway associated with the COG (optional)6. PubMed ID, associated with the COG (multiple entries are semicolon-separated; optional)7. PDB ID of the structure associated with the COG (multiple entries are semicolon-separated; optional)Each line corresponds to one COG. The order of the COGs is arbitrary (displayed in the lexicographic order)(Fromhttps://ftp.ncbi.nih.gov/pub/COG/COG2020/data/Readme.2020-11-25.txt)cddid.tbl.gz(https://ftp.ncbi.nih.gov/pub/mmdb/cdd/)Summary information about the CD(Conserved Domain) model.Show more information"cddid.tbl.gz" contains summary information about the CD models in this
distribution, which are part of the default "cdd" search database and are
indexed in NCBI's Entrez database. This is a tab-delimited text file, with a
single row per CD model and the following columns:PSSM-Id (unique numerical identifier)CD accession (starting with 'cd', 'pfam', 'smart', 'COG', 'PRK' or "CHL')CD "short name"CD descriptionPSSM-Length (number of columns, the size of the search model)(Fromhttps://ftp.ncbi.nih.gov/pub/mmdb/cdd/README)Cog_LE.tar.gz(https://ftp.ncbi.nih.gov/pub/mmdb/cdd/little_endian/)COG database, a part of CDD(Conserved Domain Database), for RPS-BLAST search.2. RPS-BLAST search against COG databaseRun query sequences RPS-BLAST against COG database [Default: E-value = 1e-2].
Best-hit (=lowest e-value) blast results are extracted and used in next functional classification step.3. Classify query sequences into COG functional categoryFrom best-hit results, extract relationship between query sequences and COG functional category as described below.Best-hit results -> CDD IDCDD ID -> COG ID (Fromcddid.tbl)COG ID -> COG Functional Category Letter (Fromcog-20.def.tab)COG Functional Category Letter -> COG Functional Category Definition (Fromfun-20.tab):warning:
If functional category with multiple letters exists, first letter is treated as functional category
(e.g. COG4862 has multiple lettersKTN. A letterKis treated as functional category).Using the above information, the number of query sequences classified into each COG functional category is calculated and
functional annotation and classification results are output.UsageBasic CommandCOGclassifier -i [query protein fasta file] -o [output directory]Options-h, --help            show this help message and exit
-i , --infile         Input query protein fasta file
-o , --outdir         Output directory
-d , --download_dir   Download COG & CDD resources directory (Default: '~/.cache/cogclassifier')
-t , --thread_num     RPS-BLAST num_thread parameter (Default: MaxThread - 1)
-e , --evalue         RPS-BLAST e-value parameter (Default: 0.01)
-v, --version         Print version informationExample CommandClassify E.coli protein sequences into COG functional category (ecoli.faa):COGclassifier -i ./example/input/ecoli.faa -o ./ecoli_cog_classifierExample APIfromcogclassifierimportcogclassifierquery_fasta_file="./example/input/ecoli.faa"outdir="./ecoli_cog_classifier"cogclassifier.run(query_fasta_file,outdir)Output ContentsCOGclassifier outputs 4 result text files, 3 html format chart files.rpsblast_result.tsv(example)RPS-BLAST against COG database result (format =outfmt 6).classifier_result.tsv(example)Query sequences classified into COG functional category result.This file contains all classified query sequences and associated COG information.Table of detailed tsv format information (9 columns)ColumnsContentsExample ValueQUERY_IDQuery IDNP_414544.1COG_IDCOG ID of RPS-BLAST top hit resultCOG0083CDD_IDCDD ID of RPS-BLAST top hit result223161EVALUERPS-BLAST top hit evalue2.5e-150IDENTITYRPS-BLAST top hit identity45.806GENE_NAMEAbbreviated gene nameThrBCOG_NAMECOG gene nameHomoserine kinaseCOG_LETTERLetter of COG functional categoryECOG_DESCRIPTIONDescription of COG functional categoryAmino acid transport and metabolismclassifier_count.tsv(example)Count classified sequences per COG functional category result.Table of detailed tsv format information (4 columns)ColumnsContentsExample ValueLETTERLetter of COG functional categoryJCOUNTCount of COG classified sequence259COLORSymbol color of COG functional category#FCCCFCDESCRIPTIONDescription of COG functional categoryTranslation, ribosomal structure and biogenesisclassifier_stats.txt(example)The percentages of the classified sequences are described as example below.86.35% (3575 / 4140) sequences classified into COG functional category.classifier_count_barchart.htmlBarchart of COG funcitional category classification result.COGclassifier usesAltairvisualization library for plotting html format charts.In web browser, Altair charts interactively display tooltips and can export image as PNG or SVG format.classifier_count_piechart.htmlPiechart of COG funcitional category classification result.Functional category with percentages less than 1% don't display letter on piechart.classifier_count_piechart_sort.htmlPiechart with descending sort by count.Functional category with percentages less than 1% don't display letter on piechart.Customize ChartsCOGclassifier also provides barchart & piechart plotting scripts to customize charts appearence.
Each script can plot the following feature charts fromclassifier_count.tsv. See wiki for details.Features ofplot_cog_classifier_barchartscript (wiki)Adjust figure width, height, barwidthPlot charts with percentage style instead of count number styleFix maximum value of Y-axisDescending sort by count number or notPlot charts from user-customized 'classifier_count.tsv'Features ofplot_cog_classifier_piechartscript (wiki)Adjust figure width, heightDescending sort by count number or notShow letter on piechart or notPlot charts from user-customized 'classifier_count.tsv'