echo>&2 " project_dir DIR = the project directory."
echo>&2 " all_samples FILE = list of bam files, one file per line."
echo>&2 " ref_db FILE = reference multi-sequence FASTA file used for the alignments."
echo>&2 ""
echo>&2 " Optional:"
echo>&2 " -a db_ann FILE = database annotation."
echo>&2 " -l splits/ DIR = genome splits DIR for job parallelization (pre-processing)."
echo>&2 ""
echo>&2 "Note: Alternatively, use the '-l splits' option to call SNPs for specific species, contig regions (BED) or single positions (contig_id pos). Unlisted contigs/pos are skipped."
echo>&2 ""
}
required_parameter(){
echo>&2 ""
echo>&2 "ERROR: '$1' is a required parameter"
display_usage
exit 1
}
dir_missing(){
echo>&2 ""
echo>&2 "ERROR: '$1' no such file or directory"
display_usage
exit 1
}
db_missing(){
echo>&2 ""
echo>&2 "ERROR: No reference database or annotation file found!"
echo>&2 "ERROR: '$1' is not a file."
echo>&2 "SOLUTION: run getRefDB.sh or set up a custom database before running metaSNP caller"
display_usage
exit 1
}
make_dir(){
echo>&2 ""
echo>&2 "WARNING '$1' is not an initialized metaSNP project. Subdirectory '$(basename$2)' (output DIR) is missing."
echo>&2 "RUN:"
echo>&2 " mkdir $2"
echo>&2 ""
echo>&2 "Then rerun '$0$ARGA'"
echo>&2 ""
# display_usage
# mkdir $OUT_DIR
exit 1
}
# Parse args using getopt (instead of getopts) to allow arguments before options
ARGA=$@
ARGS=$(getopt -o l:a:d:h -n"$0"--"$@")
# reorganize arguments as returned by getopt
eval set--"$ARGS"
while true;do
case"$1"in
# Shift before to throw away option
# Shift after if option has a required positional argument
parser.add_argument('-b',metavar='FLOAT',type=float,help="Coverage breadth: Horizontal genome coverage percentage per sample per species",default=40.0)
parser.add_argument('-d',metavar='FLOAT',type=float,help="Coverage depth: Average vertical genome coverage per sample per species",default=5.0)
parser.add_argument('-m',metavar='INT',type=int,help="Minimum number of samples per species",default=2)
parser.add_argument('-c',metavar='FLOAT',type=float,help="FILTERING STEP II: minimum coverage per position per sample per species",default=5.0)
parser.add_argument('-p',metavar='FLOAT',type=float,help="FILTERING STEP II: required proportion of informative samples (coverage non-zero) per position",default=0.50)
# REQUIRED arguments:
parser.add_argument('percentage_file',help='input file with horizontal genome (taxon) coverage (breadth) per sample (percentage covered)',metavar='perc_FILE')
parser.add_argument('coverage_file',help='input file with average genome (taxon) coverage (depth) per sample (average number reads per site)',metavar='cov_FILE')
parser.add_argument('snp_files',nargs='+',help='input files from SNP calling',metavar='snp_FILE')
parser.add_argument('all_samples',help='list of input BAM files, one per line',metavar='all_samples')