1313
1414from os import path
1515import logging
16- import numpy as np
17- from scipy import stats
1816import nanoplot .utils as utils
19- import nanoplot .report as report
20- from nanoget import get_input
21- from nanoplot .filteroptions import filter_and_transform_data
2217from nanoplot .version import __version__
23- from nanoplotter .plot import Plot
24- import nanoplotter
25- import nanomath
26- import pickle
2718import sys
2819
2920
@@ -36,10 +27,15 @@ def main():
3627 """
3728 settings , args = utils .get_args ()
3829 try :
30+ import nanoplot .report as report
31+ from nanoget import get_input
32+ from nanoplot .filteroptions import filter_and_transform_data
33+ from nanoplotter .plot import Plot
3934 utils .make_output_dir (args .outdir )
4035 utils .init_logs (args )
4136 # args.format = nanoplotter.check_valid_format(args.format)
4237 if args .pickle :
38+ import pickle
4339 datadf = pickle .load (open (args .pickle , "rb" ))
4440 elif args .feather :
4541 from nanoget import combine_dfs
@@ -121,6 +117,7 @@ def main():
121117
122118
123119def make_stats (datadf , settings , suffix , tsv_stats = True ):
120+ import nanomath
124121 statsfile = settings ["path" ] + "NanoStats" + suffix + ".txt"
125122 stats_df = nanomath .write_stats (datadfs = [datadf ], outputfile = statsfile , as_tsv = tsv_stats )
126123 logging .info ("Calculated statistics" )
@@ -141,6 +138,10 @@ def make_plots(datadf, settings):
141138 Call plotting functions from nanoplotter
142139 settings["lengths_pointer"] is a column in the DataFrame specifying which lengths to use
143140 """
141+ import numpy as np
142+ from scipy import stats
143+ import nanoplotter
144+ import nanomath
144145 color = nanoplotter .check_valid_color (settings ["color" ])
145146 colormap = nanoplotter .check_valid_colormap (settings ["colormap" ])
146147
@@ -381,6 +382,7 @@ def make_report(plots, settings):
381382 which is parsed to a table (rather dodgy) or nicely if it's a pandas/tsv
382383 """
383384 logging .info ("Writing html report." )
385+ from nanoplot import report
384386
385387 html_content = [
386388 '<body class="grid">' ,
0 commit comments