Tests on arguments not performed when using Python API
dputhier opened this issue · 3 comments
dputhier commented
When using the code below file formats (and more) are not tested as these tests are embedded in the argument parser...
from pygtftk.plugins.ologram import ologram
ologram(
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
)
dputhier commented
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)
dputhier commented
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)
dputhier commented
Note that VERBOSITY is normally controlled by the main parser (the parser below behaving normally as a sub_parser).