Skip to content

Commit

Permalink
Fixing help parsing to make it so error messages don't appear if you …
Browse files Browse the repository at this point in the history
…provide the help flag as the first input; fixing nimble file to compile poaV2 before build step
  • Loading branch information
Nathan Roach committed Nov 22, 2020
1 parent 10c6eba commit fbcdd29
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 12 deletions.
7 changes: 6 additions & 1 deletion conduit.nimble
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Package

version = "0.1.0"
version = "0.1.2"
author = "Nathan Roach"
description = "De novo transcriptome assembler"
license = "GPLv2"
Expand All @@ -16,4 +16,9 @@ before install:
withDir "src/poaV2":
exec "make"

before build:
echo "Building poaV2"
withDir "src/poaV2":
exec "make"

bin = @["conduit", "conduitUtils", "conduit_clustering"]
20 changes: 15 additions & 5 deletions src/conduit.nim
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ type


proc conduitVersion() : string =
return "CONDUIT Version 0.1.1 by Nathan Roach ( nroach2@jhu.edu, https://github.com/NatPRoach/conduit/ )"
return "CONDUIT Version 0.1.2 by Nathan Roach ( nroach2@jhu.edu, https://github.com/NatPRoach/conduit/ )"

proc writeDefaultHelp() =
echo "CONDUIT - CONsensus Decomposition Utility In Transcriptome-assembly:"
Expand Down Expand Up @@ -629,9 +629,16 @@ proc parseOptions() : ConduitOptions =
for kind, key, val in getopt():
# echo kind," ", key," ", val
if i == 0:
mode = key
i += 1
continue
if kind == cmdArgument:
mode = key
i += 1
continue
else:
if key == "h" or key == "help":
mode = "help"
helpFlag = true
runFlag = false
break
if i == 1:
helpFlag = false
i += 1
Expand Down Expand Up @@ -1022,7 +1029,7 @@ proc parseOptions() : ConduitOptions =
else:
helpFlag = true
break
if clustersDirectory == "":
if clustersDirectory == "" and mode != "help" and not helpFlag:
echo "ERROR - <clusters directory> must be specified"
helpFlag = true
runFlag = false
Expand All @@ -1033,6 +1040,9 @@ proc parseOptions() : ConduitOptions =
writeNanoHelp()
of "hybrid":
writeHybridHelp()
of "help":
writeDefaultHelp()
quit(QuitSuccess)
else:
echo "ERROR - first argument must specify correction mode, \"nano\" or \"hybrid\""
writeDefaultHelp()
Expand Down
19 changes: 15 additions & 4 deletions src/conduitUtils.nim
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ type


proc conduitUtilsVersion() : string =
return "CONDUIT Utilities Version 0.1.1 by Nathan Roach ( nroach2@jhu.edu, https://github.com/NatPRoach/conduit/ )"
return "CONDUIT Utilities Version 0.1.2 by Nathan Roach ( nroach2@jhu.edu, https://github.com/NatPRoach/conduit/ )"


proc writeDefaultHelp() =
Expand Down Expand Up @@ -1232,9 +1232,17 @@ proc parseOptions() : UtilOptions =
for kind, key, val in getopt():
# echo kind," ", key," ", val
if i == 0:
mode = key
i += 1
continue
if kind == cmdArgument:
mode = key
i += 1
continue
else:
if key == "h" or key == "help":
mode = "help"
helpFlag = true
runFlag = false
break

if i == 1:
helpFlag = false
i += 1
Expand Down Expand Up @@ -1392,6 +1400,9 @@ proc parseOptions() : UtilOptions =
writeCallNovelNonCanonicalHelp()
of "callOverlapping":
writeCallOverlappingHelp()
of "help":
writeDefaultHelp()
quit(QuitSuccess)
else:
echo "ERROR - first argument must specify utility function"
writeDefaultHelp()
Expand Down
4 changes: 2 additions & 2 deletions src/conduit_clustering.nim
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ type
# TODO - Possibly change uint32 to uint64 where necessary.
# TODO - Reevaluate before publication.
proc conduitClusterVersion() : string =
return "CONDUIT Clustering Version 0.1.1 by Nathan Roach ( nroach2@jhu.edu," &
return "CONDUIT Clustering Version 0.1.2 by Nathan Roach ( nroach2@jhu.edu," &
" https://github.com/NatPRoach/conduit/ )"


Expand Down Expand Up @@ -339,7 +339,7 @@ proc parseClusteringOptions() : ClusteringOptions =
break
last = ""

if file == "":
if file == "" and not helpFlag:
echo "ERROR - clustering requires an input BAM file"
helpFlag = true
runFlag = false
Expand Down

0 comments on commit fbcdd29

Please sign in to comment.