Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
iPRESTO
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
Container registry
Model registry
Operate
Environments
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
bioinformatics
iPRESTO
Commits
5a542df5
Commit
5a542df5
authored
3 years ago
by
Louwen, Joris
Browse files
Options
Downloads
Patches
Plain Diff
Unify remove_infr_doms functions
parent
6cdcecdf
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!1
iPRESTO refactor
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
ipresto.py
+5
-1
5 additions, 1 deletion
ipresto.py
ipresto/presto_stat/presto_stat.py
+1
-1
1 addition, 1 deletion
ipresto/presto_stat/presto_stat.py
ipresto/presto_top/presto_top.py
+4
-4
4 additions, 4 deletions
ipresto/presto_top/presto_top.py
with
10 additions
and
6 deletions
ipresto.py
+
5
−
1
View file @
5a542df5
...
@@ -18,6 +18,10 @@ from sys import argv
...
@@ -18,6 +18,10 @@ from sys import argv
import
logging
import
logging
from
typing
import
Union
,
List
from
typing
import
Union
,
List
import
time
import
time
import
os
# to account for a weird bug with ldamulticore and numpy:
# https://github.com/RaRe-Technologies/gensim/issues/1988
os
.
environ
[
'
OMP_NUM_THREADS
'
]
=
'
1
'
def
get_commands
():
def
get_commands
():
...
@@ -428,7 +432,7 @@ if __name__ == "__main__":
...
@@ -428,7 +432,7 @@ if __name__ == "__main__":
bgc_classes_dict
=
{
bgc
:
'
None
'
for
bgc
in
bgcs
}
bgc_classes_dict
=
{
bgc
:
'
None
'
for
bgc
in
bgcs
}
if
not
cmd
.
top_motifs_model
:
if
not
cmd
.
top_motifs_model
:
bgcs
=
remove_infr_doms_str
(
bgcs
,
cmd
.
min_genes
,
Fal
se
,
bgcs
=
remove_infr_doms_str
(
bgcs
,
cmd
.
min_genes
,
cmd
.
verbo
se
,
cmd
.
remove_genes_below_count
)
cmd
.
remove_genes_below_count
)
if
cmd
.
amplify
:
if
cmd
.
amplify
:
...
...
This diff is collapsed.
Click to expand it.
ipresto/presto_stat/presto_stat.py
+
1
−
1
View file @
5a542df5
...
@@ -707,7 +707,7 @@ def remove_infr_doms(clusdict, m_gens, verbose, cutoff=3):
...
@@ -707,7 +707,7 @@ def remove_infr_doms(clusdict, m_gens, verbose, cutoff=3):
clusdict: dict of {cluster:[(domains_of_a_gene)]}
clusdict: dict of {cluster:[(domains_of_a_gene)]}
m_gens: int, minimal distinct genes a cluster must have to be included
m_gens: int, minimal distinct genes a cluster must have to be included
verbose: bool, if True print additional info
verbose: bool, if True print additional info
cutoff: int, remove genes (domain cominations) that occur
below
th
is
cutoff
cutoff: int, remove genes (domain com
b
inations) that occur
less
th
en
cutoff
"""
"""
print
(
f
'
\n
Removing domain combinations that occur less than
{
cutoff
}
'
print
(
f
'
\n
Removing domain combinations that occur less than
{
cutoff
}
'
'
times
'
)
'
times
'
)
...
...
This diff is collapsed.
Click to expand it.
ipresto/presto_top/presto_top.py
+
4
−
4
View file @
5a542df5
...
@@ -51,7 +51,7 @@ def remove_infr_doms_str(clusdict, m_gens, verbose, cutoff=3):
...
@@ -51,7 +51,7 @@ def remove_infr_doms_str(clusdict, m_gens, verbose, cutoff=3):
domcounter
=
Counter
()
domcounter
=
Counter
()
domcounter
.
update
([
v
for
vals
in
clusdict
.
values
()
for
v
in
vals
domcounter
.
update
([
v
for
vals
in
clusdict
.
values
()
for
v
in
vals
if
not
v
==
'
-
'
])
if
not
v
==
'
-
'
])
deldoms
=
{
key
for
key
in
domcounter
if
domcounter
[
key
]
<
=
cutoff
}
deldoms
=
{
key
for
key
in
domcounter
if
domcounter
[
key
]
<
cutoff
}
print
(
'
{} domain combinations are left, {} are removed
'
.
format
(
print
(
'
{} domain combinations are left, {} are removed
'
.
format
(
len
(
domcounter
.
keys
())
-
len
(
deldoms
),
len
(
deldoms
)))
len
(
domcounter
.
keys
())
-
len
(
deldoms
),
len
(
deldoms
)))
clus_no_deldoms
=
{}
clus_no_deldoms
=
{}
...
@@ -126,11 +126,11 @@ def run_lda(domlist, no_below, no_above, num_topics, cores, outfolder,
...
@@ -126,11 +126,11 @@ def run_lda(domlist, no_below, no_above, num_topics, cores, outfolder,
# coherence = cm.get_coherence()
# coherence = cm.get_coherence()
# print('Coherence: {}, num_topics: {}'.format(coherence, num_topics))
# print('Coherence: {}, num_topics: {}'.format(coherence, num_topics))
if
ldavis
:
if
ldavis
:
visname
=
os
.
path
.
join
(
outfolder
,
'
lda.html
'
)
visname
=
os
.
path
.
join
(
outfolder
,
'
lda
_method-tsne
.html
'
)
print
(
'
Running pyLDAvis for visualisation
'
)
print
(
'
Running pyLDAvis for visualisation
'
)
vis
=
pyLDAvis
.
gensim
.
prepare
(
vis
=
pyLDAvis
.
gensim
.
prepare
(
lda
,
corpus_bow
,
dict_lda
,
sort_topics
=
False
)
lda
,
corpus_bow
,
dict_lda
,
sort_topics
=
False
,
mds
=
'
tsne
'
)
print
(
'
saving visualisation to html
'
)
print
(
'
saving visualisation
with t-sne
to html
'
)
pyLDAvis
.
save_html
(
vis
,
visname
)
pyLDAvis
.
save_html
(
vis
,
visname
)
return
lda
,
dict_lda
,
corpus_bow
return
lda
,
dict_lda
,
corpus_bow
...
...
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