Ejemplo n.º 1
0
    def manage_folders_reads(self, args):

        if (args.folders == None and args.reads == None and args.mreads == None):
            eprint("error: Either folders or reads must be set!")
            raise PSToolException("error: Either folders or reads must be set!")

        if args.folders != None:
            folders = args.folders
        else:
            folders = []

        if args.mreads != None:

            for mread in args.mreads:
                folders.append(mread)

        if args.reads != None:

            for readfolder in args.reads:

                # if downloads folder, then take the downloads folder + fail/pass plus any batch folder within
                downloadpath = os.path.join(readfolder, "downloads")
                if os.path.isdir(downloadpath):

                    for x in ['fail', 'skip', 'pass']:

                        if os.path.isdir(os.path.join(downloadpath, x)):

                            curfolder = os.path.join(downloadpath, x)

                            folders.append(curfolder)

                            all_subdirs = self._getsubdirs(curfolder)

                            for x in all_subdirs:

                                if x.startswith("batch"):
                                    folders.append(os.path.join(curfolder, x))


                else:

                    for x in os.walk(readfolder):
                        eprint("Adding path: " + x[0])

                        folders.append(x[0])

        return folders
Ejemplo n.º 2
0
    def exec(self):

        iStart = time.time()
        inputs = self.prepareInputs(self.args)
        environment = self.prepareEnvironment(self.args)

        ll = MapReduce(8)
        result = ll.exec( inputs, self.execParallel, environment, self.chunkSize, self.joinParallel)

        iEnd = time.time()
        eprint("Making Results: " + str(time.strftime('%H:%M:%S [HH:MM:SS]', time.gmtime(iEnd - iStart))))

        self.makeResults(result, environment, self.args)
        iEnd = time.time()

        eprint("Execution Time: " + str(time.strftime('%H:%M:%S [HH:MM:SS]', time.gmtime(iEnd-iStart))))
Ejemplo n.º 3
0
                                          'alignment_stat'),
        SimilarityAnalysisFactory(parser, subparsers, 'similarity'),
        ReportFactory(parser, subparsers, 'summary'),
        FoldChangeDistributionFactory(parser, subparsers, 'foldchange'),
        FoldChangeFeatureCountsDistributionFactory(parser, subparsers,
                                                   'foldchange_fc'),
        ReportFactory(parser, subparsers, 'timeline'),
        FoldChangeSimilarityFactory(parser, subparsers, 'fcdist'),
        FoldChangeTopRegulatedFactory(parser, subparsers, 'topreg'),
        SecondaryAlignmentAnalysisFactory(parser, subparsers, 'sec_alignments')
    ]

    for tool in allTools:
        cmd2tool[tool.which] = tool

    args = parser.parse_args()

    if not 'func' in vars(args):
        parser.print_help()
    else:

        try:
            calcObj = args.func(args)
            calcObj.exec()

        except PSToolException as e:
            eprint(e)

            if args.which:
                cmd2tool[args.which].print_usage()