The bioinfokit toolkit aimed to provide various easy-to-use functionalities to analyze, visualize, and interpret the biological data generated from genome-scale omics experiments.
How to install:
bioinfokit requires
Python 3
NumPy
scikit-learn
seaborn
pandas
matplotlib
SciPy
matplotlib_venn
bioinfokit can be installed using pip, easy_install and git.
Renesh Bedre. (2020, March 5). reneshbedre/bioinfokit: Bioinformatics data analysis and visualization toolkit. Zenodo. http://doi.org/10.5281/zenodo.3698145.
Additionally check Zenodo to cite specific version of bioinfokit
Pandas dataframe table having atleast gene IDs, log fold change, P-values or adjusted P-values columns
lfc
Name of a column having log or absolute fold change values [string][default:logFC]
pv
Name of a column having P-values or adjusted P-values [string][default:p_values]
lfc_thr
Log fold change cutoff for up and downregulated genes [Tuple or list][default:(1.0, 1.0)]
pv_thr
p value or adjusted p value cutoff for up and downregulated genes [Tuple or list][default:(0.05, 0.05)]
color
Tuple of three colors [Tuple or list][default: color=(“green”, “grey”, “red”)]
valpha
Transparency of points on volcano plot [float (between 0 and 1)][default: 1.0]
geneid
Name of a column having gene Ids. This is necessary for plotting gene label on the points [string][default: None]
genenames
Tuple of gene Ids to label the points. The gene Ids must be present in the geneid column. If this option set to “deg” it will label all genes defined by lfc_thr and pv_thr [string, tuple, dict][default: None]
gfont
Font size for genenames [float][default: 10.0]. gfont not compatible with gstyle=2.
dim
Figure size [Tuple of two floats (width, height) in inches][default: (5, 5)]
r
Figure resolution in dpi [int][default: 300]. Not compatible with show= True
ar
Rotation of X and Y-axis ticks labels [float][default: 90]
dotsize
The size of the dots in the plot [float][default: 8]
legend label names. If you provide custom label names keep the same order of label names as default [list][default:[‘significant up’, ‘not significant’, ‘significant down’]]
theme
Change background theme. If theme set to dark, the dark background will be produced instead of white [string][default:’None’]
Returns:
Volcano plot image in same directory (volcano.png)
Working example
Pandas dataframe table having atleast gene IDs, log fold change, P-values or adjusted P-values
lfc
Name of a column having log fold change values [default:logFC]
pv
Name of a column having P-values or adjusted P-values [default:p_values]
lfc_thr
Log fold change cutoff for up and downregulated genes [Tuple or list] [default:(1.0, 1.0)]
pv_thr
p value or adjusted p value cutoff for up and downregulated genes [Tuple or list] [default:(0.05, 0.05)]
color
Tuple of three colors [Tuple or list][default: color=(“green”, “grey”, “red”)]
valpha
Transparency of points on volcano plot [float (between 0 and 1)][default: 1.0]
geneid
Name of a column having gene Ids. This is necessary for plotting gene label on the points [string][default: None]
genenames
Tuple of gene Ids to label the points. The gene Ids must be present in the geneid column. If this option set to “deg” it will label all genes defined by lfc_thr and pv_thr [string, Tuple, dict][default: None]
gfont
Font size for genenames [float][default: 10.0]
gstyle
Style of the text for genenames. 1 for default text and 2 for box text [int][default: 1]
dotsize
The size of the dots in the plot [float][default: 8]
legend label names. If you provide custom label names keep the same order of label names as default [list][default:[‘significant up’, ‘not significant’, ‘significant down’]]
ar
Rotation of X and Y-axis ticks labels [float][default: 90]
theme
Change background theme. If theme set to dark, the dark background will be produced instead of white [string][default:’None’]
Returns:
Inverted volcano plot image in same directory (involcano.png)
Working example
legend label names. If you provide custom label names keep the same order of label names as default [list][default:[‘significant up’, ‘not significant’, ‘significant down’]]
ar
Rotation of X and Y-axis ticks labels [float][default: 90]
theme
Change background theme. If theme set to dark_background, the dark background will be produced instead of default white. See more themes here [string][default:’None’]
geneid
Name of a column having gene Ids. This is necessary for plotting gene label on the points [string][default: None]
genenames
Tuple of gene Ids to label the points. The gene Ids must be present in the geneid column. If this option set to “deg” it will label all genes defined by lfc_thr and pv_thr [string, Tuple, dict][default: None]
gfont
Font size for genenames [float][default: 10.0]
gstyle
Style of the text for genenames. 1 for default text and 2 for box text [int][default: 1]
title
Add main title to the plot [string][default: None]
Normalize raw gene expression counts into Reads per kilo base per million mapped reads (RPKM) or
Fragments per kilo base per million mapped reads (FPKM)
bioinfokit.analys.norm.rpkm(df, gl)
Parameters
Description
df
Pandas dataframe containing raw gene expression values. Genes with missing expression or gene length values (NA) will be dropped.
gl
Name of a column having gene length in bp [string][default: None]
Returns:
RPKM or FPKM normalized Pandas dataframe as class attributes (rpkm_norm)
Pandas dataframe object with atleast SNP, chromosome, and P-values columns
chr
Name of a column having chromosome numbers [string][default:None]
pv
Name of a column having P-values. Must be numeric column [string][default:None]
log_scale
Change the values provided in pv column to minus log10 scale. If set to False, the original values in pv will be used. This is useful in case of Fst values. [Boolean (True or False)][default:True]
color
List the name of the colors to be plotted. It can accept two alternate colors or the number colors equal to chromosome number. If nothing (None) provided, it will randomly assign the color to each chromosome [list][default:None]
gwas_sign_line
Plot statistical significant threshold line defined by option gwasp [Boolean (True or False)][default: False]
gwasp
Statistical significant threshold to identify significant SNPs [float][default: 5E-08]
dotsize
The size of the dots in the plot [float][default: 8]
markeridcol
Name of a column having SNPs. This is necessary for plotting SNP names on the plot [string][default: None]
markernames
The list of the SNPs to display on the plot. These SNP should be present in SNP column. Additionally, it also accepts the dict of SNPs and its associated gene name. If this option set to True, it will label all SNPs with P-value significant score defined by gwasp [string, list, Tuple, dict][default: True]
gfont
Font size for SNP names to display on the plot [float][default: 8]. gfont not compatible with gstyle=2.
valpha
Transparency of points on plot [float (between 0 and 1)][default: 1.0]
dim
Figure size [Tuple of two floats (width, height) in inches][default: (6, 4)]
r
Figure resolution in dpi [int][default: 300]
ar
Rotation of X-axis labels [float][default: 90]
figtype
Format of figure to save. Supported format are eps, pdf, pgf, png, ps, raw, rgba, svg, svgz [string][default:’png’]
show
Show the figure on console instead of saving in current folder [Boolean (True or False)][default:False]
axxlabel
Label for X-axis. If you provide this option, default label will be replaced [string][default: None]
axylabel
Label for Y-axis. If you provide this option, default label will be replaced [string][default: None]
axlabelfontsize
Font size for axis labels [float][default: 9]
ylm
Range of ticks to plot on Y-axis [float Tuple (bottom, top, interval)][default: None]
gstyle
Style of the text for markernames. 1 for default text and 2 for box text [int][default: 1]
figname
name of figure [string][default:”manhattan”]
theme
Change background theme. If theme set to dark, the dark background will be produced instead of white [string][default:’None’]
Returns:
Manhattan plot image in same directory (Manhattan.png)
FASTQ files will be downloaded using fasterq-dump. Make sure you have the latest version of the NCBI SRA toolkit
(version 2.10.8) is installed and binaries are added to the system path
Parameters
Description
file
List of SRA accessions for batch download. All accession must be separated by a newline in the file.
t
Number of threads for parallel run [int][default=4]
other_opts
Provide other relevant options for fasterq-dump [str][default=None] Provide the options as a space-separated string. You can get a detailed option for fasterq-dump using the -help option.
Returns:
FASTQ files for each SRA accession in the current directory unless specified by other_opts
Split the sequence in overlap mode [bool][default: True]
any_cond
Split sequence based on a condition. Note yet defined.
outfmt
Output format for the subsequences. If parameter set to ‘fasta’, the file will be saved in same folder with name output_chunks.fasta [‘list’ or ‘fasta’][default: ‘list’]
Returns:
Subsequences in list or fasta file (output_chunks.fasta) format
Extract the subsequence of specified region from FASTA file. If the target subsequence region is on minus strand. the
reverse complementary of subsequence will be printed.
Parameters
Description
file
FASTA file [file]
id
The ID of sequence from FASTA file to extract the subsequence [string]
st
Start integer coordinate of subsequnece [int]
end
End integer coordinate of subsequnece [int]
strand
Strand of the subsequence [‘plus’ or ‘minus’][default: ‘plus’]
Returns:
Subsequence to stdout
Extract sequences from FASTA file
latest update v2.1.3
bioinfokit.analys.Fasta.extract_seq(file, id)
Extract the sequences from FASTA file based on the list of sequence IDs provided from other file
Parameters
Description
file
FASTA file [file]
id
List of sequence IDs separated by new line. This file can also contain the ID, start and end coordinates separated by TAB [file]
Returns:
Sequences extracted from FASTA file based on the given IDs provided in id file. Output FASTA file will be saved as
output.fasta in current working directory.
Merge counts files generated from featureCounts when it runs individually on large samples. The count files must be in
same folder and should end with .txt file extension.
Parameters
Description
pattern
file name pattern for each count file [default: ‘*.txt’]
gene_column_name
gene id column name for feature and meta-features [default: ‘Geneid’]
Returns:
Merge count file (gene_matrix_count.csv) in same folder
Split BED file by chromosome
latest update v2.0.9
bioinfokit.analys.HtsAna.split_bed(bed)
Split the BED file by chromosome names
Parameters
Description
bed
Input BED file [default: None]
Returns:
BED file for each chromosome (files will be saved in same directory)
GenFam is a comprehensive classification and enrichment analysis tool for plant genomes. It provides a unique way to
characterize the large-scale gene datasets such as those from transcriptome analysis (read GenFam paper for more details)
Parameters
Description
id_file
Text file containing the list of gene IDs to analyze using GenFam. IDs must be separated by newline.
species
Plant species ID for GenFam analysis. All plant species ID provided here
id_type
Plant species ID type 1: Phytozome locus ID 2: Phytozome transcript ID 3: Phytozome PAC ID
stat_sign_test
Statistical significance test for enrichment analysis [default=1]. 1: Fisher exact test 2: Hypergeometric distribution 3: Binomial distribution 4: Chi-squared distribution
Minimum number of gene IDs from the user list (id_file) must be mapped to the background database for performing GenFam analysis [default=5]
alpha
Significance level [float][default: 0.05]
Returns:
Attribute
Description
df_enrich
Enriched gene families with p < 0.05
genfam_info
GenFam run information
Output files
Output figures and files from GenFam analysis genfam_enrich.png: GenFam figure for enriched gene families fam_enrich_out.txt: List of enriched gene families with mapped gene IDs, GO annotation, and detailed statistics fam_all_out.txt: List of all gene families with mapped gene IDs, GO annotation, and detailed statistics
Dataframe object with numerical variables (columns) to find correlation. Ideally, you should have three or more variables. Dataframe should not have identifier column.
Pandas dataframe for appropriate t-test. One sample: It should have atleast dependent (res) variable Two sample independent: It should have independent (xfac) and dependent (res) variables Two sample paired: It should have two dependent (res) variables
xfac
Independent group column name with two levels [string][default: None]
res
Dependent variable column name [string or list or Tuple][default: None]
evar
t-test with equal variance [bool (True or False)][default: True]
alpha
Significance level for confidence interval (CI). If alpha=0.05, then 95% CI will be calculated [float][default: 0.05]
test_type
Type of t-test [int (1,2,3)][default: None]. 1: One sample t-test 2: Two sample independent t-test 3: Two sample paired t-test
mu
Population or known mean for the one sample t-test [float][default: None]
Returns:
Summary output as class attribute (summary and result)
Pandas dataframe. It should be one or two-dimensional contingency table.
p
Theoretical expected probabilities for each group. It must be non-negative and sum to 1. If p is provide Goodness of Fit test will be performed [list or Tuple][default: None]
Returns:
Summary and expected counts as class attributes (summary and expected_df)
It performs multiple pairwise comparisons of treatment groups using Tukey’s HSD (Honestly Significant Difference) test
to check if group means are significantly different from each other. It uses the Tukey-Kramer approach if the sample sizes
are unequal among the groups.
Parameters
Description
df
Pandas dataframe with the variables mentioned in the res_var, xfac_var and anova_model options. It should not have missing data. The missing data will be omitted.
res_var
Name of a column having response variable [string][default: None]
xfac_var
Name of a column having factor or group for pairwise comparison [string][default: None]
anova_model
ANOVA model (calculated using statsmodels ols function) [string][default: None]
phalpha
Significance level [float][default: 0.05]
ss_typ
Type of sum of square to perform ANOVA [int][default: 2]
Returns:
Attribute
Description
tukey_summary
Pairwise comparisons for main and interaction effects by Tukey HSD test
Pandas dataframe containing response (res_var) and independent variables (xfac_var) in a stacked format. It should not have missing data. The missing data will be omitted.
res_var
Name of a column having response variable [string][default: None]
xfac_var
Name of a column having treatment groups (independent variables) [string or list][default: None]
Returns:
Attribute
Description
bartlett_summary
Pandas dataframe containing Bartlett’s test statistics, degree of freedom, and p value
Pandas dataframe containing response (res_var) and independent variables (xfac_var) in a stacked format. It should not have missing data. The missing data will be omitted.
res_var
Name of a column having response variable [string][default: None]
xfac_var
Name of a column having treatment groups (independent variables) [string or list][default: None]
center
Choice for the Levene’s test [string (median, mean, trimmed)] [default: median] median: Brown-Forsythe Levene-type test mean: original Levene’s test trimmed: Brown-Forsythe Levene-type test
Returns:
Attribute
Description
levene_summary
Pandas dataframe containing Levene’s test statistics, degree of freedom, and p value
Calculate Root Mean Square Error (RMSE), Mean squared error (MSE), Mean absolute error (MAE), and Mean absolute percent
error (MAPE) from regression fit
latest update v1.0.8
bioinfokit.analys.stat.reg_metric(y, yhat, resid)
Parameters
Description
y
Original values for dependent variable [numpy array] [default: None]
yhat
Predicted values from regression [numpy array] [default: None]
resid
Regression residuals [numpy array][default: None]
Returns:
Pandas dataframe with values for RMSE, MSE, MAE, and MAPE
Venn dataset for 3 and 2-way venn. Data should be in the format of (100,010,110,001,101,011,111) for 3-way venn and 2-way venn (10, 01, 11) [default: (1,1,1,1,1,1,1)]
venncolor
Color Palette for Venn [color code][default: (‘#00909e’, ‘#f67280’, ‘#ff971d’)]
vennalpha
Transparency of Venn [float (0 to 1)][default: 0.5]
Travis E. Oliphant. A guide to NumPy, USA: Trelgol Publishing, (2006).
John D. Hunter. Matplotlib: A 2D Graphics Environment, Computing in Science & Engineering, 9, 90-95 (2007),
DOI:10.1109/MCSE.2007.55 (publisher link)
Fernando Pérez and Brian E. Granger. IPython: A System for Interactive Scientific Computing, Computing in Science &
Engineering, 9, 21-29 (2007), DOI:10.1109/MCSE.2007.53 (publisher link)
Michael Waskom, Olga Botvinnik, Joel Ostblom, Saulius Lukauskas, Paul Hobson, MaozGelbart, … Constantine Evans.
(2020, January 24). mwaskom/seaborn: v0.10.0 (January 2020) (Version v0.10.0). Zenodo. http://doi.org/10.5281/zenodo.3629446
Fabian Pedregosa, Gaël Varoquaux, Alexandre Gramfort, Vincent Michel, Bertrand Thirion, Olivier Grisel, Mathieu
Blondel, Peter Prettenhofer, Ron Weiss, Vincent Dubourg, Jake Vanderplas, Alexandre Passos, David Cournapeau,
Matthieu Brucher, Matthieu Perrot, Édouard Duchesnay. Scikit-learn: Machine Learning in Python, Journal of Machine
Learning Research, 12, 2825-2830 (2011)
Wes McKinney. Data Structures for Statistical Computing in Python, Proceedings of the 9th Python in Science
Conference, 51-56 (2010)
Pauli Virtanen, Ralf Gommers, Travis E. Oliphant, Matt Haberland, Tyler Reddy, David Cournapeau, Evgeni Burovski,
Pearu Peterson, Warren Weckesser, Jonathan Bright, Stéfan J. van der Walt, Matthew Brett, Joshua Wilson, K. Jarrod
Millman, Nikolay Mayorov, Andrew R. J. Nelson, Eric Jones, Robert Kern, Eric Larson, CJ Carey, İlhan Polat, Yu
Feng, Eric W. Moore, Jake VanderPlas, Denis Laxalde, Josef Perktold, Robert Cimrman, Ian Henriksen, E.A. Quintero,
Charles R Harris, Anne M. Archibald, Antônio H. Ribeiro, Fabian Pedregosa, Paul van Mulbregt, and SciPy 1.0
Contributors. (2020) SciPy 1.0: Fundamental Algorithms for Scientific Computing in Python. Nature Methods, 17(3),
261-272.
The bioinfokit toolkit aimed to provide various easy-to-use functionalities to analyze,
visualize, and interpret the biological data generated from genome-scale omics experiments.
How to install:
bioinfokit requires
bioinfokit can be installed using pip, easy_install and git.
latest bioinfokit version:
Install using pip for Python 3 (easiest way)
Install using easy_install for Python 3 (easiest way)
Install using conda
Install using git
Check the version of bioinfokit
How to cite bioinfokit?
Support
If you enjoy bioinfokit, consider supporting me,
Getting Started
Gene expression analysis
Volcano plot
latest update v2.0.8
bioinfokit.visuz.GeneExpression.volcano(df, lfc, pv, lfc_thr, pv_thr, color, valpha, geneid, genenames, gfont, dim, r, ar, dotsize, markerdot, sign_line, gstyle, show, figtype, axtickfontsize, axtickfontname, axlabelfontsize, axlabelfontname, axxlabel, axylabel, xlm, ylm, plotlegend, legendpos, figname, legendanchor, legendlabels, theme)dflfcpvlfc_thrpv_thrcolorvalphageneidgenenamesgfontdimrshow= Trueardotsizemarkerdotsign_linelfc_thr) and P-value (pv_thr) threshold value [True or False][default:False]gstyleshowfigtypeaxtickfontsizeaxtickfontnameaxlabelfontsizeaxlabelfontnameaxxlabelaxylabelxlmylmplotlegendlegendposfignamelegendanchorlegendlabelsthemedark, the dark background will be produced instead of white [string][default:’None’]Returns:
Volcano plot image in same directory (volcano.png) Working example
Inverted Volcano plot
latest update v2.0.8
bioinfokit.visuz.GeneExpression.involcano(table, lfc, pv, lfc_thr, pv_thr, color, valpha, geneid, genenames, gfont, gstyle, dotsize, markerdot, r, dim, show, figtype, axxlabel, axylabel, axlabelfontsize, axtickfontsize, axtickfontname, plotlegend, legendpos, legendanchor, figname, legendlabels, ar, theme)tablelfcpvlfc_thrpv_thrcolorvalphageneidgenenamesgfontgstyledotsizemarkerdotdimrshow= Truefigtypeshowaxxlabelaxylabelaxlabelfontsizeaxtickfontsizeaxtickfontnameplotlegendlegendposlegendanchorfignamelegendlabelsarthemedark, the dark background will be produced instead of white [string][default:’None’]Returns:
Inverted volcano plot image in same directory (involcano.png) Working example
MA plot
latest update v2.0.7
bioinfokit.visuz.GeneExpression.ma(df, lfc, ct_count, st_count, pv, basemean, lfc_thr, color, dim, dotsize, show, r, valpha, figtype, axxlabel, axylabel, axlabelfontsize, axtickfontsize, axtickfontname, xlm, ylm, fclines, fclinescolor, legendpos, legendanchor, figname, legendlabels, plotlegend, ar, theme, geneid, genenames, gfont, gstyle, title)dflfcct_countst_countpvbasemeanlfc_thrcolordotsizemarkerdotvalphadimrshow= Truefigtypeshowaxxlabelaxylabelaxlabelfontsizeaxtickfontsizeaxtickfontnamexlmylmfclineslfc[True or False][default:False]fclinescolorplotlegendlegendposlegendanchorfignamelegendlabelsarthemedark_background, the dark background will be produced instead of default white. See more themes here [string][default:’None’]geneidgenenamesgfontgstyletitleReturns:
MA plot image in same directory (ma.png)
Working example
Heatmap
latest update v2.0.1bioinfokit.visuz.gene_exp.hmap(table, cmap='seismic', scale=True, dim=(6, 8), rowclus=True, colclus=True, zscore=None, xlabel=True, ylabel=True, tickfont=(12, 12), show, r, figtype, figname, theme)filecmapscaledimrowcluscolcluszscorexlabelylabeltickfontshowrshow= Truefigtypefignamethemedark, the dark background will be produced instead of white [string][default:’None’]Returns:
heatmap plot (heatmap.png, heatmap_clus.png)
Working example
Clustering analysis
Scree plot
latest update v2.0.1bioinfokit.visuz.cluster.screeplot(obj, axlabelfontsize, axlabelfontname, axxlabel, axylabel, figtype, r, show, dim, theme)objaxlabelfontsizeaxlabelfontnameaxxlabelaxylabelfigtypershowdimthemedark, the dark background will be produced instead of white [string][default:’None’]Returns:
Scree plot image (screeplot.png will be saved in same directory)
Working Example
Principal component analysis (PCA) loadings plots
latest update v2.0.1bioinfokit.visuz.cluster.pcaplot(x, y, z, labels, var1, var2, var3, axlabelfontsize, axlabelfontname, figtype, r, show, plotlabels, dim, theme)xyzlabelsvar1var2var3axlabelfontsizeaxlabelfontnamefigtypershowplotlabelsdimthemedark, the dark background will be produced instead of white [string][default:’None’]Returns:
PCA loadings plot 2D and 3D image (pcaplot_2d.png and pcaplot_3d.png will be saved in same directory)
Working Example
Principal component analysis (PCA) biplots
latest update v2.0.2bioinfokit.visuz.cluster.biplot(cscore, loadings, labels, var1, var2, var3, axlabelfontsize, axlabelfontname, figtype, r, show, markerdot, dotsize, valphadot, colordot, arrowcolor, valphaarrow, arrowlinestyle, arrowlinewidth, centerlines, colorlist, legendpos, datapoints, dim, theme)cscoreloadingslabelsvar1var2var3axlabelfontsizeaxlabelfontnamefigtypershowmarkerdotdotsizevalphadotcolordotarrowcolorvalphaarrowarrowlinestylearrowlinewidthcenterlinescolorlistlegendposdatapointsdimthemedark, the dark background will be produced instead of white [string][default:’None’]Returns:
PCA biplot 2D and 3D image (biplot_2d.png and biplot_3d.png will be saved in same directory)
Working Example
t-SNE plot
latest update v2.0.1bioinfokit.visuz.cluster.tsneplot(score, colorlist, axlabelfontsize, axlabelfontname, figtype, r, show, markerdot, dotsize, valphadot, colordot, dim, figname, legendpos, legendanchor, theme)scorecolorlistaxlabelfontsizeaxlabelfontnamefigtypershowmarkerdotdotsizevalphadotcolordotlegendposlegendanchordimfignamethemedark, the dark background will be produced instead of white [string][default:’None’]Returns:
t-SNE 2D image (tsne_2d.png will be saved in same directory)
Working Example
Normalization
RPM or CPM normalization
latest update v0.8.9Normalize raw gene expression counts into Reads per million mapped reads (RPM) or Counts per million mapped reads (CPM)
bioinfokit.analys.norm.cpm(df)dfReturns:
RPM or CPM normalized Pandas dataframe as class attributes (cpm_norm)
Working Example
RPKM or FPKM normalization
latest update v0.9Normalize raw gene expression counts into Reads per kilo base per million mapped reads (RPKM) or Fragments per kilo base per million mapped reads (FPKM)
bioinfokit.analys.norm.rpkm(df, gl)dfglReturns:
RPKM or FPKM normalized Pandas dataframe as class attributes (rpkm_norm)
Working Example
TPM normalization
latest update v0.9.1Normalize raw gene expression counts into Transcript per million (TPM)
bioinfokit.analys.norm.tpm(df, gl)dfglReturns:
TPM normalized Pandas dataframe as class attributes (tpm_norm)
Working Example
Variant analysis
Manhattan plot
latest update v2.0.1bioinfokit.visuz.marker.mhat(df, chr, pv, log_scale, color, dim, r, ar, gwas_sign_line, gwasp, dotsize, markeridcol, markernames, gfont, valpha, show, figtype, axxlabel, axylabel, axlabelfontsize, ylm, gstyle, figname, theme)dfchrpvlog_scalepvcolumn to minus log10 scale. If set toFalse, the original values inpvwill be used. This is useful in case of Fst values. [Boolean (True or False)][default:True]colorgwas_sign_linegwasp[Boolean (True or False)][default: False]gwaspdotsizemarkeridcolmarkernamesgwasp[string, list, Tuple, dict][default: True]gfontvalphadimrarfigtypeshowaxxlabelaxylabelaxlabelfontsizeylmgstylefignamethemedark, the dark background will be produced instead of white [string][default:’None’]Returns:
Manhattan plot image in same directory (Manhattan.png)
Working example
Variant annotation
latest update v0.9.3
Assign genetic features and function to the variants in VCF file
bioinfokit.analys.marker.vcf_anot(file, id, gff_file, anot_attr)fileidgff_fileanot_attrReturns:
Tab-delimited text file with annotation (annotated text file will be saved in same directory)
Working Example
Concatenate VCF files
latest update v0.9.4
Concatenate multiple VCF files into single VCF file (for example, VCF files for each chromosome)
bioinfokit.analys.marker.concatvcf(file)fileReturns:
Concatenated VCF file (concat_vcf.vcf)
Working example
Split VCF file
bioinfokit.analys.marker.splitvcf(file)Split single VCF file containing variants for all chromosomes into individual file containing variants for each chromosome
fileidReturns:
VCF files for each chromosome
Working example
High-throughput sequence analysis
FASTQ batch downloads from SRA database
latest update v0.9.7
bioinfokit.analys.fastq.sra_bd(file, t, other_opts)FASTQ files will be downloaded using
fasterq-dump. Make sure you have the latest version of the NCBI SRA toolkit (version 2.10.8) is installed and binaries are added to the system pathfiletother_optsfasterq-dump[str][default=None]Provide the options as a space-separated string. You can get a detailed option for
fasterq-dumpusing the-helpoption.Returns:
FASTQ files for each SRA accession in the current directory unless specified by
other_optsDescription and working example
FASTQ quality format detection
bioinfokit.analys.format.fq_qual_var(file)fileReturns:
Quality format encoding name for FASTQ file (Supports only Sanger, Illumina 1.8+ and Illumina 1.3/1.4)
Working Example
Sequencing coverage
latest update v0.9.7
bioinfokit.analys.fastq.seqcov(file, gs)filegsReturns:
Sequencing coverage of the given FASTQ file
Description and Working example
Split the sequence into smaller subsequences
latest update v2.0.6
bioinfokit.analys.Fasta.split_seq(seq, seq_size, seq_overlap, any_cond, outfmt)seqseq_sizeseq_overlapany_condoutfmtoutput_chunks.fasta[‘list’ or ‘fasta’][default: ‘list’]Returns:
Subsequences in list or fasta file (output_chunks.fasta) format
Description and Working example
Reverse complement of DNA sequence
latest update v2.1.1
bioinfokit.analys.Fasta.rev_com(sequence)seqfileReturns:
Reverse complement of original DNA sequence
Working example
File format conversions
bioinfokit.analys.formatbioinfokit.analys.format.fqtofa(file)FASTQ filebioinfokit.analys.format.hmmtocsv(file)HMM filebioinfokit.analys.format.tabtocsv(file)TAB filebioinfokit.analys.format.csvtotab(file)CSV fileReturns:
Output will be saved in same directory
Working example
GFF3 to GTF file format conversion
latest update v1.0.1bioinfokit.analys.gff.gff_to_gtf(file, trn_feature_name)filetrn_feature_nameReturns:
GTF format genome annotation file (file.gtf will be saved in same directory)
Working Example
Bioinformatics file readers and processing (FASTA, FASTQ, and VCF)
latest update v2.0.4
bioinfokit.analys.Fasta.fasta_reader(file)FASTA filebioinfokit.analys.fastq.fastq_reader(file)FASTQ filebioinfokit.analys.marker.vcfreader(file)VCF fileReturns:
File generator object (can be iterated only once) that can be parsed for the record
Description and working example
Extract subsequence from FASTA files
latest update v2.0.4
bioinfokit.analys.Fasta.ext_subseq(file, id, st, end, strand)Extract the subsequence of specified region from FASTA file. If the target subsequence region is on minus strand. the reverse complementary of subsequence will be printed.
fileidstendstrandReturns:
Subsequence to stdout
Extract sequences from FASTA file
latest update v2.1.3
bioinfokit.analys.Fasta.extract_seq(file, id)Extract the sequences from FASTA file based on the list of sequence IDs provided from other file
fileidReturns:
Sequences extracted from FASTA file based on the given IDs provided in id file. Output FASTA file will be saved as output.fasta in current working directory.
Description and working example
Split FASTA file into multiple FASTA files
latest update v2.0.4
bioinfokit.analys.Fasta.split_fasta(file, n, bases_per_line)Split one big FASTA file into multiple smaller FASTA files
filenbases_per_lineReturns:
Number of smaller FASTA files with prefix output (output_0.fasta, output_1.fasta and so on)
Convert multi-line FASTA into single-line FASTA
latest update v2.1.2
bioinfokit.analys.Fasta.multi_to_single_line(file)Convert multi-line FASTA (where sequences are on multi lines) into single-line FASTA (where sequences are in single line)
fileReturns:
Single line FASTA (output.fasta). Output FASTA file will be saved as output.fasta in current working directory.
Description and working example
Merge counts files from featureCounts
latest update v2.0.5
bioinfokit.analys.HtsAna.merge_featureCount(pattern, gene_column_name)Merge counts files generated from featureCounts when it runs individually on large samples. The count files must be in same folder and should end with .txt file extension.
patterngene_column_nameReturns:
Merge count file (gene_matrix_count.csv) in same folder
Split BED file by chromosome
latest update v2.0.9
bioinfokit.analys.HtsAna.split_bed(bed)Split the BED file by chromosome names
bedReturns:
BED file for each chromosome (files will be saved in same directory)
Working example
Max and Min sequence lengths from Fasta
latest update v2.1.4
bioinfokit.analys.Fasta.max_min_len(fasta)Find Max and Min sequence lengths from Fasta
fastaReturns:
Max and Min sequence lengths from Fasta file
Working example
Functional enrichment analysis
Gene family enrichment analysis (GenFam)
latest update v1.0.0
bioinfokit.analys.genfam.fam_enrich(id_file, species, id_type, stat_sign_test, multi_test_corr, min_map_ids, alpha)GenFam is a comprehensive classification and enrichment analysis tool for plant genomes. It provides a unique way to characterize the large-scale gene datasets such as those from transcriptome analysis (read GenFam paper for more details)
id_filespeciesid_type1: Phytozome locus ID
2: Phytozome transcript ID
3: Phytozome PAC ID
stat_sign_test1: Fisher exact test
2: Hypergeometric distribution
3: Binomial distribution
4: Chi-squared distribution
multi_test_corr1: Bonferroni
2: Bonferroni-Holm
3: Benjamini-Hochberg
min_map_idsid_file) must be mapped to the background database for performing GenFam analysis [default=5]alphaReturns:
genfam_enrich.png: GenFam figure for enriched gene families
fam_enrich_out.txt: List of enriched gene families with mapped gene IDs, GO annotation, and detailed statistics
fam_all_out.txt: List of all gene families with mapped gene IDs, GO annotation, and detailed statistics
Description and working example
Check allowed ID types for plant species for GenFam
latest update v1.0.0
bioinfokit.analys.genfam.check_allowed_ids(species)speciesReturns:
Allowed ID types for GenFam
Description and working example
Biostatistical analysis
Correlation matrix plot
latest update v2.0.1
bioinfokit.visuz.stat.corr_mat(table, corm, cmap, r, dim, show, figtype, axtickfontsize, axtickfontname, theme)tablecormcmaprshow= Truedimshowfigtypeaxtickfontsizeaxtickfontnamethemedark, the dark background will be produced instead of white [string][default:’None’]Returns:
Correlation matrix plot image in same directory (corr_mat.png)
Working example
Bar-dot plot
latest update v0.8.5bioinfokit.visuz.stat.bardot(df, colorbar, colordot, bw, dim, r, ar, hbsize, errorbar, dotsize, markerdot, valphabar, valphadot, show, figtype, axxlabel, axylabel, axlabelfontsize, axlabelfontname, ylm, axtickfontsize, axtickfontname, yerrlw, yerrcw)dfcolorbarcolordotbwdimrarhbsizeerrorbardotsizemarkerdotvalphabarvalphadotfigtypeshowaxxlabelaxylabelaxlabelfontsizeaxlabelfontnameylmaxtickfontsizeaxtickfontnameyerrlwyerrcwReturns:
Bar-dot plot image in same directory (bardot.png)
Working Example
One sample and two sample Z-tests
latest update v2.1.0bioinfokit.analys.stat.ztest(df, x, y, mu, x_std, y_std, alpha, test_type)dfOne sample: It should have atleast one variable
Two sample independent: It should have atleast two variables
xymux_stdy_stdalphatest_type1: One sample Z-test
2: Two sample Z-test
Returns:
Summary output as class attribute (summary and result)
Description and Working example
One sample and two sample (independent and paired) t-tests
latest update v2.1.0bioinfokit.analys.stat.ttest(df, xfac, res, evar, alpha, test_type, mu)dfOne sample: It should have atleast dependent (res) variable
Two sample independent: It should have independent (xfac) and dependent (res) variables
Two sample paired: It should have two dependent (res) variables
xfacresevaralphatest_type1: One sample t-test
2: Two sample independent t-test
3: Two sample paired t-test
muReturns:
Summary output as class attribute (summary and result)
Description and Working example
Chi-square test
latest update v0.9.5bioinfokit.analys.stat.chisq(df, p)dfpReturns:
Summary and expected counts as class attributes (summary and expected_df)
Working example
Linear regression analysis
bioinfokit.visuz.stat.lin_reg(df, x, y)dfxyReturns:
Regression analysis summary
Working Example
Regression plot
latest update v2.0.1
bioinfokit.visuz.stat.regplot(df, x, y, yhat, dim, colordot, colorline, r, ar, dotsize, markerdot, linewidth, valphaline, valphadot, show, figtype, axxlabel, axylabel, axlabelfontsize, axlabelfontname, xlm, ylm, axtickfontsize, axtickfontname, theme)dfxyyhatdimrardotsizemarkerdotvalphalinevalphadotlinewidthfigtypeshowaxxlabelaxylabelaxlabelfontsizeaxlabelfontnamexlmylmaxtickfontsizeaxtickfontnamethemedark, the dark background will be produced instead of white [string][default:’None’]Returns:
Regression plot image in same directory (reg_plot.png)
Working Example
Tukey HSD test
latest update v1.0.3bioinfokit.analys.stat.tukey_hsd(df, res_var, xfac_var, anova_model, phalpha, ss_typ)It performs multiple pairwise comparisons of treatment groups using Tukey’s HSD (Honestly Significant Difference) test to check if group means are significantly different from each other. It uses the Tukey-Kramer approach if the sample sizes are unequal among the groups.
dfres_var,xfac_varandanova_modeloptions. It should not have missing data. The missing data will be omitted.res_varxfac_varanova_modelolsfunction) [string][default: None]phalphass_typReturns:
tukey_summaryDescription and Working example
Bartlett’s test
latest update v1.0.3bioinfokit.analys.stat.bartlett(df, xfac_var, res_var)It performs Bartlett’s test to check the homogeneity of variances among the treatment groups. It accepts the input table in a stacked format. More details https://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.stats.bartlett.html
dfres_var) and independent variables (xfac_var) in a stacked format. It should not have missing data. The missing data will be omitted.res_varNone]xfac_varNone]Returns:
bartlett_summaryDescription and Working example
Levene’s test
latest update v1.0.3bioinfokit.analys.stat.levene(df, xfac_var, res_var)It performs Levene’s test to check the homogeneity of variances among the treatment groups. It accepts the input table in a stacked format. More details https://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.stats.levene.html
dfres_var) and independent variables (xfac_var) in a stacked format. It should not have missing data. The missing data will be omitted.res_varNone]xfac_varNone]centermedian,mean,trimmed)] [default:median]median: Brown-Forsythe Levene-type test
mean: original Levene’s test
trimmed: Brown-Forsythe Levene-type test
Returns:
levene_summaryDescription and Working example
ROC plot
latest update v2.0.1bioinfokit.visuz.stat.roc(fpr, tpr, c_line_style, c_line_color, c_line_width, diag_line, diag_line_style, diag_line_width, diag_line_color, auc, shade_auc, shade_auc_color, axxlabel, axylabel, axtickfontsize, axtickfontname, axlabelfontsize, axlabelfontname, plotlegend, legendpos, legendanchor, legendcols, legendfontsize, legendlabelframe, legend_columnspacing, dim, show, figtype, figname, r, ylm, theme)Receiver operating characteristic (ROC) curve for visualizing classification performance
fprsklearn.metrics.roc_curve[list][default:None]tprsklearn.metrics.roc_curve[list][default:None]c_line_stylec_line_colorc_line_widthdiag_linediag_line_stylediag_line_widthdiag_line_coloraucsklearn.metrics.roc_auc_score[float][default: None]shade_aucshade_auc_coloraxxlabelaxylabelaxtickfontsizeaxtickfontnameaxlabelfontsizeaxlabelfontnameplotlegendlegendposlegendanchorlegendcolslegendfontsizelegendlabelframelegend_columnspacingdimshowfigtypefignamershow= Trueylmthemedark, the dark background will be produced instead of white [string][default:’None’]Returns:
ROC plot image in same directory (roc.png) Working example
Regression metrics
Calculate Root Mean Square Error (RMSE), Mean squared error (MSE), Mean absolute error (MAE), and Mean absolute percent error (MAPE) from regression fit
latest update v1.0.8bioinfokit.analys.stat.reg_metric(y, yhat, resid)yyhatresidReturns:
Pandas dataframe with values for RMSE, MSE, MAE, and MAPE
Working example
Venn Diagram
bioinfokit.visuz.venn(vennset, venncolor, vennalpha, vennlabel)vennsetvenncolorvennalphavennlabelReturns:
Venn plot (venn3.png, venn2.png)
Working example
References:
Last updated: November 20, 2021