Skip to content

Commit

Permalink
Merge pull request #82 from bd2kccd/development
Browse files Browse the repository at this point in the history
Update to Tetrad 7.1.3-1
  • Loading branch information
kvb2univpitt authored Jan 22, 2023
2 parents f4105de + 0477a02 commit 79b0442
Show file tree
Hide file tree
Showing 6 changed files with 125 additions and 8 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>edu.pitt.dbmi</groupId>
<artifactId>causal-cmd</artifactId>
<version>1.4.2</version>
<version>1.5.0</version>
<packaging>jar</packaging>

<properties>
Expand All @@ -21,7 +21,7 @@
<dependency>
<groupId>io.github.cmu-phil</groupId>
<artifactId>tetrad-lib</artifactId>
<version>7.1.2-2</version>
<version>7.1.3-1</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
Expand All @@ -45,7 +45,7 @@
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.9.1</version>
<version>5.9.2</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/edu/pitt/dbmi/causal/cmd/data/DataFiles.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -87,7 +87,7 @@ public TetradRunner(CmdArgs cmdArgs) {
public void runAlgorithm(PrintStream out) throws AlgorithmRunException, IOException {
final List<DataModel> 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());
Expand Down
Original file line number Diff line number Diff line change
@@ -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 ([email protected])
*/
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);
}

}
Original file line number Diff line number Diff line change
@@ -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 ([email protected])
*/
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);
}

}

0 comments on commit 79b0442

Please sign in to comment.