Skip to content

Commit

Permalink
Some code grooming
Browse files Browse the repository at this point in the history
  • Loading branch information
mikessh committed Apr 6, 2015
1 parent 60043c2 commit 46f017c
Show file tree
Hide file tree
Showing 12 changed files with 35 additions and 44 deletions.
5 changes: 3 additions & 2 deletions src/main/groovy/com/antigenomics/vdjtools/VdjTools.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -166,17 +166,18 @@ else {
} catch (Exception e) {
println "[ERROR] $e.message, see _vdjtools_error.log for details"
new File("_vdjtools_error.log").withWriterAppend { writer ->
writer.println("[${new Date()}]")
writer.println("[${new Date()} BEGIN]")
writer.println("[Script]")
writer.println(args[0])
writer.println("[CommandLine]")
writer.println("executing vdjtools-${version}.jar ${args.join(" ")}")
writer.println("[Message]")
writer.println(e.message)
writer.println(e.toString())
writer.println("[StackTrace-Short]")
writer.println(e.stackTrace.findAll { it.toString().contains("com.antigenomics.vdjtools") }.join("\n"))
writer.println("[StackTrace-Full]")
e.printStackTrace(new PrintWriter(writer))
writer.println("[END]")
}
System.exit(-1)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@
*/



package com.antigenomics.vdjtools.basic

import com.antigenomics.vdjtools.Software
import com.antigenomics.vdjtools.sample.Sample
import com.antigenomics.vdjtools.sample.SampleCollection
import com.antigenomics.vdjtools.sample.metadata.MetadataTable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

package com.antigenomics.vdjtools.basic

import com.antigenomics.vdjtools.Software
import com.antigenomics.vdjtools.sample.SampleCollection
import com.antigenomics.vdjtools.sample.metadata.MetadataTable
import com.antigenomics.vdjtools.util.RUtil
Expand Down Expand Up @@ -84,8 +83,8 @@ println "[${new Date()} $scriptName] ${sampleCollection.size()} samples loaded"

def segmentUsage = new SegmentUsage(sampleCollection, unweighted)

def outputPathV = formOutputPath(outputFilePrefix, "segments", unweighted ? "unwt" : "wt" ,"V"),
outputPathJ = formOutputPath(outputFilePrefix, "segments", unweighted ? "unwt" : "wt" ,"J")
def outputPathV = formOutputPath(outputFilePrefix, "segments", unweighted ? "unwt" : "wt", "V"),
outputPathJ = formOutputPath(outputFilePrefix, "segments", unweighted ? "unwt" : "wt", "J")
new File(outputPathV).withPrintWriter { pwV ->
new File(outputPathJ).withPrintWriter { pwJ ->
def header = "#$MetadataTable.SAMPLE_ID_COLUMN\t" + sampleCollection.metadataTable.columnHeader
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

package com.antigenomics.vdjtools.basic

import com.antigenomics.vdjtools.Software
import com.antigenomics.vdjtools.sample.Sample
import com.antigenomics.vdjtools.sample.SampleCollection
import com.antigenomics.vdjtools.sample.metadata.MetadataTable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import com.antigenomics.vdjtools.util.ExecUtil
* Class that represents Variable and Joining segment frequency (usage) vector and V-J pairing matrix
*/
public class SegmentUsage {
//This static field public but not final, and could be changed by malicious code or by accident from another package. The field could be made final to avoid this vulnerability.
public static boolean VERBOSE = true

private final Map<String, double[]> vSegmentUsage = new HashMap<>(),
Expand Down
28 changes: 14 additions & 14 deletions src/main/groovy/com/antigenomics/vdjtools/imgt/ImgtParser.groovy
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
/**
Copyright 2014 Mikhail Shugay (mikhail.shugay@gmail.com)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
/*
* Copyright 2013-2015 Mikhail Shugay (mikhail.shugay@gmail.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/


Expand Down
28 changes: 14 additions & 14 deletions src/main/groovy/com/antigenomics/vdjtools/imgt/Test.groovy
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
/**
Copyright 2014 Mikhail Shugay (mikhail.shugay@gmail.com)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
/*
* Copyright 2013-2015 Mikhail Shugay (mikhail.shugay@gmail.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.antigenomics.vdjtools.imgt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
* limitations under the License.
*/

// todo: UNTESTED

package com.antigenomics.vdjtools.operate

import com.antigenomics.vdjtools.Software
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import com.antigenomics.vdjtools.util.ExecUtil
* computes a set of overlap metrics
*/
public class Overlap {
//This static field public but not final, and could be changed by malicious code or by accident from another package. The field could be made final to avoid this vulnerability.
public static boolean VERBOSE = true

private final SamplePair samplePair
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import static com.antigenomics.vdjtools.overlap.OverlapMetric.*
* A helper class to compute various overlap metrics for joint overlap
*/
class OverlapEvaluator {
//This static field public but not final, and could be changed by malicious code or by accident from another package. The field could be made final to avoid this vulnerability.
public static boolean VERBOSE = true

private final JointSample jointSample
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

package com.antigenomics.vdjtools.preprocess

import com.antigenomics.vdjtools.overlap.OverlapType
import com.antigenomics.vdjtools.io.SampleFileConnection
import com.antigenomics.vdjtools.io.SampleWriter
import com.antigenomics.vdjtools.overlap.OverlapType
import com.antigenomics.vdjtools.sample.ClonotypeFilter
import com.antigenomics.vdjtools.sample.IntersectionClonotypeFilter
import com.antigenomics.vdjtools.sample.Sample
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
package com.antigenomics.vdjtools.sample;

public class BlankClonotypeFilter extends ClonotypeFilter {
//This static field public but not final, and could be changed by malicious code or by accident from another package. The field could be made final to avoid this vulnerability.
public static BlankClonotypeFilter INSTANCE = new BlankClonotypeFilter();
public static final BlankClonotypeFilter INSTANCE = new BlankClonotypeFilter();

private BlankClonotypeFilter() {
super(false);
Expand Down

0 comments on commit 46f017c

Please sign in to comment.