Skip to content

Commit

Permalink
Update headers
Browse files Browse the repository at this point in the history
  • Loading branch information
FanwangM committed Nov 13, 2021
1 parent aea8f36 commit d77d3a6
Show file tree
Hide file tree
Showing 8 changed files with 112 additions and 42 deletions.
4 changes: 2 additions & 2 deletions b3clf/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# The B3clf library provides a set of functions for transforming
# a matrix to make it as similar as possible to a target matrix.
# The B3clf library computes the blood-brain barrier (BBB) permeability
# of organic molecules with resampling strategies.
#
# Copyright (C) 2021 The Ayers Lab
#
Expand Down
12 changes: 6 additions & 6 deletions b3clf/__main__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# The B3clf library provides a set of functions for transforming
# a matrix to make it as similar as possible to a target matrix.
# The B3clf library computes the blood-brain barrier (BBB) permeability
# of organic molecules with resampling strategies.
#
# Copyright (C) 2021 The Ayers Lab
#
Expand Down Expand Up @@ -61,11 +61,11 @@ def main():
args = parser.parse_args()

# Input variables
_ = b3clf(descriptors_path=args.mol,
_ = b3clf(mol_in=args.mol,
sep=args.sep,
clf_str=args.clf,
sampling_str=args.sampling,
xlsx_output=args.output,
classification=args.clf,
sampling=args.sampling,
output=args.output,
)


Expand Down
58 changes: 30 additions & 28 deletions b3clf/b3clf.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
# -*- coding: utf-8 -*-
# The B3clf library computes the blood-brain barrier (BBB) permeability
# of organic molecules with resampling strategies.
#
# Copyright (C) 2021 The Ayers Lab
#
# This file is part of B3clf.
#
# B3clf is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# B3clf is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>
#
# --

"""
Main B3clf Script.
Expand All @@ -17,69 +40,48 @@
]


def b3clf(descriptors_path,
def b3clf(mol_in,
sep,
clf_str,
sampling_str,
xlsx_output,
classification,
sampling,
output,
):
"""Use B3clf for BBB classifications."""

features_out = "internal_padel_descriptors.xlsx"
internal_sdf = "internal.sdf"

# ===================
# Pipeline
# ===================

# ===================
# Geometry optimization
# ===================
# Input:
# * Either an SDF file with molecular geometries or a text file with SMILES strings

geometry_optimize(input_fname=descriptors_path, output_sdf=internal_sdf, sep=sep)
geometry_optimize(input_fname=mol_in, output_sdf=internal_sdf, sep=sep)

# ===================
# Compute descriptors with PaDel
# ===================
# Internal file name passed should be relative to this directory I think
_ = compute_descriptors(sdf_file=internal_sdf, excel_out=features_out)

# ===================
# Get computed descriptors
# ===================
X_features, info_df = get_descriptors(df=features_out)
# X_features, info_df = get_descriptors(internal_df)

# ===================
# Select descriptors
# ===================
X_features = select_descriptors(df=X_features)

# ===================
# Scale descriptors
# ===================
X_features = scale_descriptors(df=X_features)

# ===================
# Get classifier
# ===================

clf = get_clf(clf_str=clf_str, sampling_str=sampling_str)
clf = get_clf(clf_str=classification, sampling_str=sampling)

# ===================
# Get classifier
# ===================
result_df = predict_permeability(clf=clf, features_df=X_features, info_df=info_df)

# ===================
# Get classifier
# ===================
display_cols = ["ID", "SMILES", "B3clf_predicted_probability", "B3clf_predicted_label"]

display_df = result_df[[col for col in result_df.columns.to_list() if col in display_cols]]
# print(display_df)

display_df.to_excel(xlsx_output, index=None)
display_df.to_excel(output, index=None)
return display_df
23 changes: 23 additions & 0 deletions b3clf/descriptor_padel.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
# -*- coding: utf-8 -*-
# The B3clf library computes the blood-brain barrier (BBB) permeability
# of organic molecules with resampling strategies.
#
# Copyright (C) 2021 The Ayers Lab
#
# This file is part of B3clf.
#
# B3clf is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# B3clf is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>
#
# --

import pandas as pd
from padelpy import from_sdf
from rdkit import Chem
Expand Down
24 changes: 22 additions & 2 deletions b3clf/geometry_opt.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
# import os
# import subprocess
# -*- coding: utf-8 -*-
# The B3clf library computes the blood-brain barrier (BBB) permeability
# of organic molecules with resampling strategies.
#
# Copyright (C) 2021 The Ayers Lab
#
# This file is part of B3clf.
#
# B3clf is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# B3clf is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>
#
# --

import pandas as pd
from rdkit import Chem
Expand Down
23 changes: 23 additions & 0 deletions b3clf/utils.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
# -*- coding: utf-8 -*-
# The B3clf library computes the blood-brain barrier (BBB) permeability
# of organic molecules with resampling strategies.
#
# Copyright (C) 2021 The Ayers Lab
#
# This file is part of B3clf.
#
# B3clf is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# B3clf is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>
#
# --

"""
B3clf utility functions
Expand Down
5 changes: 3 additions & 2 deletions b3clf/version.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# The B3clf library provides a set of functions for transforming
# a matrix to make it as similar as possible to a target matrix.
# The B3clf library computes the blood-brain barrier (BBB) permeability
# of organic molecules with resampling strategies.
#
# Copyright (C) 2021 The Ayers Lab
#
Expand All @@ -20,6 +20,7 @@
# along with this program; if not, see <http://www.gnu.org/licenses/>
#
# --

"""Version Information for B3clf."""

VERSION = (0, 0, 1, "beta")
Expand Down
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# The B3clf library provides a set of functions for transforming
# a matrix to make it as similar as possible to a target matrix.
# The B3clf library computes the blood-brain barrier (BBB) permeability
# of organic molecules with resampling strategies.
#
# Copyright (C) 2021 The Ayers Lab
#
Expand All @@ -20,6 +20,7 @@
# along with this program; if not, see <http://www.gnu.org/licenses/>
#
# --

"""Installation script for B3clf.
Directly calling this script is only needed by B3clf developers in special
Expand Down

0 comments on commit d77d3a6

Please sign in to comment.