What’s the best way to deal with module inputs whe...
# modules
t
What’s the best way to deal with module inputs when dealing with tools that accept multiple complementary ways to specify inputs? Example incoming in thread
👀 1
I am creating a module for
trident
which accepts the inpput specified in many different ways. Here’s the relevant helptext:
Copy code
trident v1.6.7.3 for poseidon v2.5.0, v2.6.0, v2.7.0, v2.7.1
<https://poseidon-framework.github.io>

Usage: trident validate ((-d|--baseDir DIR) [--ignoreGeno] [--fullGeno] 
                          [--ignoreDuplicates] [-c|--ignoreChecksums] 
                          [--ignorePoseidonVersion] |
                          --pyml FILE | (-p|--genoOne FILE) | --genoFile FILE
                          --snpFile FILE --indFile FILE |
                          --bedFile FILE --bimFile FILE --famFile FILE | 
                          --vcfFile FILE | --janno FILE | --ssf FILE | 
                          --bib FILE) [--noExitCode] [--onlyLatest]

  Check Poseidon packages or package components for structural correctness

Available options:
  -h,--help                Show this help text
  -d,--baseDir DIR         A base directory to search for Poseidon packages.
  --pyml FILE              Path to a POSEIDON.yml file.
  -p,--genoOne FILE        One of the input genotype data files. Expects .bed,
                           .bed.gz, .bim, .bim.gz or .fam for PLINK, .geno,
                           .geno.gz, .snp, .snp.gz or .ind for EIGENSTRAT,
                           or.vcf or .vcf.gz for VCF. In case of EIGENSTRAT and
                           PLINK, the two other files must be in the same
                           directory and must have the same base name. If a
                           gzipped file is given, it is assumed that the file
                           pairs (.geno.gz, .snp.gz) or (.bim.gz, .bed.gz) are
                           both zipped, but not the .fam or .ind file. If a .ind
                           or .fam file is given, it is assumed that none of the
                           file triples is zipped.
  --genoFile FILE          Eigenstrat genotype matrix, optionally gzipped.
                           Accepted file endings are .geno, .geno.gz
  --snpFile FILE           Eigenstrat snp positions file, optionally gzipped.
                           Accepted file endings are .snp, .snp.gz
  --indFile FILE           Eigenstrat individual file. Accepted file endings are
                           .ind
  --bedFile FILE           Plink genotype matrix, optionally gzipped. Accepted
                           file endings are .bed, .bed.gz
  --bimFile FILE           Plink snp positions file, optionally gzipped.
                           Accepted file endings are .bim, .bim.gz
  --famFile FILE           Plink individual file. Accepted file endings are .fam
  --vcfFile FILE           VCF (Variant Call Format) file, optionall gzipped.
                           Accepted file endings are .vcf, .vcf.gz
  --janno FILE             Path to a .janno file.
  --ssf FILE               Path to a .ssf file.
  --bib FILE               Path to a .bib file.
So, a user can provide a package directory (
-d
) (which will include a yaml, a set of genotype data (e.g. bed/bim/fam), and some optional files. But a user could also provide the paths to the Yml (
--pyml
), bed/bim/fam (
--*File
), janno, ssf, and whatever other files are within a package individually. Or, they could provide the genotype dataset with
-p
, and let trident work out the paths for the accompanying files (e.g. bim/fam).
what makes things worse is that these can be mixed and matched to supplement datasets. i.e., it is a valid approach to provide one or multiple directories with one or multiple packages each to
-d
, then add various specific files from a package kept elsewhere with any combination of the
--*File
and/or
-p/--ssf/--janno/--bib
options
implementation-wise, I feel like the best approach would be to make the module only work with
-d
and call it a day, but then I would not be specifying all paths as inputs at all
it is also hard to call any of these options “mandatory”, since they are only mandatory as a group
thoughts? 😅
another approach would be to take two inputs: directories, and files. The files get given to the correct option by looking at their suffix, and the directories are given to
-d
. 🤔 Is there one approach that is more appropriate for the modules repo?
s
If you set
-d
, does it search through and find everything?
t
yes. it searches through the given directory, and all subdirectories, and finds all
POSEIDON.yml
files
s
and those yml files have to point to the other files?
t
yes
the yaml includes relative paths to the other files, and checksums, where necessary, as well as some minimal metadata (title and description of the package) https://www.poseidon-adna.org/#/standard