예제 #1
0
    def testSessionPath(self):
        tests = [("archive", "D_1000000000", "session_test/12345")]
        for (fs, dataSetId, session_dir) in tests:
            logger.debug("File source %s dataSetId %s  session dir %s" % (fs, dataSetId, session_dir))

            fileSource = ("session", "wf-session", "session-download")
            for fs in fileSource:
                pI = PathInfo(siteId=self.__siteId, sessionPath=session_dir)
                fp = pI.getDirPath(dataSetId=dataSetId, fileSource=fs)
                logger.debug("session path %s" % fp)
                self.assertIsNotNone(fp, "Failed to get session path")
예제 #2
0
    def testGetStandardPaths(self):
        """Test getting standard file names within session paths."""
        ok = True
        # fileSource, id, partionId, versionId
        tests = [
            ("archive", "D_1000000000", None, 1, "latest"),
            ("archive", "D_1000000000", None, "latest", "latest"),
            ("archive", "D_1000000000", None, "next", "latest"),
            ("archive", "D_1000000000", None, "previous", "latest"),
            ("deposit", "D_1000000000", None, 1, "latest"),
        ]
        eId = "1"
        for (fs, dataSetId, wfInst, pId, vId) in tests:
            logger.debug("File source %s dataSetId %s  partno  %s wfInst %s version %s" % (fs, dataSetId, pId, wfInst, vId))

            pI = PathInfo(siteId=self.__siteId)
            pI.setDebugFlag(False)
            #
            fp = pI.getModelPdbxFilePath(dataSetId, wfInstanceId=wfInst, fileSource=fs, versionId=vId)
            logger.debug("Model path (PDBx):   %s" % fp)
            self.assertIsNotNone(fp, "Failed to find model file - default")

            fp = pI.getModelPdbxFilePath(dataSetId, wfInstanceId=wfInst, fileSource=fs, versionId=vId, mileStone="deposit")
            logger.debug("Model path (deposit) (PDBx):   %s" % fp)
            self.assertIsNotNone(fp, "Failed to find model file - deposit")

            fp = pI.getModelPdbxFilePath(dataSetId, wfInstanceId=wfInst, fileSource=fs, versionId=vId, mileStone="upload")
            logger.debug("Model path (upload) (PDBx):   %s" % fp)
            self.assertIsNotNone(fp, "Failed to find model file - upload")

            fp = pI.getModelPdbFilePath(dataSetId, wfInstanceId=wfInst, fileSource=fs, versionId=vId)
            logger.debug("Model path (PDB):    %s" % fp)
            self.assertIsNotNone(fp, "Failed to find PDB model file")

            fp = pI.getStructureFactorsPdbxFilePath(dataSetId, wfInstanceId=wfInst, fileSource=fs, versionId=vId)
            logger.debug("SF path (pdbx):    %s" % fp)
            self.assertIsNotNone(fp, "Failed to find SF file")

            fp = pI.getPolyLinkFilePath(dataSetId, wfInstanceId=wfInst, fileSource=fs, versionId=vId)
            logger.debug("Link dist  (PDBx):   %s" % fp)
            self.assertIsNotNone(fp, "Failed to find PDBx model file")

            fp = pI.getPolyLinkReportFilePath(dataSetId, wfInstanceId=wfInst, fileSource=fs, versionId=vId)
            logger.debug("Link Report dist  (PDBx):   %s" % fp)
            self.assertIsNotNone(fp, "Failed to find link report file")

            fp = pI.getSequenceStatsFilePath(dataSetId, wfInstanceId=wfInst, fileSource=fs, versionId=vId)
            logger.debug("Sequence stats (PIC):   %s" % fp)
            self.assertIsNotNone(fp, "Failed to find sequence stats file")

            fp = pI.getSequenceAlignFilePath(dataSetId, wfInstanceId=wfInst, fileSource=fs, versionId=vId)
            logger.debug("Sequence align (PIC):   %s" % fp)
            self.assertIsNotNone(fp, "Failed to find sequence align file")

            fp = pI.getReferenceSequenceFilePath(dataSetId, entityId=eId, wfInstanceId=wfInst, fileSource=fs, versionId=vId)
            logger.debug("Reference match entity %s (PDBx):   %s" % (eId, fp))
            self.assertIsNotNone(fp, "Failed to find reference sequence file")

            fp = pI.getSequenceAssignmentFilePath(dataSetId, wfInstanceId=wfInst, fileSource=fs, versionId=vId)
            logger.debug("Sequence assignment (PDBx):   %s" % fp)
            self.assertIsNotNone(fp, "Failed to find sequence assignment")

            fp = pI.getAssemblyAssignmentFilePath(dataSetId, wfInstanceId=wfInst, fileSource=fs, versionId=vId)
            logger.debug("Assembly assignment (PDBx):   %s" % fp)
            self.assertIsNotNone(fp, "Failed to find assembly assignment")

            fp = pI.getBlastMatchFilePath(dataSetId, wfInstanceId=wfInst, fileSource=fs, versionId=vId)
            logger.debug("Blast match (xml):   %s" % fp)
            self.assertIsNotNone(fp, "Failed to find blast match file")

            fp = pI.getFilePath(dataSetId, wfInstanceId=wfInst, contentType="seqdb-match", formatType="pdbx", fileSource=fs, versionId=vId, partNumber=pId, mileStone=None)
            logger.debug("Sequence match (getFilePath) (PDBx):   %s" % fp)
            self.assertIsNotNone(fp, "Failed to find seq-db match")
            #
            fp = pI.getFilePathContentTypeTemplate(dataSetId, wfInstanceId=wfInst, contentType="model", fileSource=fs)
            logger.debug("Model template:   %s" % fp)
            self.assertIsNotNone(fp, "Failed to find model template")

            fp = pI.getArchivePath(dataSetId)
            logger.debug("getArchivePath (PDBx):   %s" % fp)
            self.assertIsNotNone(fp, "Failed to find dir path")

            fp = pI.getDepositPath(dataSetId)
            logger.debug("getDepositPath (PDBx):   %s" % fp)
            self.assertIsNotNone(fp, "Failed to find deposit path")

            fp = pI.getInstancePath(dataSetId, wfInstanceId="W_099")
            logger.debug("getWfInstancePath (PDBx):   %s" % fp)
            self.assertIsNotNone(fp, "Failed to find wf instance path")

            fp = pI.getInstanceTopPath(
                dataSetId,
            )
            logger.debug("getWfInstanceTopPath (PDBx):   %s" % fp)
            self.assertIsNotNone(fp, "Failed to find wf Top instance path")

            fp = pI.getTempDepPath(dataSetId)
            logger.debug("getTempDepPath):   %s" % fp)
            self.assertIsNotNone(fp, "Failed to find TempDep path")
            #
            fp = pI.getDirPath(dataSetId, wfInstanceId=wfInst, fileSource=fs, versionId=vId, partNumber=pId, mileStone=None)
            logger.debug("Sequence match (getDirPath) (PDBx):   %s" % fp)
            self.assertIsNotNone(fp, "Failed to find dir path")

            ft = pI.getFilePathVersionTemplate(dataSetId, wfInstanceId=wfInst, contentType="em-volume", formatType="map", fileSource="archive", partNumber=pId, mileStone=None)
            logger.debug("EM volume version template:   %r" % ft)
            ft = pI.getFilePathPartitionTemplate(dataSetId, wfInstanceId=wfInst, contentType="em-mask-volume", formatType="map", fileSource="archive", mileStone=None)
            logger.debug("EM mask partition template:   %r" % ft)
            self.assertIsNotNone(ft, "Failed to mask model file")

        self.assertEqual(ok, True)