Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorportate batch of logging support changes #147

Merged
merged 59 commits into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
3fee991
Added Logging Support for Multiple Tools
Erikpav Jul 6, 2023
e002b29
Added Logging Support for BAMtoscIDX
Erikpav Jul 11, 2023
d5838e4
Added logging to 3 tools
Erikpav Jul 14, 2023
44a08c4
Added Logging Support to SortBAM
Erikpav Jul 17, 2023
d59fec5
Added Logging Support for FilterforPIPseq
Erikpav Jul 18, 2023
1958225
Added Logging to MergeHeatMap
Erikpav Jul 19, 2023
fee8205
Added Logging to ExpandBED
Erikpav Jul 22, 2023
52c0973
Added Logging to GFFtoBED
Erikpav Jul 22, 2023
af1f688
Added Logging to ExpandGFF and SortGFF
Erikpav Jul 24, 2023
563c0f8
Added Logging to LabelHeatMap
Erikpav Jul 25, 2023
b9e81a5
Added Logging to TwoColorHeatMap
Erikpav Jul 26, 2023
1372447
Added Logging to BEDPeakAlignToRef
Erikpav Jul 30, 2023
ebcf54d
Added Logging to SearchMotif and FASTAExtract
Erikpav Aug 1, 2023
940a1e3
Added Logging to ShiftCoord
Erikpav Aug 1, 2023
ed4454a
Added Logging to FilterBEDbyProximity
Erikpav Aug 2, 2023
ee89220
Removed unused imports
Erikpav Aug 2, 2023
5bfc364
Added Logging to RandomCoordinate
Erikpav Aug 15, 2023
3ff2111
Adding Logging to PEStats
Erikpav Sep 5, 2023
3617eca
Added Logging to SEStats
Erikpav Sep 5, 2023
0d6e49f
Added Logging to CrossCorrelation
Erikpav Sep 16, 2023
b970e86
bugfix BAM Format Converter logging
owlang Oct 17, 2023
de9f826
bugfix Peak Analysis tools
owlang Oct 17, 2023
4921c87
bugfix Figure Generation logging
owlang Oct 17, 2023
b575bea
bugfix BAM Manipulation logging (just FilterPIP)
owlang Oct 17, 2023
94763ec
bugfix Coordinate Manipulation logging
owlang Oct 17, 2023
7b122b9
fix tool group subcommand on BAM Format Converters
owlang Oct 20, 2023
0925f4c
bugfix Sequence Analysis logging
owlang Oct 27, 2023
6c3cd79
add logging to DNAShape tools (BED and FASTA)
owlang Oct 27, 2023
7d6a74b
add logging to RandomizeFASTA
owlang Oct 27, 2023
550de89
restructure SEStats tool and output
owlang Oct 29, 2023
106551a
bugfix BAM Statistics logging
owlang Oct 29, 2023
cb5af1a
add logging to BAMGenomeCorrelation
owlang Oct 29, 2023
496be9b
bugfix BAM Manipulation logging
owlang Oct 29, 2023
bcbea24
bugfix Peak Analysis logging
owlang Oct 31, 2023
da0bbf9
add logging to TileGenome
owlang Oct 31, 2023
6ebbd76
bugfix Figure Generation logging
owlang Nov 1, 2023
105cdfe
add logging to FourColorSequence
owlang Nov 1, 2023
ed34f6a
add logging to PlotComposite
owlang Nov 2, 2023
e4e327c
add logging to ThreeColorHeatMap
owlang Nov 7, 2023
e914914
add logging to ConvertBED/GFFChrNames
owlang Nov 7, 2023
48c1085
add logging to Gzip (de)compressFile tools
owlang Nov 8, 2023
fe25a96
add logging to MD5Checksum
owlang Nov 14, 2023
c01e628
add logging to ScalingFactor
owlang Nov 15, 2023
9bc550e
add logging to ScaleMatrix
owlang Nov 15, 2023
7702e97
Merge branch 'dev' into olivia-logging
owlang Nov 28, 2023
e2d6408
fix downstream merge bugs
owlang Nov 28, 2023
7f839e4
add missing Javadocs and tags
owlang Nov 28, 2023
88c4acf
standardize Exception handling in GUI Window class
owlang Nov 29, 2023
446a8b1
fix "seperate" typo to "separate"
owlang Nov 29, 2023
e7b7c56
rename objects to output_obj for consistency
owlang Nov 29, 2023
5a6c991
add GUI output BAM indexing commands to log
owlang Nov 29, 2023
3a8e6a9
bugfix roman to arabic directionality in log
owlang Nov 29, 2023
e3bc096
bugfix shift-coord boolean mixup
owlang Nov 29, 2023
5d86c5c
fix output filename construction to account for gzOutput
owlang Nov 29, 2023
4499e7e
consolidate redundant exception packages
owlang Nov 29, 2023
b0180d1
fix verbosity reporting of logging writeShell
owlang Nov 29, 2023
508c930
add logging to AggregateData
owlang Nov 29, 2023
a0a7f93
add template log support for not-implemented tools
owlang Nov 29, 2023
ae45363
add minor fixes discovered during testing
owlang Nov 29, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
/.gradle/
/build/
.metadata
.idea
.idea
2 changes: 1 addition & 1 deletion .project
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
</natures>
</projectDescription>
</projectDescription>
2 changes: 1 addition & 1 deletion gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -241,4 +241,4 @@ eval "set -- $(
tr '\n' ' '
)" '"$@"'

exec "$JAVACMD" "$@"
exec "$JAVACMD" "$@"
2 changes: 1 addition & 1 deletion gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,4 @@ exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal

:omega
:omega
1,000 changes: 1,000 additions & 0 deletions sacCer3_1000SITES_200bp.bed

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import java.io.File;
import java.io.IOException;
import java.io.PrintStream;

import scriptmanager.objects.ToolDescriptions;
import scriptmanager.util.ExtensionFileFilter;
Expand Down Expand Up @@ -115,11 +116,11 @@ private String validateInput() throws IOException {
}
//set default output filename
if(output==null && !stdout){
if(STRAND==0){ output = new File( bamFile.getName().split("\\.")[0] + "_READ1.bed" ); }
else if(STRAND==1){ output = new File( bamFile.getName().split("\\.")[0] + "_READ2.bed" ); }
else if(STRAND==2){ output = new File( bamFile.getName().split("\\.")[0] + "_COMBINED.bed" ); }
else if(STRAND==3){ output = new File( bamFile.getName().split("\\.")[0] + "_MIDPOINT.bed" ); }
else if(STRAND==4){ output = new File( bamFile.getName().split("\\.")[0] + "_FRAGMENT.bed" ); }
if (STRAND==0) { output = new File( ExtensionFileFilter.stripExtensionIgnoreGZ(bamFile) + "_READ1.bed" + (gzOutput ? ".gz" : "")); }
else if (STRAND==1) { output = new File( ExtensionFileFilter.stripExtensionIgnoreGZ(bamFile) + "_READ2.bed" + (gzOutput ? ".gz" : "")); }
else if (STRAND==2) { output = new File( ExtensionFileFilter.stripExtensionIgnoreGZ(bamFile) + "_COMBINED.bed" + (gzOutput ? ".gz" : "")); }
else if (STRAND==3) { output = new File( ExtensionFileFilter.stripExtensionIgnoreGZ(bamFile) + "_MIDPOINT.bed" + (gzOutput ? ".gz" : "")); }
else if (STRAND==4) { output = new File( ExtensionFileFilter.stripExtensionIgnoreGZ(bamFile) + "_FRAGMENT.bed" + (gzOutput ? ".gz" : "")); }
else { r += "(!)Somehow invalid STRAND!This error should never print. Check code if it does.\n"; }
//check stdout and output not both selected
}else if(stdout){
Expand All @@ -143,4 +144,27 @@ private String validateInput() throws IOException {

return(r);
}
public static String getCLIcommand(File BAM, File output, int strand, int pair, int min, int max) {
String command = "java -jar $SCRIPTMANAGER bam-format-converter bam-to-bed";
command += " " + BAM.getAbsolutePath();
command += " -o " + output.getAbsolutePath();
if (strand == 0) {
command += " -1 ";
} else if (strand == 1) {
command += " -2 ";
} else if (strand == 2) {
command += " -a ";
} else if (strand == 3 ) {
command += " -m ";
} else if (strand == 4) {
command += " -f ";
}
command += pair != 0 ? " -p" : "";
if (min != -9999) {
command += " -n " + min;
} else if (max != -9999) {
command += " -x " + max;
}
return command;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import java.io.File;
import java.io.IOException;
import java.io.PrintStream;

import scriptmanager.objects.ToolDescriptions;
import scriptmanager.util.ExtensionFileFilter;
Expand Down Expand Up @@ -115,11 +116,11 @@ private String validateInput() throws IOException {
}
//set default output filename
if(output==null && !stdout){
if(STRAND==0){ output = new File( bamFile.getName().split("\\.")[0] + "_READ1.gff" ); }
else if(STRAND==1){ output = new File( bamFile.getName().split("\\.")[0] + "_READ2.gff" ); }
else if(STRAND==2){ output = new File( bamFile.getName().split("\\.")[0] + "_COMBINED.gff" ); }
else if(STRAND==3){ output = new File( bamFile.getName().split("\\.")[0] + "_MIDPOINT.gff" ); }
else if(STRAND==4){ output = new File( bamFile.getName().split("\\.")[0] + "_FRAGMENT.gff" ); }
if (STRAND==0) { output = new File( ExtensionFileFilter.stripExtensionIgnoreGZ(bamFile) + "_READ1.gff" + (gzOutput ? ".gz" : "")); }
else if (STRAND==1) { output = new File( ExtensionFileFilter.stripExtensionIgnoreGZ(bamFile) + "_READ2.gff" + (gzOutput ? ".gz" : "")); }
else if (STRAND==2) { output = new File( ExtensionFileFilter.stripExtensionIgnoreGZ(bamFile) + "_COMBINED.gff" + (gzOutput ? ".gz" : "")); }
else if (STRAND==3) { output = new File( ExtensionFileFilter.stripExtensionIgnoreGZ(bamFile) + "_MIDPOINT.gff" + (gzOutput ? ".gz" : "")); }
else if (STRAND==4) { output = new File( ExtensionFileFilter.stripExtensionIgnoreGZ(bamFile) + "_FRAGMENT.gff" + (gzOutput ? ".gz" : "")); }
else { r += "(!)Somehow invalid STRAND!This error should never print. Check code if it does.\n"; }
//check stdout and output not both selected
}else if(stdout){
Expand All @@ -143,4 +144,27 @@ private String validateInput() throws IOException {

return(r);
}
public static String getCLIcommand(File BAM, File output, int strand, int pair, int min, int max) {
String command = "java -jar $SCRIPTMANAGER bam-format-converter bam-to-gff";
command += " " + BAM.getAbsolutePath();
command += " -o " + output.getAbsolutePath();
if (strand == 0) {
command += " -1 ";
} else if (strand == 1) {
command += " -2 ";
} else if (strand == 2) {
command += " -a ";
} else if (strand == 3 ) {
command += " -m ";
} else if (strand == 4) {
command += " -f ";
}
command += pair != 0 ? " -p" : "";
if (min != -9999) {
command += " -n " + min;
} else if (max != -9999) {
command += " -x " + max;
}
return command;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import java.io.File;
import java.io.IOException;
import java.io.PrintStream;

import scriptmanager.objects.ToolDescriptions;
import scriptmanager.util.ExtensionFileFilter;
Expand Down Expand Up @@ -138,4 +139,25 @@ private String validateInput() throws IOException {

return(r);
}
public static String getCLIcommand(File BAM, File output, int strand, int pair, int min, int max){
String command = "java -jar $SCRIPTMANAGER bam-format-converter bam-to-bedgraph";
command += " " + BAM.getAbsolutePath();
command += " -o " + output.getAbsolutePath();
if (strand == 0) {
command += " -1 ";
} else if (strand == 1) {
command += " -2 ";
} else if (strand == 2) {
command += " -a ";
} else if (strand == 3 ) {
command += " -m ";
}
command += pair != 0 ? " -p" : "";
if (min != -9999) {
command += " -n " + min;
} else if (max != -9999) {
command += " -x " + max;
}
return command;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import java.io.File;
import java.io.IOException;
import java.io.PrintStream;

import scriptmanager.objects.ToolDescriptions;
import scriptmanager.util.ExtensionFileFilter;
Expand Down Expand Up @@ -111,11 +112,11 @@ private String validateInput() throws IOException {
}
//set default output filename
if(output==null && !stdout){
if(STRAND==0){ output = new File( bamFile.getName().split("\\.")[0] + "_READ1.tab" ); }
else if(STRAND==1){ output = new File( bamFile.getName().split("\\.")[0] + "_READ2.tab" ); }
else if(STRAND==2){ output = new File( bamFile.getName().split("\\.")[0] + "_COMBINED.tab" ); }
else if(STRAND==3){ output = new File( bamFile.getName().split("\\.")[0] + "_MIDPOINT.tab" ); }
else if(STRAND==4){ output = new File( bamFile.getName().split("\\.")[0] + "_FRAGMENT.tab" ); }
if (STRAND==0) { output = new File( ExtensionFileFilter.stripExtensionIgnoreGZ(bamFile) + "_READ1.tab" + (gzOutput ? ".gz" : "")); }
else if (STRAND==1) { output = new File( ExtensionFileFilter.stripExtensionIgnoreGZ(bamFile) + "_READ2.tab" + (gzOutput ? ".gz" : "")); }
else if (STRAND==2) { output = new File( ExtensionFileFilter.stripExtensionIgnoreGZ(bamFile) + "_COMBINED.tab" + (gzOutput ? ".gz" : "")); }
else if (STRAND==3) { output = new File( ExtensionFileFilter.stripExtensionIgnoreGZ(bamFile) + "_MIDPOINT.tab" + (gzOutput ? ".gz" : "")); }
else if (STRAND==4) { output = new File( ExtensionFileFilter.stripExtensionIgnoreGZ(bamFile) + "_FRAGMENT.tab" + (gzOutput ? ".gz" : "")); }
else { r += "(!)Somehow invalid STRAND!This error should never print. Check code if it does.\n"; }
//check stdout and output not both selected
}else if(stdout){
Expand All @@ -136,7 +137,29 @@ private String validateInput() throws IOException {
if( MAX_INSERT<MIN_INSERT && MIN_INSERT!=-9999 && MAX_INSERT!=-9999){ r += "MAX_INSERT must be larger/equal to MIN_INSERT: " + MIN_INSERT + "," + MAX_INSERT + "\n"; }
// turn pair status boolean into int
PAIR = matePair ? 1 : 0;

return(r);
}
public static String getCLIcommand(File BAM, File output, int strand, int pair, int min, int max) {
String command = "java -jar $SCRIPTMANAGER bam-format-converter bam-to-scidx";
System.out.println(output);
System.out.println(BAM);
command += " " + BAM.getAbsolutePath();
command += " -o " + output.getAbsolutePath();
if (strand == 0) {
command += " -1 ";
} else if (strand == 1) {
command += " -2 ";
} else if (strand == 2) {
command += " -a ";
} else if (strand == 3 ) {
command += " -m ";
}
command += pair != 0 ? " -p" : "";
if (min != -9999) {
command += " -n " + min;
} else if (max != -9999) {
command += " -x " + max;
}
return command;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import picocli.CommandLine.Command;

import java.util.concurrent.Callable;
import java.io.File;

import scriptmanager.objects.ToolDescriptions;

Expand Down Expand Up @@ -37,4 +38,18 @@ public Integer call() throws Exception {
System.exit(1);
return(1);
}

/**
* Reconstruct CLI command
*
* @param input the BAM file to index
* @return command line to execute with formatted inputs
*/
public static String getCLIcommand(File input) {
String command = "java -jar $PICARD BuildBamIndex";
command += " INPUT=" + input.getAbsolutePath();
command += " OUTPUT=" + input.getAbsolutePath() + ".bai";
return command;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@
exitCodeOnExecutionException = 1)
public class BAMRemoveDupCLI implements Callable<Integer> {

/**
* Creates a new BAMRemoveDupCLI object
*/
public BAMRemoveDupCLI(){}

/**
* Runs when this subcommand is called, running script in respective script package with user defined arguments
* @throws IOException Invalid file or parameters
Expand All @@ -44,19 +39,21 @@ public Integer call() throws Exception {
}

/**
* Returns picard command for generating running MarkDuplicates
* @param BAM BAM file ot be marked
* @param removeDuplicates If duplicate reads should be removed
* @param OUTPUT Ouput BAM file
* @param METRICS .metricts file for outputting stats
* @return Picard command for running MarkDuplicates
* Reconstruct CLI command (Picard)
*
* @param input the BAM file to mark/remove duplicates for
* @param removeDuplicates whether to remove or just mark duplicates
* @param output the marked/filtered BAM output file
* @param metrics the output metrics file with information about the
* deduplicates
* @return command line to execute with formatted inputs
*/
public static String getCLIcommand(File BAM, boolean removeDuplicates, File OUTPUT, File METRICS) {
public static String getCLIcommand(File input, boolean removeDuplicates, File output, File metrics) {
String command = "java -jar $PICARD MarkDuplicates";
command += " INPUT=" + BAM.getAbsolutePath();
command += " OUTPUT=" + OUTPUT.getAbsolutePath();
command += " METRICS_FILE=" + METRICS.getAbsolutePath();
command += removeDuplicates ? "REMOVE_DUPLICATES=true" : "REMOVE_DUPLICATES=false";
command += " INPUT=" + input.getAbsolutePath();
command += " OUTPUT=" + output.getAbsolutePath();
command += " METRICS_FILE=" + metrics.getAbsolutePath();
command += removeDuplicates ? " REMOVE_DUPLICATES=true" : " REMOVE_DUPLICATES=false";
return(command);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,22 @@ private String validateInput() throws IOException {

return (r);
}

/**
* Reconstruct CLI command
*
* @param BAM the BAM file to filter
* @param GENOME the genomic FASTA reference file (should match BAM header)
* @param OUTPUT the output BAM file
* @param txtSeq the IUPAC string to filter by
* @return command line to execute with formatted inputs
*/
public static String getCLIcommand(File BAM, File GENOME, File OUTPUT, String txtSeq) {
String command = "java -jar $SCRIPTMANAGER bam-manipulation filter-pip-seq";
command += " " + GENOME.getAbsolutePath();
command += " " + BAM.getAbsolutePath();
command += " -o " + OUTPUT.getAbsolutePath();
command += " -f " + txtSeq;
return command;
}
}
23 changes: 23 additions & 0 deletions src/main/java/scriptmanager/cli/BAM_Manipulation/MergeBAMCLI.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

import picocli.CommandLine.Command;

import java.util.ArrayList;
import java.util.concurrent.Callable;
import java.io.File;

import scriptmanager.objects.ToolDescriptions;

Expand Down Expand Up @@ -38,4 +40,25 @@ public Integer call() throws Exception {
System.exit(1);
return(1);
}

/**
* Reconstruct CLI command
*
* @param inputs the list of input BAM files to merge (corresponds to
* several INPUT values)
* @param output the output file for the merged BAM file (corresponds
* to OUTPUT)
* @param useMultipleCpus whether or not to parallelize (corresponds to
* USE_THREADING)
* @return command line to execute with formatted inputs
*/
public static String getCLIcommand(ArrayList<File> inputs, File output, boolean useMultipleCpus) {
String command = "java -jar $PICARD MergeSamFiles";
for (File in : inputs) {
command += " INPUT=" + in.getAbsolutePath();
}
command += " OUTPUT=" + output.getAbsolutePath();
command += useMultipleCpus ? " USE_THREADING=true" : " USE_THREADING=false";
return command;
}
}
19 changes: 19 additions & 0 deletions src/main/java/scriptmanager/cli/BAM_Manipulation/SortBAMCLI.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
import java.io.IOException;
import java.util.concurrent.Callable;

import htsjdk.samtools.SAMFileHeader;

import java.io.File;

import scriptmanager.objects.ToolDescriptions;

/**
Expand Down Expand Up @@ -33,4 +37,19 @@ public Integer call() throws Exception {
System.exit(1);
return(1);
}

/**
* Reconstruct CLI command
*
* @param input the BAM file to be sorted (corresponds to INPUT)
* @param output the file to write the sorted BAM to (corresponds to OUTPUT)
* @return command line to execute with formatted inputs
*/
public static String getCLIcommand(File input, File output) {
String command = "java -jar $PICARD SortSam";
command += " INPUT=" + input.getAbsolutePath();
command += " OUTPUT=" + output.getAbsolutePath();
command += " SORT_ORDER=" + SAMFileHeader.SortOrder.coordinate;
return(command);
}
}
Loading
Loading