Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
psot.repository
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SOaAS
psot.repository
Commits
349eb1e7
Commit
349eb1e7
authored
8 years ago
by
Lukas Jelonek
Browse files
Options
Downloads
Patches
Plain Diff
Added config module and used it in the module scripts
parent
8a98d304
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
bin/config.py
+61
-0
61 additions, 0 deletions
bin/config.py
bin/module_blast_swissprot.py
+7
-19
7 additions, 19 deletions
bin/module_blast_swissprot.py
bin/module_signalp.py
+3
-19
3 additions, 19 deletions
bin/module_signalp.py
with
71 additions
and
38 deletions
bin/config.py
0 → 100644
+
61
−
0
View file @
349eb1e7
import
os
import
yaml
def
get_install_location
():
"""
Finds the location directory of the tool
"""
script_path
=
os
.
path
.
realpath
(
__file__
)
script_dir
=
os
.
path
.
dirname
(
script_path
)
install_dir
=
os
.
path
.
dirname
(
script_dir
)
return
install_dir
def
get_script_location
():
return
os
.
path
.
join
(
get_install_location
(),
'
bin
'
)
def
get_template_location
():
return
os
.
path
.
join
(
get_install_location
(),
'
templates
'
)
def
get_modules_location
():
return
os
.
path
.
join
(
get_install_location
(),
'
modules
'
)
def
get_profiles_location
():
return
os
.
path
.
join
(
get_install_location
(),
'
profiles
'
)
def
get_config_file
():
return
os
.
path
.
join
(
get_install_location
(),
'
config.yaml
'
)
def
load_config_file
():
config
=
{}
with
(
open
(
get_config_file
()))
as
f
:
config
=
yaml
.
load
(
f
)
return
config
def
get_module_manifests
():
mypath
=
get_modules_location
()
return
[
os
.
path
.
join
(
mypath
,
f
)
for
f
in
os
.
listdir
(
mypath
)
if
os
.
path
.
isfile
(
os
.
path
.
join
(
mypath
,
f
))]
def
load_modules
():
modules
=
[]
for
manifest
in
get_module_manifests
():
with
(
open
(
manifest
))
as
f
:
modules
.
append
(
yaml
.
load
(
f
))
return
modules
def
load_config
():
config
=
load_config_file
()
config
[
'
modules
'
]
=
load_modules
()
return
config
if
__name__
==
"
__main__
"
:
"""
prints the configuration
"""
import
config
from
pprint
import
pformat
print
(
'
Install location:
'
+
config
.
get_install_location
())
print
(
'
Script lcoation:
'
+
config
.
get_script_location
())
print
(
'
Config location:
'
+
config
.
get_config_file
())
print
(
'
Available module manifests:
\n\t
'
+
'
\n\t
'
.
join
(
config
.
get_module_manifests
())
+
'
\n
'
)
print
(
'
Config content:
\n
'
+
pformat
(
config
.
load_config_file
())
+
'
\n
'
)
print
(
'
Manifest content:
\n
'
+
pformat
(
config
.
load_modules
())
+
'
\n
'
)
print
(
'
Aggregated config:
\n
'
+
pformat
(
config
.
load_config
())
+
'
\n
'
)
This diff is collapsed.
Click to expand it.
bin/module_blast_swissprot.py
+
7
−
19
View file @
349eb1e7
#!/usr/bin/env python3
import
argparse
import
yaml
import
os
import
config
from
os
import
system
def
get_config_file
():
"""
Finds the config file, that is located in the directory above script
"""
script_path
=
os
.
path
.
realpath
(
__file__
)
script_dir
=
os
.
path
.
dirname
(
script_path
)
config_dir
=
os
.
path
.
dirname
(
script_dir
)
config_file
=
os
.
path
.
join
(
config_dir
,
'
config.yaml
'
)
return
config_file
def
get_blastp_tool
():
"""
Extracts the configuration entry for blastp. If it is not present, it defaults to blastp
"""
tool
=
None
with
open
(
get_config_file
())
as
f
:
config
=
yaml
.
load
(
f
)
tool
=
config
[
'
tools
'
].
get
(
'
blastp
'
,
'
blastp
'
)
return
tool
blastp_tool
=
config
.
load_config
()[
'
tools
'
].
get
(
'
blastp
'
,
'
blastp
'
)
parser
=
argparse
.
ArgumentParser
(
description
=
'
Identify homologues in the swissprot database
'
)
parser
.
add_argument
(
'
--info
'
,
'
-i
'
,
action
=
'
store_true
'
)
parser
.
add_argument
(
'
--fasta
'
,
'
-f
'
,
required
=
True
,
help
=
'
A fasta file with aminoacid sequences
'
)
parser
.
add_argument
(
'
--evalue
'
,
'
-e
'
,
default
=
'
0.0001
'
,
help
=
'
Evalue cutoff
'
)
parser
.
add_argument
(
'
--alignment
'
,
'
-a
'
,
action
=
'
store_true
'
,
help
=
'
Include alignments in btop format
'
)
args
=
parser
.
parse_args
()
if
args
.
info
:
print
(
"
blast against swissprot
\n
"
)
exit
(
0
)
format
=
'
7 qseqid sseqid pident qstart qend sstart send evalue bitscore
'
if
args
.
alignment
:
format
+=
'
btop
'
system
(
get_
blastp_tool
()
+
"
-db /vol/biodb/uniprot/uniprot_sprot.fasta -num_threads 7 -outfmt
'"
+
format
+
"'
-out - -query
"
+
args
.
fasta
)
system
(
blastp_tool
+
"
-db /vol/biodb/uniprot/uniprot_sprot.fasta -num_threads 7 -outfmt
'"
+
format
+
"'
-out - -query
"
+
args
.
fasta
)
This diff is collapsed.
Click to expand it.
bin/module_signalp.py
+
3
−
19
View file @
349eb1e7
#!/usr/bin/env python3
import
argparse
import
yaml
import
os
import
config
from
os
import
system
def
get_config_file
():
"""
Finds the config file, that is located in the directory above script
"""
script_path
=
os
.
path
.
realpath
(
__file__
)
script_dir
=
os
.
path
.
dirname
(
script_path
)
config_dir
=
os
.
path
.
dirname
(
script_dir
)
config_file
=
os
.
path
.
join
(
config_dir
,
'
config.yaml
'
)
return
config_file
def
get_signalp_tool
():
"""
Extracts the configuration entry for signalp. If it is not present, it defaults to signalp
"""
tool
=
None
with
open
(
get_config_file
())
as
f
:
config
=
yaml
.
load
(
f
)
tool
=
config
[
'
tools
'
].
get
(
'
signalp
'
,
'
signalp
'
)
return
tool
signalp_tool
=
config
.
load_config
()[
'
tools
'
].
get
(
'
signalp
'
,
'
signalp
'
)
parser
=
argparse
.
ArgumentParser
(
description
=
'
Find signal peptides in amino acid sequences
'
)
parser
.
add_argument
(
'
--fasta
'
,
'
-f
'
,
required
=
True
,
help
=
'
A fasta file with aminoacid sequences
'
)
parser
.
add_argument
(
'
--organism
'
,
'
-o
'
,
choices
=
[
'
euk
'
,
'
gram+
'
,
'
gram-
'
],
default
=
'
euk
'
,
help
=
'
The organism type
'
)
args
=
parser
.
parse_args
()
system
(
get_
signalp_tool
()
+
"
-t
"
+
args
.
organism
+
"
"
+
args
.
fasta
)
system
(
signalp_tool
+
"
-t
"
+
args
.
organism
+
"
"
+
args
.
fasta
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment