Closed dputhier closed 3 years ago
Here is another solution. Maybe not totally convincing. However its ensure that all arguments are tested by the parser dedicated classes (e.g. arg_formatter.FormattedFile())
from pygtftk.plugins.ologram import ologram
from pygtftk.plugins.ologram import make_parser
myparser = make_parser()
args = myparser.parse_args(['--inputfile', "hg38_chr1.gtf.gz",
'--peak-file', "ENCFF112BHN_H3K4me3_chr1.bed",
'--chrom-info', "hg38_chr1.genome",
'--upstream', "1500",
'--downstream', "1500",
'--sort-features', "summed_bp_overlaps_pvalue"])
args = dict(args.__dict__)
ologram(**args)
Here is another solution with 8 threads and increased verbosity
from pygtftk.plugins.ologram import ologram
from pygtftk.plugins.ologram import make_parser
import pygtftk.utils
pygtftk.utils.VERBOSITY = 3
myparser = make_parser()
args = myparser.parse_args(['--inputfile', "hg38_chr1.gtf.gz",
'--peak-file', "ENCFF112BHN_H3K4me3_chr1.bed",
'--chrom-info', "hg38_chr1.genome",
'--upstream', "1500",
'--downstream', "1500",
'--sort-features', "summed_bp_overlaps_pvalue",
'--nb-threads', "8"])
args = dict(args.__dict__)
ologram(**args)
Note that VERBOSITY is normally controlled by the main parser (the parser below behaving normally as a sub_parser).
When using the code below file formats (and more) are not tested as these tests are embedded in the argument parser...