def getOptionalArgs(): parser = argparse.ArgumentParser(add_help=False) optional = parser.add_argument_group('Optional arguments') optional.add_argument("--help", "-h", action="help", help="show this help message and exit") optional.add_argument( '--scaleFactorsMethod', help='Method to use to scale the samples. ' 'If a method is specified, then it will be used to compensate ' 'for sequencing depth differences between the samples. ' 'As an alternative, this can be set to None and an option from ' '--normalizeUsing <method> can be used. (Default: %(default)s)', choices=['readCount', 'SES', 'None'], default='readCount') optional.add_argument( '--sampleLength', '-l', help='*Only relevant when SES is chosen for the ' 'scaleFactorsMethod.* To compute the SES, specify ' 'the length (in bases) of the regions (see --numberOfSamples) ' 'that will be randomly sampled to calculate the scaling factors. ' 'If you do not have a good sequencing depth for ' 'your samples consider increasing the sampling ' 'regions\' size to minimize the probability ' 'that zero-coverage regions are used. (Default: %(default)s)', default=1000, type=int) optional.add_argument( '--numberOfSamples', '-n', help='*Only relevant when SES is chosen for the ' 'scaleFactorsMethod.* Number of samplings taken ' 'from the genome to compute the scaling factors. (Default: %(default)s)', default=1e5, type=int) optional.add_argument( '--scaleFactors', help='Set this parameter manually to avoid the computation of ' 'scaleFactors. The format is scaleFactor1:scaleFactor2.' 'For example, --scaleFactor 0.7:1 will cause the first BAM file to' 'be multiplied by 0.7, while not scaling ' 'the second BAM file (multiplication with 1).', default=None, required=False) optional.add_argument( '--operation', help='The default is to output the log2 ratio of the ' 'two samples. The reciprocal ratio returns the ' 'the negative of the inverse of the ratio ' 'if the ratio is less than 0. The resulting ' 'values are interpreted as negative fold changes. ' 'Instead of performing a computation using both files, the scaled signal can ' 'alternatively be output for the first or second file using ' 'the \'--operation first\' or \'--operation second\'. (Default: %(default)s)', default='log2', choices=[ 'log2', 'ratio', 'subtract', 'add', 'mean', 'reciprocal_ratio', 'first', 'second' ], required=False) optional.add_argument( '--pseudocount', help='A small number to avoid x/0. Only useful ' 'together with --operation log2 or --operation ratio. ' 'You can specify different values as pseudocounts for ' 'the numerator and the denominator by providing two ' 'values (the first value is used as the numerator ' 'pseudocount and the second the denominator pseudocount). (Default: %(default)s)', default=[1], type=float, nargs='+', action=parserCommon.requiredLength(1, 2), required=False) optional.add_argument( '--skipZeroOverZero', help='Skip bins where BOTH BAM files lack coverage. ' 'This is determined BEFORE any applicable pseudocount ' 'is added.', action='store_true') return parser
def parse_arguments(args=None): parentParser = parserCommon.getParentArgParse() outputParser = parserCommon.output() dbParser = parserCommon.deepBlueOptionalArgs() parser = argparse.ArgumentParser( parents=[parentParser, outputParser, dbParser], formatter_class=argparse.ArgumentDefaultsHelpFormatter, description='This tool compares two bigWig files based on the number ' 'of mapped reads. To compare the bigWig files, the genome is ' 'partitioned into bins of equal size, then the number of reads found ' 'in each BAM file are counted per bin and finally a summary ' 'value is reported. This value can be the ratio of the number of reads' 'per bin, the log2 of the ratio, the sum or the difference.') # define the arguments parser.add_argument('--bigwig1', '-b1', metavar='Bigwig file', help='Bigwig file 1. Usually the file for the ' 'treatment.', required=True) parser.add_argument('--bigwig2', '-b2', metavar='Bigwig file', help='Bigwig file 2. Usually the file for the ' 'control.', required=True) parser.add_argument('--scaleFactors', help='Set this parameter to multipy the bigwig values ' 'by a constant. The format is ' 'scaleFactor1:scaleFactor2. ' 'For example 0.7:1 to scale the first bigwig file ' 'by 0.7 while not scaling the second bigwig file', default=None, required=False) parser.add_argument( '--pseudocount', help='A small number to avoid x/0. Only useful ' 'together with --operation log2 or --operation ratio. ' 'You can specify different values as pseudocounts for ' 'the numerator and the denominator by providing two ' 'values (the first value is used as the numerator ' 'pseudocount and the second the denominator pseudocount). (Default: %(default)s)', default=1, nargs='+', action=parserCommon.requiredLength(1, 2), type=float, required=False) parser.add_argument('--skipZeroOverZero', help='Skip bins where BOTH BAM files lack coverage. ' 'This is determined BEFORE any applicable pseudocount ' 'is added.', action='store_true') parser.add_argument( '--operation', help='The default is to output the log2ratio of the ' 'two samples. The reciprocal ratio returns the ' 'the negative of the inverse of the ratio ' 'if the ratio is less than 0. The resulting ' 'values are interpreted as negative fold changes. ' 'Instead of performing a ' 'computation using both files, the scaled signal can ' 'alternatively be output for the first or second file using ' 'the \'--operation first\' or \'--operation second\' (Default: %(default)s)', default='log2', choices=[ 'log2', 'ratio', 'subtract', 'add', 'mean', 'reciprocal_ratio', 'first', 'second' ], required=False) parser.add_argument( '--skipNonCoveredRegions', '--skipNAs', help= 'This parameter determines if non-covered regions (regions without a score) ' 'in the bigWig files should be skipped. The default is to treat those ' 'regions as having a value of zero. ' 'The decision to skip non-covered regions ' 'depends on the interpretation of the data. Non-covered regions ' 'in a bigWig file may represent repetitive regions that should ' 'be skipped. Alternatively, the interpretation of non-covered regions as ' 'zeros may be wrong and this option should be used ', action='store_true') return parser
def getOptionalArgs(): parser = argparse.ArgumentParser(add_help=False) optional = parser.add_argument_group('Optional arguments') optional.add_argument("--help", "-h", action="help", help="show this help message and exit") optional.add_argument('--scaleFactorsMethod', help='Method to use to scale the samples. ' 'If a method is specified, then it will be used to compensate ' 'for sequencing depth differences between the samples. ' 'As an alternative, this can be set to None and an option from ' '--normalizeUsing <method> can be used.', choices=['readCount', 'SES', 'None'], default='readCount') optional.add_argument('--sampleLength', '-l', help='*Only relevant when SES is chosen for the ' 'scaleFactorsMethod.* To compute the SES, specify ' 'the length (in bases) of the regions (see --numberOfSamples) ' 'that will be randomly sampled to calculate the scaling factors. ' 'If you do not have a good sequencing depth for ' 'your samples consider increasing the sampling ' 'regions\' size to minimize the probability ' 'that zero-coverage regions are used.', default=1000, type=int) optional.add_argument('--numberOfSamples', '-n', help='*Only relevant when SES is chosen for the ' 'scaleFactorsMethod.* Number of samplings taken ' 'from the genome to compute the scaling factors.', default=1e5, type=int) optional.add_argument('--scaleFactors', help='Set this parameter manually to avoid the computation of ' 'scaleFactors. The format is scaleFactor1:scaleFactor2.' 'For example, --scaleFactor 0.7:1 will cause the first BAM file to' 'be multiplied by 0.7, while not scaling ' 'the second BAM file (multiplication with 1).', default=None, required=False) optional.add_argument('--operation', help='The default is to output the log2 ratio of the ' 'two samples. The reciprocal ratio returns the ' 'the negative of the inverse of the ratio ' 'if the ratio is less than 0. The resulting ' 'values are interpreted as negative fold changes. ' 'Instead of performing a computation using both files, the scaled signal can ' 'alternatively be output for the first or second file using ' 'the \'--operation first\' or \'--operation second\'', default='log2', choices=['log2', 'ratio', 'subtract', 'add', 'mean', 'reciprocal_ratio', 'first', 'second'], required=False) optional.add_argument('--pseudocount', help='A small number to avoid x/0. Only useful ' 'together with --operation log2 or --operation ratio. ' 'You can specify different values as pseudocounts for ' 'the numerator and the denominator by providing two ' 'values (the first value is used as the numerator ' 'pseudocount and the second the denominator pseudocount).', default=[1], type=float, nargs='+', action=parserCommon.requiredLength(1, 2), required=False) optional.add_argument('--skipZeroOverZero', help='Skip bins where BOTH BAM files lack coverage. ' 'This is determined BEFORE any applicable pseudocount ' 'is added.', action='store_true') return parser