def test_checkReferencePath(self): """Test checkReferencePath().""" refDir = "/mnt/secondary/Smrtanalysis/opt/smrtanalysis/common/" + \ "references" refPath = path.join(refDir, "lambda") refPath, refFastaOut, refSaOut, isWithinRepository, annotation = \ checkReferencePath(refPath) self.assertTrue(filecmp.cmp(refFastaOut, path.join(refPath, "sequence/lambda.fasta"))) self.assertTrue(filecmp.cmp(refSaOut, path.join(refPath, "sequence/lambda.fasta.sa"))) self.assertTrue(isWithinRepository) refpath, refFastaOut, refSaOut, isWithinRepository, annotation = \ checkReferencePath(refFastaOut) self.assertTrue(filecmp.cmp(refFastaOut, path.join(refPath, "sequence/lambda.fasta"))) self.assertTrue(filecmp.cmp(refSaOut, path.join(refPath, "sequence/lambda.fasta.sa"))) self.assertTrue(isWithinRepository) fastaFN = "{0}/data/ecoli.fasta".format(self.rootDir) refpath, refFastaOut, refSaOut, isWithinRepository, annotation = \ checkReferencePath(fastaFN) self.assertTrue(filecmp.cmp(refpath, refFastaOut)) self.assertIsNone(refSaOut) self.assertFalse(isWithinRepository) refPathWithAnnotation = "/mnt/secondary-siv/secondarytest/" + \ "testdata/BlasrTestData/pbalign/data/references/H1_6_Scal_6x/" _refPath, _refFaOut, _refSaOut, _isWithinRepository, annotation = \ checkReferencePath(refPathWithAnnotation) self.assertEqual(path.abspath(annotation), path.abspath(path.join(refPathWithAnnotation, "annotations/H1_6_Scal_6x_adapters.gff")))
def SetReferencePath(self, referencePath): """Validate the user-specified referencePath and get the absolute and expanded path for referencePath, targetFileName and sawriterFileName. targetFileName is the target reference FASTA file to be used by an aligner. sawriterFileName is the reference sawriter file that can be used by an aligner (e.g. blasr), its value can be None if absent. """ if referencePath is not None and referencePath != "": (self.referencePath, self.targetFileName, self.sawriterFileName, self.isWithinRepository, self.adapterGffFileName) = \ checkReferencePath(referencePath)