diff --git a/README.md b/README.md index cf2a83f..146b031 100644 --- a/README.md +++ b/README.md @@ -3,3 +3,7 @@ ## Introduction Causal-cmd is a Java application that provides a Command-Line Interface (CLI) tool for causal discovery algorithms produced by the [Center for Causal Discovery](http://www.ccd.pitt.edu/). The documentation can be found here [https://bd2kccd.github.io/docs/causal-cmd/](https://bd2kccd.github.io/docs/causal-cmd/) + +Public builds are available here: + +https://s01.oss.sonatype.org/content/repositories/releases/io/github/cmu-phil/causal-cmd/ diff --git a/pom.xml b/pom.xml index 3144d48..cf6a934 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 edu.pitt.dbmi causal-cmd - 1.4.2 + 1.5.0 jar @@ -21,7 +21,7 @@ io.github.cmu-phil tetrad-lib - 7.1.2-2 + 7.1.3-1 org.slf4j @@ -45,7 +45,7 @@ org.junit.jupiter junit-jupiter-engine - 5.9.1 + 5.9.2 test diff --git a/src/main/java/edu/pitt/dbmi/causal/cmd/data/DataFiles.java b/src/main/java/edu/pitt/dbmi/causal/cmd/data/DataFiles.java index ef21097..8248cb1 100644 --- a/src/main/java/edu/pitt/dbmi/causal/cmd/data/DataFiles.java +++ b/src/main/java/edu/pitt/dbmi/causal/cmd/data/DataFiles.java @@ -22,7 +22,7 @@ import edu.cmu.tetrad.data.DataType; import edu.cmu.tetrad.data.DataUtils; import edu.cmu.tetrad.data.DelimiterType; -import edu.cmu.tetrad.data.IKnowledge; +import edu.cmu.tetrad.data.Knowledge; import edu.cmu.tetrad.util.DataConvertUtils; import edu.pitt.dbmi.causal.cmd.AlgorithmRunException; import edu.pitt.dbmi.causal.cmd.CmdArgs; @@ -99,13 +99,13 @@ public static Metadata readInMetadata(CmdArgs cmdArgs, PrintStream out) throws I * @return knowledge information from file * @throws IOException when errors occur during reading file */ - public static IKnowledge readInKnowledge(CmdArgs cmdArgs, PrintStream out) throws IOException { + public static Knowledge readInKnowledge(CmdArgs cmdArgs, PrintStream out) throws IOException { Path file = cmdArgs.getKnowledgeFile(); if (file == null) { return null; } else { LogMessages.readingFileStart(file, LOGGER, out); - IKnowledge knowledge = DataUtils.loadKnowledge(file.toFile(), DelimiterType.WHITESPACE, "//"); + Knowledge knowledge = DataUtils.loadKnowledge(file.toFile(), DelimiterType.WHITESPACE, "//"); LogMessages.readingFileEnd(file, LOGGER, out); return knowledge; diff --git a/src/main/java/edu/pitt/dbmi/causal/cmd/tetrad/TetradRunner.java b/src/main/java/edu/pitt/dbmi/causal/cmd/tetrad/TetradRunner.java index 9284dc1..43943f3 100644 --- a/src/main/java/edu/pitt/dbmi/causal/cmd/tetrad/TetradRunner.java +++ b/src/main/java/edu/pitt/dbmi/causal/cmd/tetrad/TetradRunner.java @@ -26,7 +26,7 @@ import edu.cmu.tetrad.data.DataModel; import edu.cmu.tetrad.data.DataSet; import edu.cmu.tetrad.data.ICovarianceMatrix; -import edu.cmu.tetrad.data.IKnowledge; +import edu.cmu.tetrad.data.Knowledge; import edu.cmu.tetrad.graph.Dag; import edu.cmu.tetrad.graph.Graph; import edu.cmu.tetrad.graph.GraphUtils; @@ -87,7 +87,7 @@ public TetradRunner(CmdArgs cmdArgs) { public void runAlgorithm(PrintStream out) throws AlgorithmRunException, IOException { final List dataModels = DataFiles.readInDatasets(cmdArgs, out); final Algorithm algorithm = getAlgorithm(cmdArgs); - final IKnowledge knowledge = DataFiles.readInKnowledge(cmdArgs, out); + final Knowledge knowledge = DataFiles.readInKnowledge(cmdArgs, out); final boolean acceptsKnowledge = TetradAlgorithms.getInstance().acceptKnowledge(cmdArgs.getAlgorithmClass()); final boolean hasKnowledge = !(knowledge == null || knowledge.getVariables().isEmpty()); diff --git a/src/test/java/edu/pitt/dbmi/causal/cmd/CausalCmdApplicationBootstrappingTest.java b/src/test/java/edu/pitt/dbmi/causal/cmd/CausalCmdApplicationBootstrappingTest.java new file mode 100644 index 0000000..eb8e14f --- /dev/null +++ b/src/test/java/edu/pitt/dbmi/causal/cmd/CausalCmdApplicationBootstrappingTest.java @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2019 University of Pittsburgh. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301 USA + */ +package edu.pitt.dbmi.causal.cmd; + +import java.io.IOException; +import java.nio.file.Path; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.io.TempDir; + +/** + * + * Jan 13, 2023 12:16:29 AM + * + * @author Kevin V. Bui (kvb2univpitt@gmail.com) + */ +public class CausalCmdApplicationBootstrappingTest { + + @TempDir + public static Path tempDir; + + @Test + public void testFgesBootstrappingWithContinuousData() throws IOException { + String dataset = TestFiles.CONTINUOUS_DATA; + String dirOut = TestFiles.createSubDir(tempDir, "fges_bootstrapping").toString(); + String[] args = { + "--dataset", dataset, + "--delimiter", "tab", + "--data-type", "continuous", + "--algorithm", "fges", + "--score", "ebic-score", + "--default", + "--prefix", "fges-bootstrapping", + "--numberResampling", "10", + "--percentResampleSize", "100", + "--seed", "1673588774198", + "--out", dirOut + }; + CausalCmdApplication.main(args); + } + +} diff --git a/src/test/java/edu/pitt/dbmi/causal/cmd/CausalCmdApplicationExperimentalTest.java b/src/test/java/edu/pitt/dbmi/causal/cmd/CausalCmdApplicationExperimentalTest.java new file mode 100644 index 0000000..5346889 --- /dev/null +++ b/src/test/java/edu/pitt/dbmi/causal/cmd/CausalCmdApplicationExperimentalTest.java @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2019 University of Pittsburgh. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301 USA + */ +package edu.pitt.dbmi.causal.cmd; + +import java.io.IOException; +import java.nio.file.Path; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.io.TempDir; + +/** + * + * Jan 21, 2023 9:52:10 PM + * + * @author Kevin V. Bui (kvb2univpitt@gmail.com) + */ +public class CausalCmdApplicationExperimentalTest { + + @TempDir + public static Path tempDir; + + @Test + public void testBossWithContinuousData() throws IOException { + String dataset = TestFiles.CONTINUOUS_DATA; + String dirOut = TestFiles.createSubDir(tempDir, "boss_experimental").toString(); + String[] args = { + "--dataset", dataset, + "--delimiter", "tab", + "--data-type", "continuous", + "--experimental", + "--algorithm", "boss", + "--score", "ebic-score", + "--test", "fisher-z-test", + "--default", + "--prefix", "boss-experimental", + "--out", dirOut + }; + CausalCmdApplication.main(args); + } + +}