Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create temp directory into output directory and download there #73

Merged
merged 5 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions fusion_report.log.2023-11-27
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
2023-11-27 10:01:30,030 - CRITICAL - fusion_report.common.net - table "mbca" already exists
peterpru marked this conversation as resolved.
Show resolved Hide resolved
Traceback (most recent call last):
File "/Users/annick.renevey/anaconda3/envs/fusion-report/lib/python3.9/site-packages/fusion_report-2.1.5-py3.9.egg/fusion_report/common/db.py", line 61, in setup
self.create_database()
File "/Users/annick.renevey/anaconda3/envs/fusion-report/lib/python3.9/site-packages/fusion_report-2.1.5-py3.9.egg/fusion_report/common/db.py", line 84, in create_database
self.connection.executescript(schema.read().lower())
sqlite3.OperationalError: table "mbca" already exists

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/annick.renevey/anaconda3/envs/fusion-report/lib/python3.9/site-packages/fusion_report-2.1.5-py3.9.egg/fusion_report/app.py", line 72, in run
Download(params)
File "/Users/annick.renevey/anaconda3/envs/fusion-report/lib/python3.9/site-packages/fusion_report-2.1.5-py3.9.egg/fusion_report/download.py", line 23, in __init__
self.download_all(params)
File "/Users/annick.renevey/anaconda3/envs/fusion-report/lib/python3.9/site-packages/fusion_report-2.1.5-py3.9.egg/fusion_report/download.py", line 42, in download_all
Net.get_mitelman(self, return_err)
File "/Users/annick.renevey/anaconda3/envs/fusion-report/lib/python3.9/site-packages/fusion_report-2.1.5-py3.9.egg/fusion_report/common/net.py", line 204, in get_mitelman
db.setup(files, delimiter="\t", skip_header=False, encoding="ISO-8859-1")
File "/Users/annick.renevey/anaconda3/envs/fusion-report/lib/python3.9/site-packages/fusion_report-2.1.5-py3.9.egg/fusion_report/common/db.py", line 79, in setup
raise DbException(ex)
fusion_report.common.exceptions.db.DbException: table "mbca" already exists

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/annick.renevey/Projects/fusion-report/./bin/fusion_report", line 13, in <module>
app.run()
File "/Users/annick.renevey/anaconda3/envs/fusion-report/lib/python3.9/site-packages/fusion_report-2.1.5-py3.9.egg/fusion_report/app.py", line 79, in run
raise AppException(ex)
fusion_report.common.exceptions.app.AppException: table "mbca" already exists
11 changes: 5 additions & 6 deletions fusion_report/common/net.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,12 +206,11 @@ def get_mitelman(self, return_err: List[str]) -> None:

@staticmethod
def clean():
"""Remove all files except *db."""
for temp in glob.glob("*/"):
shutil.rmtree(temp)
for temp in glob.glob("*[!.db]"):
if not os.path.isdir(temp):
os.remove(temp)
"""Remove all files except *db and move to output dir."""
for temp in glob.glob("*.db"):
shutil.copy(temp, "../")
os.chdir("../")
shutil.rmtree("tmp_dir")

@staticmethod
def timestamp():
Expand Down
5 changes: 4 additions & 1 deletion fusion_report/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ def validate(self, params: Namespace) -> None:
def download_all(self, params: Namespace) -> None:
"""Download all databases."""
return_err: List[str] = []
os.chdir(params.output)
tmp_dir = os.path.join(params.output, "tmp_dir")
if not os.path.exists(tmp_dir):
os.mkdir(tmp_dir)
os.chdir(tmp_dir)

# MITELMAN
Net.get_mitelman(self, return_err)
Expand Down
2 changes: 0 additions & 2 deletions fusion_report/modules/index_summary/index_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,8 @@ def tool_detection(self) -> List[List[Any]]:
counts["together"] = 0
running_tools_count: int = len(running_tools)
for fusion in self.manager.fusions:
print(fusion.name)
fusion_tools = fusion.tools.keys()
for tool in fusion_tools:
print(tool)
counts[tool] += 1
# intersection
if len(fusion_tools) == running_tools_count:
Expand Down
Loading