Autodetect max number of cores and pass as an argument in NextflowWhat is the difference between a Bioinformatics pipeline and workflow?

How to handle a player wanting to use the (UA) Remote Access spell on an android player character?

How can I add this conditional constraint to my model in Python?

How are hillsides farmed?

Does a troll die if its maximum hit points is zero?

Mutate my DNA sequence

Do European politicians typically put their pronouns on their social media pages?

Why does hashing public keys not actually provide any quantum resistance?

You see a boat filled with people

How to draw 15-puzzle in LaTeX

What's the short and accented note at the very end of a song called?

How do the other crew members know the xenomorph is "big", if they haven't seen it?

Are there simple ways to draw parallelepipeds in tikz?

How do I search for a package?

Why is Microwaved mac & cheese burnt where they touch?

What could an alternative human-powered transportation method look like?

Why am i getting the wrong IP from DNS lookups

How are astronauts in the ISS protected from electric shock?

Super Secret Cookbook

Is Bcrypt a hashing algorithm or is my study material wrong?

How to play a devious character when you are not personally devious?

Extract lines from files with names begining with given letter

Python algorithm that converts array-like data into MathJax

Could the principle of owls' silent flight be used for stealth aircraft?

Which 50 amp breaker do I need for my old Eaton panel?



Autodetect max number of cores and pass as an argument in Nextflow


What is the difference between a Bioinformatics pipeline and workflow?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty
margin-bottom:0;

.everyonelovesstackoverflowposition:absolute;height:1px;width:1px;opacity:0;top:0;left:0;pointer-events:none;








3














$begingroup$


I am creating a pipeline in Nextflow. One step is creating a pangenome with Roary. Roary takes threads as an argument and if no number of threads is supplied as an argument it defaults to one.



Is there a way in Nextflow to pass the maximum number of available threads as an argument? At the moment the best I can come up with is defining an arbitrarily large number of threads as an argument which will cap out and run with the max number of threads. I would like to know, is there a 'cleaner' or more canonical way of doing this?



At the moment my process looks like this:




process roary

publishDir "$params.outdir/roary", mode: 'copy'

cpus 200

input:
file gff from gff.collect()

output:
file("*") into roary
file("pan_genome_reference.fa") into pan_genome
file("pan_genome_sequences/*") into alignment_files
file("gene_presence_absence.Rtab") into gene_presence
set file("*accessory*"),
file("*.Rtab"),
file("_*"),
file("*.txt"),
file("*csv") into roary_out


script:
"""
roary -p $task.cpus -e -n -v -z $gff
"""



Thanks in advance. Also, apologies as I can see why this might not strictly be bioinformatics, but it's where Nextflow has the most traction.










share|improve this question












$endgroup$










  • 2




    $begingroup$
    Workflow management has a firm foothold in bioinformatics and is in my opinion directly on topic on this site.
    $endgroup$
    – Daniel Standage
    May 29 at 13:01

















3














$begingroup$


I am creating a pipeline in Nextflow. One step is creating a pangenome with Roary. Roary takes threads as an argument and if no number of threads is supplied as an argument it defaults to one.



Is there a way in Nextflow to pass the maximum number of available threads as an argument? At the moment the best I can come up with is defining an arbitrarily large number of threads as an argument which will cap out and run with the max number of threads. I would like to know, is there a 'cleaner' or more canonical way of doing this?



At the moment my process looks like this:




process roary

publishDir "$params.outdir/roary", mode: 'copy'

cpus 200

input:
file gff from gff.collect()

output:
file("*") into roary
file("pan_genome_reference.fa") into pan_genome
file("pan_genome_sequences/*") into alignment_files
file("gene_presence_absence.Rtab") into gene_presence
set file("*accessory*"),
file("*.Rtab"),
file("_*"),
file("*.txt"),
file("*csv") into roary_out


script:
"""
roary -p $task.cpus -e -n -v -z $gff
"""



Thanks in advance. Also, apologies as I can see why this might not strictly be bioinformatics, but it's where Nextflow has the most traction.










share|improve this question












$endgroup$










  • 2




    $begingroup$
    Workflow management has a firm foothold in bioinformatics and is in my opinion directly on topic on this site.
    $endgroup$
    – Daniel Standage
    May 29 at 13:01













3












3








3





$begingroup$


I am creating a pipeline in Nextflow. One step is creating a pangenome with Roary. Roary takes threads as an argument and if no number of threads is supplied as an argument it defaults to one.



Is there a way in Nextflow to pass the maximum number of available threads as an argument? At the moment the best I can come up with is defining an arbitrarily large number of threads as an argument which will cap out and run with the max number of threads. I would like to know, is there a 'cleaner' or more canonical way of doing this?



At the moment my process looks like this:




process roary

publishDir "$params.outdir/roary", mode: 'copy'

cpus 200

input:
file gff from gff.collect()

output:
file("*") into roary
file("pan_genome_reference.fa") into pan_genome
file("pan_genome_sequences/*") into alignment_files
file("gene_presence_absence.Rtab") into gene_presence
set file("*accessory*"),
file("*.Rtab"),
file("_*"),
file("*.txt"),
file("*csv") into roary_out


script:
"""
roary -p $task.cpus -e -n -v -z $gff
"""



Thanks in advance. Also, apologies as I can see why this might not strictly be bioinformatics, but it's where Nextflow has the most traction.










share|improve this question












$endgroup$




I am creating a pipeline in Nextflow. One step is creating a pangenome with Roary. Roary takes threads as an argument and if no number of threads is supplied as an argument it defaults to one.



Is there a way in Nextflow to pass the maximum number of available threads as an argument? At the moment the best I can come up with is defining an arbitrarily large number of threads as an argument which will cap out and run with the max number of threads. I would like to know, is there a 'cleaner' or more canonical way of doing this?



At the moment my process looks like this:




process roary

publishDir "$params.outdir/roary", mode: 'copy'

cpus 200

input:
file gff from gff.collect()

output:
file("*") into roary
file("pan_genome_reference.fa") into pan_genome
file("pan_genome_sequences/*") into alignment_files
file("gene_presence_absence.Rtab") into gene_presence
set file("*accessory*"),
file("*.Rtab"),
file("_*"),
file("*.txt"),
file("*csv") into roary_out


script:
"""
roary -p $task.cpus -e -n -v -z $gff
"""



Thanks in advance. Also, apologies as I can see why this might not strictly be bioinformatics, but it's where Nextflow has the most traction.







workflow-management roary nextflow pangenome






share|improve this question
















share|improve this question













share|improve this question




share|improve this question








edited May 29 at 13:06









Daniel Standage

3,4877 silver badges33 bronze badges




3,4877 silver badges33 bronze badges










asked May 29 at 10:55









TW93TW93

1798 bronze badges




1798 bronze badges










  • 2




    $begingroup$
    Workflow management has a firm foothold in bioinformatics and is in my opinion directly on topic on this site.
    $endgroup$
    – Daniel Standage
    May 29 at 13:01












  • 2




    $begingroup$
    Workflow management has a firm foothold in bioinformatics and is in my opinion directly on topic on this site.
    $endgroup$
    – Daniel Standage
    May 29 at 13:01







2




2




$begingroup$
Workflow management has a firm foothold in bioinformatics and is in my opinion directly on topic on this site.
$endgroup$
– Daniel Standage
May 29 at 13:01




$begingroup$
Workflow management has a firm foothold in bioinformatics and is in my opinion directly on topic on this site.
$endgroup$
– Daniel Standage
May 29 at 13:01










1 Answer
1






active

oldest

votes


















4
















$begingroup$

I have not read the full Nextflow manual in depth, but I think there is no Nextflow command to detect the maximum number of threads you can use.



However, you can try to automatize this task by using the nproc command.



nproc gives you the number of processing units available. An idea would be to include something such nproc - 1 as the max number of threads for Roary.






share|improve this answer












$endgroup$










  • 1




    $begingroup$
    Thanks, as far I could see there are ways to dynamically allocate resources (nextflow.io/docs/latest/…) but not detect threads, so this is a nice workaround.
    $endgroup$
    – TW93
    May 29 at 14:46












Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "676"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);














draft saved

draft discarded
















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fbioinformatics.stackexchange.com%2fquestions%2f8712%2fautodetect-max-number-of-cores-and-pass-as-an-argument-in-nextflow%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown


























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









4
















$begingroup$

I have not read the full Nextflow manual in depth, but I think there is no Nextflow command to detect the maximum number of threads you can use.



However, you can try to automatize this task by using the nproc command.



nproc gives you the number of processing units available. An idea would be to include something such nproc - 1 as the max number of threads for Roary.






share|improve this answer












$endgroup$










  • 1




    $begingroup$
    Thanks, as far I could see there are ways to dynamically allocate resources (nextflow.io/docs/latest/…) but not detect threads, so this is a nice workaround.
    $endgroup$
    – TW93
    May 29 at 14:46















4
















$begingroup$

I have not read the full Nextflow manual in depth, but I think there is no Nextflow command to detect the maximum number of threads you can use.



However, you can try to automatize this task by using the nproc command.



nproc gives you the number of processing units available. An idea would be to include something such nproc - 1 as the max number of threads for Roary.






share|improve this answer












$endgroup$










  • 1




    $begingroup$
    Thanks, as far I could see there are ways to dynamically allocate resources (nextflow.io/docs/latest/…) but not detect threads, so this is a nice workaround.
    $endgroup$
    – TW93
    May 29 at 14:46













4














4










4







$begingroup$

I have not read the full Nextflow manual in depth, but I think there is no Nextflow command to detect the maximum number of threads you can use.



However, you can try to automatize this task by using the nproc command.



nproc gives you the number of processing units available. An idea would be to include something such nproc - 1 as the max number of threads for Roary.






share|improve this answer












$endgroup$



I have not read the full Nextflow manual in depth, but I think there is no Nextflow command to detect the maximum number of threads you can use.



However, you can try to automatize this task by using the nproc command.



nproc gives you the number of processing units available. An idea would be to include something such nproc - 1 as the max number of threads for Roary.







share|improve this answer















share|improve this answer




share|improve this answer








edited May 29 at 13:57









terdon

5,8252 gold badges9 silver badges33 bronze badges




5,8252 gold badges9 silver badges33 bronze badges










answered May 29 at 12:20









platplat

7472 silver badges12 bronze badges




7472 silver badges12 bronze badges










  • 1




    $begingroup$
    Thanks, as far I could see there are ways to dynamically allocate resources (nextflow.io/docs/latest/…) but not detect threads, so this is a nice workaround.
    $endgroup$
    – TW93
    May 29 at 14:46












  • 1




    $begingroup$
    Thanks, as far I could see there are ways to dynamically allocate resources (nextflow.io/docs/latest/…) but not detect threads, so this is a nice workaround.
    $endgroup$
    – TW93
    May 29 at 14:46







1




1




$begingroup$
Thanks, as far I could see there are ways to dynamically allocate resources (nextflow.io/docs/latest/…) but not detect threads, so this is a nice workaround.
$endgroup$
– TW93
May 29 at 14:46




$begingroup$
Thanks, as far I could see there are ways to dynamically allocate resources (nextflow.io/docs/latest/…) but not detect threads, so this is a nice workaround.
$endgroup$
– TW93
May 29 at 14:46


















draft saved

draft discarded















































Thanks for contributing an answer to Bioinformatics Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

Use MathJax to format equations. MathJax reference.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fbioinformatics.stackexchange.com%2fquestions%2f8712%2fautodetect-max-number-of-cores-and-pass-as-an-argument-in-nextflow%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown









Popular posts from this blog

Distance measures on a map of a game The 2019 Stack Overflow Developer Survey Results Are Inmin distance in a graphShortest distance path on contour plotHow to plot a tilted map?Finding points outside of a diskDelaunay link distanceAnnulus from GeoDisks: drawing a ring on a mapNegative Correlation DistanceFind distance along a path (GPS coordinates)Finding position at given distance in a GeoPathMathematics behind distance estimation using camera

How to get a smooth, uniform ParametricPlot of a 2D Region?How to plot a complicated Region?How to exclude a region from ParametricPlotHow discretize a region placing vertices on a specific non-uniform gridHow to transform a Plot or a ParametricPlot into a RegionHow can I get a smooth plot of a bounded region?Smooth ParametricPlot3D with RegionFunction?Smooth border of a region ParametricPlotSmooth region boundarySmooth region plot from list of pointsGet minimum y of a certain x in a region

Genealogie vun de Merowenger Vum Merowech bis zum Chilperich I. | Navigatiounsmenü