Skip to content

Commit

Permalink
API+MIN Rename search-dir to search-path
Browse files Browse the repository at this point in the history
Makes it consistent across all interfaces and documentation.

fixes #70
  • Loading branch information
unode authored and luispedro committed Oct 28, 2018
1 parent a979a78 commit ef65394
Show file tree
Hide file tree
Showing 18 changed files with 25 additions and 24 deletions.
3 changes: 2 additions & 1 deletion ChangeLog
Expand Up @@ -7,14 +7,15 @@ Version 0.9.1+
expected
* Indices created by bwa and minimap2 are now versioned
* arg1 in external modules is no longer always treated as a path
* Added expand_searchdir to external modules API (closes #56)
* Added expand_searchpath to external modules API (closes #56)
* Fixed bug where detection of Fastq encoding was not performed on the second pair
* Fix saving fastq sets with --subsample (issue #85)
* Add __extra_megahit_args to assemble() (issue #86)
* Better error message when user mis-specifies the ngless version string
(issue #84)
* Support NO_COLOR environment variable (issue #83)
* Garbage collection for temporary files (issue #79)
* Rename --search-dir to --search-path for consistency with other API

Version 0.9.1 2018-07-17 by luispedro
* Add biorxiv citation
Expand Down
2 changes: 1 addition & 1 deletion NGLess/CmdArgs.hs
Expand Up @@ -154,7 +154,7 @@ mainArgs = DefaultMode
<*> optional (strOption $ long "export-json" <> help "File to write JSON representation of script to") -- exportJSON :: Maybe FilePath
<*> optional (strOption $ long "export-cwl" <> help "File to write CWL wrapper of given script") -- exportCWL :: Maybe FilePath
<*> switch (long "check-deprecation" <> help "Check if ngless version or any used modules have been deprecated")-- deprecationCheck :: Bool
<*> many (strOption $ long "search-dir" <> help "Reference search directories (replace <references> in script)") -- searchPath :: [FilePath]
<*> many (strOption $ long "search-path" <> help "Reference search directories (replace <references> in script)") -- searchPath :: [FilePath]
<*> optional (strOption $ long "index-path" <> help "Index path (directory where indices are stored)") -- indexPath :: Maybe FilePath
<*> many (strArgument (metavar "ARGV")) -- extraArgs :: [String]

Expand Down
8 changes: 4 additions & 4 deletions NGLess/ExternalModules.hs
Expand Up @@ -89,7 +89,7 @@ instance Aeson.FromJSON FileType where

data CommandExtra = FlagInfo [T.Text]
| FileInfo FileType
| ExpandSearchDir Bool
| ExpandSearchPath Bool
deriving (Eq, Show)

data CommandArgument = CommandArgument
Expand Down Expand Up @@ -127,12 +127,12 @@ instance Aeson.FromJSON CommandArgument where
return [ArgCheckSymbol allowed]
else return []
let cargInfo = ArgInformation{..}
aexpand <- o .:? "expand_searchdir" .!= False
aexpand <- o .:? "expand_searchpath" .!= False
cargPayload <-
if
| atype `elem` ["option", "flag"] -> liftM FlagInfo <$> ((Just . (:[]) <$> o .: "when-true") <|> o .:? "when-true")
| atype `elem` ["readset", "counts", "mappedreadset"] -> (Just . FileInfo <$> Aeson.parseJSON (Aeson.Object o)) <|> return Nothing
| atype == "str" -> return $ Just (ExpandSearchDir aexpand)
| atype == "str" -> return $ Just (ExpandSearchPath aexpand)
| otherwise -> return Nothing
return CommandArgument{..}

Expand Down Expand Up @@ -344,7 +344,7 @@ encodeArgument (CommandArgument ai _ payload) (Just v)
NGLString -> do
str <- T.unpack <$> stringOrTypeError "in external module" v
case payload of
Just (ExpandSearchDir True) -> fromMaybe str <$> expandPath str
Just (ExpandSearchPath True) -> fromMaybe str <$> expandPath str
_ -> return str
NGLSymbol -> T.unpack <$> symbolOrTypeError "in external module" v
NGLInteger -> show <$> integerOrTypeError "in external module" v
Expand Down
2 changes: 1 addition & 1 deletion docs/sources/command-line-options.md
Expand Up @@ -38,7 +38,7 @@ of free disk space:
Directory where to store temporary files


--search-dir ARG Reference search directories (replace <references> in
--search-path ARG Reference search directories (replace <references> in
script)
--index-path ARG Index path (directory where indices are stored)

Expand Down
4 changes: 2 additions & 2 deletions docs/sources/modules.md
Expand Up @@ -206,13 +206,13 @@ of the output type.

If you plan to make use of [search path expansion](searchpath.html), in order
for NGLess to expand the argument prior to passing it to the external module
you need to set ``atype: "str"`` and ``expand_searchdir: true``.
you need to set ``atype: "str"`` and ``expand_searchpath: true``.

additional:
-
atype: 'str'
name: 'reference'
expand_searchdir: true
expand_searchpath: true

### Citation

Expand Down
2 changes: 1 addition & 1 deletion docs/sources/whatsnew.rst
Expand Up @@ -78,7 +78,7 @@ Bugfixes
- Fixed `lock1
<http://ngless.embl.de/stdlib.html?highlight=lock1#parallel-module>`__ when
used with full paths (see `issue #68 <https://github.com/ngless-toolkit/ngless/issues/68>`__)
- Fix expansion of searchdir with external modules (see `issue #56
- Fix expansion of searchpath with external modules (see `issue #56
<https://github.com/ngless-toolkit/ngless/issues/56>`__)

Version 0.8
Expand Down
2 changes: 1 addition & 1 deletion tests/map_search_path/cmdargs
@@ -1 +1 @@
--search-dir subdirectory
--search-path subdirectory
2 changes: 1 addition & 1 deletion tests/map_search_path_multiple/cmdargs
@@ -1 +1 @@
--search-dir subdir1 --search-dir subdir2
--search-path subdir1 --search-path subdir2
1 change: 0 additions & 1 deletion tests/searchdirExternalModule/cmdargs

This file was deleted.

5 changes: 0 additions & 5 deletions tests/searchdirExternalModule/test.ngl

This file was deleted.

Expand Up @@ -14,7 +14,7 @@ if [ "$2" != "$EXPECTED" ]; then
exit 1
fi

EXPECTED="--ref2=../searchdirExternalModule/somedir/input2.fq"
EXPECTED="--ref2=../searchpathExternalModule/somedir/input2.fq"

if [ "$3" != "$EXPECTED" ]; then
echo "3nd argument expected '$EXPECTED' saw '$3'"
Expand Down
Expand Up @@ -2,7 +2,7 @@ version: '0.0.0'
name: 'Test tool'
functions:
-
nglName: "testing_searchdir_string"
nglName: "testing_searchpath_string"
arg0: './command_string.sh'

arg1:
Expand All @@ -20,22 +20,22 @@ functions:
atype: str

-
nglName: "testing_searchdir_path"
nglName: "testing_searchpath_path"
arg0: './command_path.sh'

arg1:
atype: str
expand_searchdir: true
expand_searchpath: true

additional:
-
name: ref
atype: str
expand_searchdir: true
expand_searchpath: true
-
name: ref2
atype: str
expand_searchdir: true
expand_searchpath: true
-
name: string
atype: str
1 change: 1 addition & 0 deletions tests/searchpathExternalModule/cmdargs
@@ -0,0 +1 @@
--search-path location=somedir --search-path fullpath=../searchpathExternalModule/somedir
File renamed without changes.
5 changes: 5 additions & 0 deletions tests/searchpathExternalModule/test.ngl
@@ -0,0 +1,5 @@
ngless '0.0'
local import "test" version "0.0"

testing_searchpath_path("<location>/input.fq", ref="<location>/input2.fq", ref2="<fullpath>/input2.fq", string="sentence")
testing_searchpath_string("<location>/input.fq", ref="<location>/input2.fq", ref2="<fullpath>/input2.fq", string="sentence")

0 comments on commit ef65394

Please sign in to comment.