Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hic
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
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
LBMC
Hub
hic
Commits
20dc4280
Verified
Commit
20dc4280
authored
1 year ago
by
Mia Croiset
Browse files
Options
Downloads
Patches
Plain Diff
simplify int check and function for channel check
parent
ed5b729c
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/WorkflowHic.groovy
+13
-5
13 additions, 5 deletions
lib/WorkflowHic.groovy
workflows/hic.nf
+9
-17
9 additions, 17 deletions
workflows/hic.nf
with
22 additions
and
22 deletions
lib/WorkflowHic.groovy
+
13
−
5
View file @
20dc4280
...
...
@@ -3,7 +3,9 @@
//
import
nextflow.Nextflow
import
nextflow.Channel
import
groovy.text.SimpleTemplateEngine
import
groovyx.gpars.dataflow.DataflowWriteChannel
class
WorkflowHic
{
...
...
@@ -90,13 +92,19 @@ class WorkflowHic {
// Check the params 'list of Integer' or Integer (ex bin_size)
public
static
void
checkParamIntList
(
def
param2check
,
log
)
{
if
(
param2check
instanceof
Integer
||
(
param2check
instanceof
String
&&
param2check
==~
/(\d+)(,\d+)*/
)){
//good format, do nothing
}
else
{
println
"\n"
if
(
param2check
!
instanceof
Integer
&&
!(
param2check
instanceof
String
&&
param2check
==~
/(\d+)(,\d+)*/
)){
println
"\n"
log
.
error
"ERROR: ${param2check} must be integer or list of integer"
Nextflow
.
error
(
'Exiting!'
)
}
}
// In hic.nf: check if the param is int. If true, don't splitCsv and flatten to avoid error
public
static
DataflowWriteChannel
checkIfInt
(
def
param2check
)
{
if
(
param2check
instanceof
Integer
)
{
return
Channel
.
from
(
param2check
).
toInteger
()
}
else
{
return
Channel
.
from
(
param2check
).
splitCsv
().
flatten
().
toInteger
()
}
}
}
This diff is collapsed.
Click to expand it.
workflows/hic.nf
+
9
−
17
View file @
20dc4280
...
...
@@ -41,23 +41,21 @@ if (params.digestion){
//****************************************
// Combine all maps resolution for downstream analysis
if
(
params
.
bin_size
instanceof
Integer
)
{
/*
if (params.bin_size instanceof Integer) {
ch_map_res = Channel.from( params.bin_size ).toInteger()
}
else {
ch_map_res = Channel.from( params.bin_size ).splitCsv().flatten().toInteger()
}
} */
ch_map_res
=
WorkflowHic
.
checkIfInt
(
params
.
bin_size
)
if
(
params
.
res_zoomify
){
ch_zoom_res
=
Channel
.
from
(
params
.
res_zoomify
).
splitCsv
().
flatten
().
toInteger
()
ch_map_res
=
ch_map_res
.
concat
(
ch_zoom_res
)
}
if
(
params
.
res_tads
&&
!
params
.
skip_tads
&&
params
.
res_tads
instanceof
Integer
){
ch_tads_res
=
Channel
.
from
(
"${params.res_tads}"
).
toInteger
()
ch_map_res
=
ch_map_res
.
concat
(
ch_tads_res
)
}
else
if
(
params
.
res_tads
&&
!
params
.
skip_tads
){
ch_tads_res
=
Channel
.
from
(
"${params.res_tads}"
).
splitCsv
().
flatten
().
toInteger
()
if
(
params
.
res_tads
&&
!
params
.
skip_tads
){
ch_tads_res
=
WorkflowHic
.
checkIfInt
(
params
.
res_tads
)
ch_map_res
=
ch_map_res
.
concat
(
ch_tads_res
)
}
else
{
ch_tads_res
=
Channel
.
empty
()
...
...
@@ -66,11 +64,8 @@ if (params.res_tads && !params.skip_tads && params.res_tads instanceof Integer){
}
}
if
(
params
.
res_dist_decay
&&
!
params
.
skip_dist_decay
&&
params
.
res_dist_decay
instanceof
Integer
){
ch_ddecay_res
=
Channel
.
from
(
"${params.res_dist_decay}"
).
toInteger
()
ch_map_res
=
ch_map_res
.
concat
(
ch_ddecay_res
)
}
else
if
(
params
.
res_dist_decay
&&
!
params
.
skip_dist_decay
){
ch_ddecay_res
=
Channel
.
from
(
"${params.res_dist_decay}"
).
splitCsv
().
flatten
().
toInteger
()
if
(
params
.
res_dist_decay
&&
!
params
.
skip_dist_decay
){
ch_ddecay_res
=
WorkflowHic
.
checkIfInt
(
params
.
res_dist_decay
)
ch_map_res
=
ch_map_res
.
concat
(
ch_ddecay_res
)
}
else
{
ch_ddecay_res
=
Channel
.
empty
()
...
...
@@ -79,11 +74,8 @@ if (params.res_dist_decay && !params.skip_dist_decay && params.res_dist_decay in
}
}
if
(
params
.
res_compartments
&&
!
params
.
skip_compartments
&&
params
.
res_compartments
instanceof
Integer
){
ch_comp_res
=
Channel
.
from
(
"${params.res_compartments}"
).
toInteger
()
ch_map_res
=
ch_map_res
.
concat
(
ch_comp_res
)
}
else
if
(
params
.
res_compartments
&&
!
params
.
skip_compartments
){
ch_comp_res
=
Channel
.
from
(
"${params.res_compartments}"
).
splitCsv
().
flatten
().
toInteger
()
if
(
params
.
res_compartments
&&
!
params
.
skip_compartments
){
ch_comp_res
=
WorkflowHic
.
checkIfInt
(
params
.
res_compartments
)
ch_map_res
=
ch_map_res
.
concat
(
ch_comp_res
)
}
else
{
ch_comp_res
=
Channel
.
empty
()
...
...
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