Skip to content

Commit

Permalink
refactored project and added task_info/ dir
Browse files Browse the repository at this point in the history
  • Loading branch information
xavierbemo committed Nov 19, 2024
1 parent 228db1c commit a5ce49c
Show file tree
Hide file tree
Showing 22 changed files with 34 additions and 33 deletions.
11 changes: 5 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
mteapy/notebooks/
notebooks/

.pytest_cache
mteapy/__pycache__
mteapy/cmds/__pycache__
mteapy/tests/__pycache__
mteapy/mteapy.egg-info/
mteapy.egg-info/
tests/__pycache__
src/mteapy/__pycache__
src/mteapy/cmds/__pycache__
src/mteapy.egg-info/
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions src/data/task_metadata.tsv
1 change: 1 addition & 0 deletions src/data/task_metadata_sec.tsv
File renamed without changes.
File renamed without changes.
File renamed without changes.
50 changes: 25 additions & 25 deletions mteapy/cmds/run_mtea.py → src/mteapy/cmds/run_mtea.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
def main() -> None:

curdir = os.path.dirname(os.path.realpath(__file__))
with open(os.path.join(curdir, "../../logo_ascii.txt"), "r") as f:
with open(os.path.join(curdir, "../logo_ascii.txt"), "r") as f:
logo = f.read()
print(logo)

Expand All @@ -30,17 +30,17 @@ def main() -> None:
print(f"{bc.CYAN}Cite CellFie:{bc.ENDC}\thttps://doi.org/10.1016/j.crmeth.2021.100040\n")
exit(1)

if args.task_metadata:
task_metadata = pd.read_csv(os.path.join(curdir, "../data/task_metadata.tsv"), sep="\t", index_col=0)
task_metadata.to_csv("./task_metadata.tsv", sep="\t")
print("Downloaded metabolic task metadata at ./task_metadata.tsv\n")
exit(1)
# if args.task_metadata:
# task_metadata = pd.read_csv(os.path.join(curdir, "../../data/task_metadata.tsv"), sep="\t", index_col=0)
# task_metadata.to_csv("./task_metadata.tsv", sep="\t")
# print("Downloaded metabolic task metadata at ./task_metadata.tsv\n")
# exit(1)

if args.task_metadata_sec:
task_metadata_sec = pd.read_csv(os.path.join(curdir, "../data/task_metadata_sec.tsv"), sep="\t", index_col=0)
task_metadata_sec.to_csv("./task_metadata_sec.tsv", sep="\t")
print("Downloaded secretory metabolic task metadata at ./task_metadata_sec.tsv\n")
exit(1)
# if args.task_metadata_sec:
# task_metadata_sec = pd.read_csv(os.path.join(curdir, "../../data/task_metadata_sec.tsv"), sep="\t", index_col=0)
# task_metadata_sec.to_csv("./task_metadata_sec.tsv", sep="\t")
# print("Downloaded secretory metabolic task metadata at ./task_metadata_sec.tsv\n")
# exit(1)


###########################################
Expand Down Expand Up @@ -70,8 +70,8 @@ def main() -> None:

# Reading in data and gene essentiality
expr_data_df = pd.read_csv(args.dea_file, delimiter=args.sep)
task_metadata = pd.read_csv(os.path.join(curdir, "../data/task_metadata.tsv"), sep="\t")
gene_essentiality = pd.read_csv(os.path.join(curdir, "../data/HumanGEM_essential_genes_matrix.tsv"),\
task_metadata = pd.read_csv(os.path.join(curdir, "../../data/task_metadata.tsv"), sep="\t")
gene_essentiality = pd.read_csv(os.path.join(curdir, "../../data/HumanGEM_essential_genes_matrix.tsv"),\
delimiter="\t", index_col=0)

# Column names check
Expand Down Expand Up @@ -142,20 +142,20 @@ def main() -> None:
# Reading in data, model and task structure
# TODO: allow user to input their own metabolic model and task structures
expr_data_df = pd.read_csv(args.dea_file, delimiter=args.sep)
task_metadata = pd.read_csv(os.path.join(curdir, "../data/task_metadata.tsv"), sep="\t")
task_structure = pd.read_csv(os.path.join(curdir, "../data/task_structure_matrix.tsv"), \
task_metadata = pd.read_csv(os.path.join(curdir, "../../data/task_metadata.tsv"), sep="\t")
task_structure = pd.read_csv(os.path.join(curdir, "../../data/task_structure_matrix.tsv"), \
sep="\t", index_col=0)

print("Loading metabolic model", end=" ")
if args.secretory_flag:
model = read_sbml_model(os.path.join(curdir, "../data/HumanGEM_secretory.xml.gz"))
task_metadata_sec = pd.read_csv(os.path.join(curdir, "../data/task_metadata_sec.tsv"), sep="\t")
model = read_sbml_model(os.path.join(curdir, "../../data/HumanGEM_secretory.xml.gz"))
task_metadata_sec = pd.read_csv(os.path.join(curdir, "../../data/task_metadata_sec.tsv"), sep="\t")
task_metadata = pd.concat([task_metadata, task_metadata_sec])
task_structure_sec = pd.read_csv(os.path.join(curdir, "../data/task_structure_matrix_sec.tsv"), \
task_structure_sec = pd.read_csv(os.path.join(curdir, "../../data/task_structure_matrix_sec.tsv"), \
sep="\t", index_col=0)
task_structure = pd.concat([task_structure, task_structure_sec]).fillna(0)
else:
model = read_sbml_model(os.path.join(curdir, "../data/HumanGEM.xml.gz"))
model = read_sbml_model(os.path.join(curdir, "../../data/HumanGEM.xml.gz"))
print("- OK.")

# Column names check
Expand Down Expand Up @@ -225,20 +225,20 @@ def main() -> None:

# Reading in data
expr_data_df = pd.read_csv(args.expr_file, delimiter=args.sep)
# task_metadata = pd.read_csv(os.path.join(curdir, "../data/task_metadata.tsv"), sep="\t")
task_structure = pd.read_csv(os.path.join(curdir, "../data/task_structure_matrix.tsv"), \
# task_metadata = pd.read_csv(os.path.join(curdir, "../../data/task_metadata.tsv"), sep="\t")
task_structure = pd.read_csv(os.path.join(curdir, "../../data/task_structure_matrix.tsv"), \
sep="\t", index_col=0)

print("Loading metabolic model", end=" ")
if args.secretory_flag:
model = read_sbml_model(os.path.join(curdir, "../data/HumanGEM_secretory.xml.gz"))
# task_metadata_sec = pd.read_csv(os.path.join(curdir, "../data/task_metadata_sec.tsv"), sep="\t")
model = read_sbml_model(os.path.join(curdir, "../../data/HumanGEM_secretory.xml.gz"))
# task_metadata_sec = pd.read_csv(os.path.join(curdir, "../../data/task_metadata_sec.tsv"), sep="\t")
# task_metadata = pd.concat([task_metadata, task_metadata_sec])
task_structure_sec = pd.read_csv(os.path.join(curdir, "../data/task_structure_matrix_sec.tsv"), \
task_structure_sec = pd.read_csv(os.path.join(curdir, "../../data/task_structure_matrix_sec.tsv"), \
sep="\t", index_col=0)
task_structure = pd.concat([task_structure, task_structure_sec]).fillna(0)
else:
model = read_sbml_model(os.path.join(curdir, "../data/HumanGEM.xml.gz"))
model = read_sbml_model(os.path.join(curdir, "../../data/HumanGEM.xml.gz"))
print("- OK.")

# Column names check
Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions mteapy/parser.py → src/mteapy/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ def mtea_parser():

parser.add_argument("-c", "--cite", action="store_true", dest="citation_flag", help="prints information regarding citation of methods")

parser.add_argument("-t", "--task_metadata", action="store_true", dest="task_metadata", help="saves metabolic task metadata into current directory")
# parser.add_argument("-t", "--task_metadata", action="store_true", dest="task_metadata", help="saves metabolic task metadata into current directory")

parser.add_argument("-s", "--task_metadata_sec", action="store_true", dest="task_metadata_sec", help="saves secretory metabolic task metadata into current directory")
# parser.add_argument("-s", "--task_metadata_sec", action="store_true", dest="task_metadata_sec", help="saves secretory metabolic task metadata into current directory")

subparser = parser.add_subparsers(title="commands", required=False, dest="command")

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit a5ce49c

Please sign in to comment.