Skip to content

Commit

Permalink
ENH Add __extra_megahit_args to assemble()
Browse files Browse the repository at this point in the history
Allow users to directly pass arguments to megahit

closes #86
  • Loading branch information
luispedro committed Oct 28, 2018
1 parent 8af2ec8 commit 71d8af1
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
1 change: 1 addition & 0 deletions ChangeLog
Expand Up @@ -8,6 +8,7 @@ Version 0.9.1+
* arg1 in external modules is no longer always treated as a path
* Added expand_searchdir to external modules API (closes #56)
* Fix saving fastq sets with --subsample (issue #85)
* Add __extra_megahit_args to assemble() (issue #86)

Version 0.9.1 2018-07-17 by luispedro
* Add biorxiv citation
Expand Down
9 changes: 5 additions & 4 deletions NGLess/BuiltinModules/Assemble.hs
@@ -1,4 +1,4 @@
{- Copyright 2017 NGLess Authors
{- Copyright 2017-2018 NGLess Authors
- License: MIT
-}

Expand Down Expand Up @@ -27,7 +27,7 @@ import Utils.Utils (readProcessErrorWithExitCode)


executeAssemble :: T.Text -> NGLessObject -> KwArgsValues -> NGLessIO NGLessObject
executeAssemble "assemble" expr [] = do
executeAssemble "assemble" expr kwargs = do
files <- case expr of
NGOReadSet _ (ReadSet [] singles) -> do
FastQFilePath _ f <- concatenateFQs singles
Expand All @@ -45,14 +45,15 @@ executeAssemble "assemble" expr [] = do
megahitPath <- megahitBin
keepTempFiles <- nConfKeepTemporaryFiles <$> nglConfiguration
nthreads <- liftIO getNumCapabilities
extraArgs <- map T.unpack <$> lookupStringListOrScriptErrorDef (return []) "extra megahit arguments" "__extra_megahit_args" kwargs
(_, tdir) <- createTempDir "ngless-megahit-assembly"
(_, mhtmpdir) <- createTempDir "ngless-megahit-tmpdir"
let odir = tdir </> "megahit-output"
args = files ++
["-o", odir
,"--num-cpu-threads", show nthreads
,"--tmp-dir", mhtmpdir
] ++ ["--keep-tmp-files" | keepTempFiles]
] ++ ["--keep-tmp-files" | keepTempFiles] ++ extraArgs
outputListLno' DebugOutput ["Calling megahit: ", megahitPath, " ", unwords args]
(errmsg, exitCode) <- liftIO $ readProcessErrorWithExitCode
(proc megahitPath args)
Expand All @@ -69,7 +70,7 @@ assembleFunction = Function
, funcArgType = Just NGLReadSet
, funcArgChecks = []
, funcRetType = NGLString
, funcKwArgs = []
, funcKwArgs = [ArgInformation "__extra_megahit_args" False (NGList NGLString) []]
, funcAllowsAutoComprehension = False
, funcChecks = [FunctionCheckReturnAssigned]
}
Expand Down
12 changes: 12 additions & 0 deletions docs/sources/Functions.rst
Expand Up @@ -645,6 +645,18 @@ Returns

string : generated file

Arguments by value:
~~~~~~~~~~~~~~~~~~~

+-----------------------+-------------+------------+----------------+
| Name | Type | Required | Default Value |
+=======================+=============+============+================+
| __extra_megahit_arg | List of str | no | [] |
+-----------------------+-------------+------------+----------------+

``__extra_megahit_arg`` is passed directly to megahit with no checking.


orf_find
--------

Expand Down

0 comments on commit 71d8af1

Please sign in to comment.