Skip to content

Commit

Permalink
Isolate .trm generation
Browse files Browse the repository at this point in the history
  • Loading branch information
endixk committed Jul 9, 2024
1 parent 6e96796 commit b7fe42a
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 39 deletions.
2 changes: 1 addition & 1 deletion src/pipeline/UFCGMainPipeline.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
@SuppressWarnings("restriction")
public class UFCGMainPipeline {
public static final String VERSION = "1.0.6";
public static final Boolean STABLE = true;
public static final Boolean STABLE = false;
public static final String RELEASE_DATE = "Jul 2024";
public static final String CITATION = " Kim, D., Gilchrist, C.L.M., Chun, J. & Steinegger, M. (2023)\n"
+ " UFCG: database of universal fungal core genes and pipeline for genome-wide phylogenetic analysis of fungi.\n"
Expand Down
79 changes: 41 additions & 38 deletions src/tree/TreeBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ public void jsonsToTree(int nThreads, PhylogenyTool tool) throws IOException{
ckp.log(6);
}
if(ckp.read() < 7) {
generateTrm();
replaceLabel(nThreads);
ckp.log(7);
}
Expand Down Expand Up @@ -949,41 +950,7 @@ void inferGeneTreesSynchronized(PhylogenyTool phylogenyTool, int nThreads) {
}
}

void calculateGsi() {

Prompt.print("Calculating Gene Support Indices (GSIs) from the gene trees...");

File ucgJsonDir = new File(ucgDirectory);
File[] tempUcgJsonFileList = ucgJsonDir.listFiles();

int genomeNum = 0;

assert tempUcgJsonFileList != null;
for (File jsonFile : tempUcgJsonFileList) {
if (jsonFile.getName().endsWith(".ucg")) {
genomeNum++;
}
}

// calculate GSI
BranchAnalysis branchAnalysis = new BranchAnalysis(new File(allGeneTreesFile));
String tmp = branchAnalysis.markTree(
new File(treeZzFileName),
false, true, -1, (100 - gsi_threshold) * genomeNum / 100);

try {
FileWriter stFW = new FileWriter(treeZzGsiFileName);
BufferedWriter stBW = new BufferedWriter(stFW);

stBW.append(tmp);

stBW.close();
stFW.close();

} catch (IOException e) {
ExceptionHandler.handle(e);
}

void generateTrm() {
// make trm file
JSONObject trmJson = new JSONObject();

Expand All @@ -992,7 +959,7 @@ void calculateGsi() {
BufferedReader br = new BufferedReader(fr);

String ucgNwk = br.readLine();

br.close();
trmJson.put("UFCG", ucgNwk);

Expand All @@ -1001,7 +968,7 @@ void calculateGsi() {
BufferedReader geneBR = new BufferedReader(geneFR);

String geneNwk = geneBR.readLine();

geneBR.close();
trmJson.put(ucg, geneNwk);
}
Expand Down Expand Up @@ -1036,7 +1003,7 @@ void calculateGsi() {
logBR.readLine();
}
}

logBR.close();
trmJson.put("list", listArray);

Expand All @@ -1050,6 +1017,42 @@ void calculateGsi() {
}
}

void calculateGsi() {

Prompt.print("Calculating Gene Support Indices (GSIs) from the gene trees...");

File ucgJsonDir = new File(ucgDirectory);
File[] tempUcgJsonFileList = ucgJsonDir.listFiles();

int genomeNum = 0;

assert tempUcgJsonFileList != null;
for (File jsonFile : tempUcgJsonFileList) {
if (jsonFile.getName().endsWith(".ucg")) {
genomeNum++;
}
}

// calculate GSI
BranchAnalysis branchAnalysis = new BranchAnalysis(new File(allGeneTreesFile));
String tmp = branchAnalysis.markTree(
new File(treeZzFileName),
false, true, -1, (100 - gsi_threshold) * genomeNum / 100);

try {
FileWriter stFW = new FileWriter(treeZzGsiFileName);
BufferedWriter stBW = new BufferedWriter(stFW);

stBW.append(tmp);

stBW.close();
stFW.close();

} catch (IOException e) {
ExceptionHandler.handle(e);
}
}

/*
void sedReplace(String src, String dst, Map<String, String> map) {
for(String key : map.keySet()) {
Expand Down

0 comments on commit b7fe42a

Please sign in to comment.