diff options
author | Justin Bedo <cu@cua0.org> | 2021-07-29 17:03:11 +1000 |
---|---|---|
committer | Justin Bedo <cu@cua0.org> | 2021-07-29 17:03:11 +1000 |
commit | c10cfb984d3a0881458018325e2b95219ed16829 (patch) | |
tree | 7ccbc5fade0d687bceed7510cd5b2d61afeb6839 | |
parent | 6bd9f1715fc2e1d4548046e3ce2bd91d64625a1e (diff) |
add readme and more friendlier usage instructions
-rw-r--r-- | README | 23 | ||||
-rw-r--r-- | xenomapper.hs | 9 |
2 files changed, 29 insertions, 3 deletions
@@ -0,0 +1,23 @@ +This is a reimplementation of Xenomapper [1] in Haskell. Unlike the +orginal it is significantly more focused in scope: only primary specific +alignments are output. + +Example usage: "xenomapper-hs primary-specific.bam primary.bam secondary.bam" + +The first argument is the output bam path, and the subsequent are the +primary and secondary alignments. NB: the inputs must be name sorted +and the output will be name sorted. + +Building the binary requires a flake enabled Nix [2]. Run + + nix build git://vk3.wtf/xenomapper-hs.git + +to build, or if you have already cloned the repository then simply + + nix build + +in the root. + +-- +1: https://github.com/genomematt/xenomapper +2: https://nixos.org/Nix diff --git a/xenomapper.hs b/xenomapper.hs index 123b1a5..4546ab2 100644 --- a/xenomapper.hs +++ b/xenomapper.hs @@ -36,6 +36,9 @@ filterBams a b = do main = do args <- getArgs - - withLogging_ (LoggingConf Warning Error Error 10 True) $ do - decodeBamFiles args (\[(hdr, prim), (_, sec)] -> writeBamFile "primary.bam" hdr $ filterBams prim sec) + if length args /= 3 then do + path <- getProgName + hPutStrLn stderr $ unwords [ "usage:", path, "output.bam", "input1.bam", "input2.bam" ] + else + withLogging_ (LoggingConf Warning Error Error 10 True) $ do + decodeBamFiles (tail args) (\[(hdr, prim), (_, sec)] -> writeBamFile (head args) hdr $ filterBams prim sec) |