Skip to content

Commit fd6ffc1

Browse files
committed
First commit of Flexutils-Scripts
0 parents  commit fd6ffc1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+7030
-0
lines changed

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Python compilation files
2+
*.pyc
3+
4+
# Ignore temporary packaging folder
5+
*.egg-info
6+
toolkit/*.egg-info
7+
8+
# IDE files
9+
.idea

CHANGES.txt

Whitespace-only changes.

LICENSE

Lines changed: 674 additions & 0 deletions
Large diffs are not rendered by default.

MANIFEST.in

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
include LICENSE
2+
include requirement/*.yml
3+
include icon_square.png
4+
include scripts/*.py
5+
include socket/*.py
6+
include viewers/*.py
7+
include *.sh
8+
include *.rst
9+
include *.txt
10+
include *.py

README.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
=======================
2+
Flexutils Scripts
3+
=======================
4+
5+
This package provides a the environment and scripts needed by `scipion-em-flexutils <https://github.com/scipion-em/scipion-em-flexutils>`_ plugin

flexutils_scripts/__init__.py

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# **************************************************************************
2+
# *
3+
# * Authors: David Herreros Calero ([email protected])
4+
# *
5+
# * Unidad de Bioinformatica of Centro Nacional de Biotecnologia , CSIC
6+
# *
7+
# * This program is free software; you can redistribute it and/or modify
8+
# * it under the terms of the GNU General Public License as published by
9+
# * the Free Software Foundation; either version 2 of the License, or
10+
# * (at your option) any later version.
11+
# *
12+
# * This program is distributed in the hope that it will be useful,
13+
# * but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
# * GNU General Public License for more details.
16+
# *
17+
# * You should have received a copy of the GNU General Public License
18+
# * along with this program; if not, write to the Free Software
19+
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
20+
# * 02111-1307 USA
21+
# *
22+
# * All comments concerning this program package may be sent to the
23+
# * e-mail address '[email protected]'
24+
# *
25+
# **************************************************************************
26+
27+
28+
import os
29+
import sys
30+
import subprocess
31+
32+
33+
__version__ = "1.0.0"
34+
35+
36+
def getImagePath(image_name):
37+
"""Returns the absolute path to an image within the package."""
38+
module_dir = os.path.dirname(__file__) # Get the directory of this module
39+
image_path = os.path.join(module_dir, 'media', image_name)
40+
return image_path
41+
42+
def getCondaBase():
43+
try:
44+
conda_base = subprocess.check_output("conda info --base", shell=True, text=True).strip()
45+
return conda_base
46+
except subprocess.CalledProcessError as e:
47+
print(f"Error finding Conda base: {e}")
48+
return None
49+
50+
def getCondaSourceFile():
51+
conda_source_file = f"{getCondaBase()}/etc/profile.d/conda.sh"
52+
return conda_source_file
53+
54+
def getProgram(program, env_name=None):
55+
env_name = env_name if env_name is not None else f"flexutils-{__version__}"
56+
return f"source {getCondaSourceFile()} && conda activate {env_name} && python {program}"
57+
58+
def runProgram(program, args, env=None, cwd=None):
59+
command = program + " " + args
60+
subprocess.check_call(command, shell=True, stdout=sys.stdout, stderr=sys.stderr,
61+
env=env, cwd=cwd)
34.6 KB
Loading
2.23 KB
Loading

flexutils_scripts/scripts/__init__.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# **************************************************************************
2+
# *
3+
# * Authors: David Herreros Calero ([email protected])
4+
# *
5+
# * Unidad de Bioinformatica of Centro Nacional de Biotecnologia , CSIC
6+
# *
7+
# * This program is free software; you can redistribute it and/or modify
8+
# * it under the terms of the GNU General Public License as published by
9+
# * the Free Software Foundation; either version 2 of the License, or
10+
# * (at your option) any later version.
11+
# *
12+
# * This program is distributed in the hope that it will be useful,
13+
# * but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
# * GNU General Public License for more details.
16+
# *
17+
# * You should have received a copy of the GNU General Public License
18+
# * along with this program; if not, write to the Free Software
19+
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
20+
# * 02111-1307 USA
21+
# *
22+
# * All comments concerning this program package may be sent to the
23+
# * e-mail address '[email protected]'
24+
# *
25+
# **************************************************************************
26+
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# **************************************************************************
2+
# *
3+
# * Authors: David Herreros Calero ([email protected])
4+
# *
5+
# * Unidad de Bioinformatica of Centro Nacional de Biotecnologia , CSIC
6+
# *
7+
# * This program is free software; you can redistribute it and/or modify
8+
# * it under the terms of the GNU General Public License as published by
9+
# * the Free Software Foundation; either version 2 of the License, or
10+
# * (at your option) any later version.
11+
# *
12+
# * This program is distributed in the hope that it will be useful,
13+
# * but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
# * GNU General Public License for more details.
16+
# *
17+
# * You should have received a copy of the GNU General Public License
18+
# * along with this program; if not, write to the Free Software
19+
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
20+
# * 02111-1307 USA
21+
# *
22+
# * All comments concerning this program package may be sent to the
23+
# * e-mail address '[email protected]'
24+
# *
25+
# **************************************************************************
26+
27+
28+
from flexutils_scripts import utils as utl
29+
30+
31+
def alignMaps(file_input, file_target, file_output, global_search=None):
32+
# Align maps in ChimeraX using fitmap
33+
_ = utl.alignMapsChimeraX(file_input, file_target, global_search=global_search,
34+
output_map=file_output)
35+
36+
37+
if __name__ == '__main__':
38+
import argparse
39+
40+
# Input parameters
41+
parser = argparse.ArgumentParser()
42+
parser.add_argument('--i', type=str, required=True)
43+
parser.add_argument('--r', type=str, required=True)
44+
parser.add_argument('--o', type=str, required=True)
45+
parser.add_argument('--gs', type=int)
46+
47+
args = parser.parse_args()
48+
49+
if args.gs is None:
50+
gs = None
51+
else:
52+
gs = args.gs
53+
54+
# Initialize volume slicer
55+
alignMaps(args.i, args.r, args.o, gs)

0 commit comments

Comments
 (0)