Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
bioinfo_utils
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Blaise LI
bioinfo_utils
Commits
5ad6fef6
Commit
5ad6fef6
authored
6 years ago
by
Blaise Li
Browse files
Options
Downloads
Patches
Plain Diff
Added (un-used) partial string formatter.
parent
4d16fcf4
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
libworkflows/libworkflows/__init__.py
+3
-1
3 additions, 1 deletion
libworkflows/libworkflows/__init__.py
libworkflows/libworkflows/libworkflows.py
+21
-0
21 additions, 0 deletions
libworkflows/libworkflows/libworkflows.py
with
24 additions
and
1 deletion
libworkflows/libworkflows/__init__.py
+
3
−
1
View file @
5ad6fef6
from
.libworkflows
import
(
from
.libworkflows
import
(
SHELL_FUNCTIONS
,
cleanup_and_backup
,
column_converter
,
ensure_relative
,
SHELL_FUNCTIONS
,
cleanup_and_backup
,
column_converter
,
ensure_relative
,
file_len
,
feature_orientation2stranded
,
filter_combinator
,
get_chrom_sizes
,
file_len
,
feature_orientation2stranded
,
filter_combinator
,
get_chrom_sizes
,
last_lines
,
make_id_list_getter
,
read_float_from_file
,
read_int_from_file
,
last_lines
,
make_id_list_getter
,
partial_format
,
read_float_from_file
,
read_int_from_file
,
read_feature_counts
,
read_htseq_counts
,
read_intersect_counts
,
read_feature_counts
,
read_htseq_counts
,
read_intersect_counts
,
save_plot
,
strip_split
,
save_plot
,
strip_split
,
sum_by_family
,
sum_feature_counts
,
sum_htseq_counts
,
sum_intersect_counts
,
sum_by_family
,
sum_feature_counts
,
sum_htseq_counts
,
sum_intersect_counts
,
...
...
This diff is collapsed.
Click to expand it.
libworkflows/libworkflows/libworkflows.py
+
21
−
0
View file @
5ad6fef6
...
@@ -110,6 +110,22 @@ def ensure_relative(path, basedir):
...
@@ -110,6 +110,22 @@ def ensure_relative(path, basedir):
return
path
return
path
# https://stackoverflow.com/a/15728287/1878788
import
string
from
_string
import
formatter_field_name_split
class
PartialFormatter
(
string
.
Formatter
):
def
get_field
(
self
,
field_name
,
args
,
kwargs
):
try
:
val
=
super
(
PartialFormatter
,
self
).
get_field
(
field_name
,
args
,
kwargs
)
except
(
IndexError
,
KeyError
,
AttributeError
):
first
,
_
=
formatter_field_name_split
(
field_name
)
val
=
'
{
'
+
field_name
+
'
}
'
,
first
return
val
partial_format
=
PartialFormatter
().
format
def
wc_applied
(
source_function
):
def
wc_applied
(
source_function
):
"""
"""
This can be used as a decorator for rule input sourcing functions.
This can be used as a decorator for rule input sourcing functions.
...
@@ -389,6 +405,11 @@ def save_plot(outfile,
...
@@ -389,6 +405,11 @@ def save_plot(outfile,
def
make_id_list_getter
(
gene_lists_dir
,
avail_id_lists
=
None
):
def
make_id_list_getter
(
gene_lists_dir
,
avail_id_lists
=
None
):
"""
*gene_lists_dir* is the directory in which gene lists are located.
*avail_id_lists* can be used to restrict the set of files to use.
If not set, all files ending in
"
_ids.txt
"
will be considered.
"""
if
avail_id_lists
is
None
:
if
avail_id_lists
is
None
:
avail_id_lists
=
set
(
glob
(
OPJ
(
gene_lists_dir
,
"
*_ids.txt
"
)))
avail_id_lists
=
set
(
glob
(
OPJ
(
gene_lists_dir
,
"
*_ids.txt
"
)))
str_attr_err
=
compile
(
"'
str
'
object has no attribute
'
.*
'"
)
str_attr_err
=
compile
(
"'
str
'
object has no attribute
'
.*
'"
)
...
...
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