Skip to content
This repository was archived by the owner on Aug 6, 2021. It is now read-only.

Commit 5dac667

Browse files
koenkoen
authored andcommitted
GBSX v1.2
Code Clean-up Deleted demultiplex parameter -m
1 parent 05a8f6d commit 5dac667

File tree

10 files changed

+24
-77
lines changed

10 files changed

+24
-77
lines changed

README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ Possible Standard Enzymes for the info file: (NA is no enzyme)
190190
* `RBSTA`
191191
* `RBSCG`
192192
* `NspI`
193+
* `AvaII`
193194
* `NAN`
194195

195196

@@ -256,4 +257,12 @@ v1.1.3
256257
v1.1.4
257258
* Update adaptor ligase finding algorithm
258259
* Removed unneeded, confusing parameters -cc and -al
259-
* Removed unused code
260+
* Removed unused code
261+
262+
v1.1.5
263+
* Update digest (removed possible input file parsing error)
264+
* Updated Single Read Demultiplexing
265+
266+
v1.2
267+
* Deleted Demultiplexer option -m
268+
* Code Clean-up

src/be/uzleuven/gc/logistics/GBSX/GBSX.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
public class GBSX {
3636

3737
public static final boolean DEBUG = false;
38-
public final static String VERSION = "GBSX v1.1.5";
38+
public final static String VERSION = "GBSX v1.2";
3939
private final static String LICENCE = "GPLv3";
4040

4141
/**

src/be/uzleuven/gc/logistics/GBSX/barcodeDiscovery/BarcodeDiscovery.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ public class BarcodeDiscovery {
5757
public static void main (String[] args){
5858
try{
5959
if (BarcodeDiscovery.DEBUG){
60-
// String input = "-help";
6160
String input ="-f1 /home/koen/Downloads/GBS_Example/dem/dem2/output.fastq";
6261
args = input.split(" ");
6362
}

src/be/uzleuven/gc/logistics/GBSX/demultiplexer/GBSdemultiplex.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
public class GBSdemultiplex {
3737

3838
public static final boolean DEBUG = false;
39-
public final static String VERSION = "GBSX v1.3";
39+
public final static String VERSION = "GBSX demultiplex v2";
4040
public final static String LICENCE = "GPLv3";
4141

4242
/*

src/be/uzleuven/gc/logistics/GBSX/demultiplexer/application/FastqDemultiplex.java

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,6 @@ private void processPairEndFastqFiles(){
376376
mostMismatches = sample.getBarcodeMismatches();
377377
}
378378
}
379-
//mostMismatches += this.parameters.getAllowedMismatchesEnzyme();
380379
statsFile.saveStats(mostMismatches, this.parameters.getOutputDirectory());
381380
this.correctionLog.writeToFile(this.parameters.getOutputDirectory());
382381
} catch (IOException ex) {
@@ -482,7 +481,6 @@ private void processSingleReadFastqFiles(){
482481
mostMismatches = sample.getBarcodeMismatches();
483482
}
484483
}
485-
//mostMismatches += this.parameters.getAllowedMismatchesEnzyme();
486484
statsFile.saveStats(mostMismatches, this.parameters.getOutputDirectory());
487485
} catch (IOException ex) {
488486
this.writeToLog("ERROR in reading the fastq files: " + ex.getMessage());
@@ -663,7 +661,6 @@ private ProcessedFragment parseFastqRead(FastqRead read1, FastqRead read2) throw
663661
read2optimalSequence = read2optimalSequence.substring(0, read1optimalSequence.length());
664662
read2optimalQuality = read2optimalQuality.substring(0, read1optimalSequence.length());
665663
trimedR2 = true;
666-
//sequenceError = "CORRECTED R2\n";
667664
this.correctionLog.addCorrecterR2Corrected(sample);
668665
}else{
669666
if (read1optimalSequence.length() + sample.getBarcode().length() + this.parameters.getAdaptorCompareSize() >= read1.getSequence().length()){
@@ -675,7 +672,6 @@ private ProcessedFragment parseFastqRead(FastqRead read1, FastqRead read2) throw
675672
this.correctionLog.addCorrecterR1Corrected(sample);
676673
}else{
677674
this.correctionLog.addCorrecterR2NotCorrected(sample);
678-
//sequenceError = "NOTCORRECT R2\n";
679675
}
680676
}
681677
}else{
@@ -686,7 +682,6 @@ private ProcessedFragment parseFastqRead(FastqRead read1, FastqRead read2) throw
686682
read2optimalQuality = read2optimalQuality.substring(0, read1optimalSequence.length());
687683
trimedR2 = true;
688684
this.correctionLog.addCorrecterR2Corrected(sample);
689-
//sequenceError = "CORRECTED R2\n";
690685
}else{
691686
if (read1optimalSequence.length() + sample.getBarcode().length() + this.parameters.getAdaptorCompareSize() + sample.getPossibleEnzymeCutSiteLength() + sample.getPossibleEnzymeCutSiteLength() >= read1.getSequence().length()){
692687
//read1 is only checked on cutsite, not on adaptor, not corrected so wrong
@@ -697,7 +692,6 @@ private ProcessedFragment parseFastqRead(FastqRead read1, FastqRead read2) throw
697692
this.correctionLog.addCorrecterR1Corrected(sample);
698693
}else{
699694
this.correctionLog.addCorrecterR2NotCorrected(sample);
700-
//sequenceError = "NOTCORRECT R2\n";
701695
}
702696
}
703697
}
@@ -714,10 +708,8 @@ private ProcessedFragment parseFastqRead(FastqRead read1, FastqRead read2) throw
714708
read1optimalQuality = read1optimalQuality.substring(0, read2optimalSequence.length());
715709
trimedR1 = true;
716710
this.correctionLog.addCorrecterR1Corrected(sample);
717-
//sequenceError = "CORRECTED R1\n";
718711
}else{
719712
this.correctionLog.addCorrecterR1NotCorrected(sample);
720-
//sequenceError = "NOTCORRECT R1\n";
721713
}
722714
}else{
723715
//not keep cutsites
@@ -726,10 +718,8 @@ private ProcessedFragment parseFastqRead(FastqRead read1, FastqRead read2) throw
726718
read1optimalQuality = read1optimalQuality.substring(0, read2optimalSequence.length());
727719
trimedR1 = true;
728720
this.correctionLog.addCorrecterR1Corrected(sample);
729-
//sequenceError = "CORRECTED R1\n";
730721
}else{
731722
this.correctionLog.addCorrecterR1NotCorrected(sample);
732-
//sequenceError = "NOTCORRECT R1\n";
733723
}
734724
}
735725
}
@@ -845,11 +835,8 @@ private ProcessedFragment parseFastqRead(FastqRead read1) throws InvalidReadExce
845835
//find the next enzyme site (if there is any)
846836
int read1EndLocation = -1;
847837
int[] read1EndLocationLength = {-1, 0};
848-
// EnzymeComparator enzymeComparator = new EnzymeComparator();
849-
// if (enzymeComparator.compare(sample.getEnzyme(), this.parameters.getNeutralEnzyme()) != 0){
850-
read1EndLocationLength = this.findRead1EnzymeLocation(read1modifiedSequence, sample);
851-
read1EndLocation = read1EndLocationLength[0];
852-
// }
838+
read1EndLocationLength = this.findRead1EnzymeLocation(read1modifiedSequence, sample);
839+
read1EndLocation = read1EndLocationLength[0];
853840
String read1optimalSequence = read1modifiedSequence;
854841
String read1optimalQuality = read1modifiedQuality;
855842
if (read1EndLocation != -1){
@@ -989,7 +976,7 @@ private int[] findRead2EnzymeLocation(String sequence, Sample sample, String fou
989976
if (extraAdaptorSearch > this.parameters.getCommonAdaptor().length()){
990977
extraAdaptorSearch = this.parameters.getCommonAdaptor().length();
991978
}
992-
// int extraAdaptorSearch = 4;
979+
993980
int[] place = {-1, 0};
994981
boolean searchMore = true;
995982
int posloc = -1;
@@ -1001,9 +988,7 @@ private int[] findRead2EnzymeLocation(String sequence, Sample sample, String fou
1001988
if (posplace[0] == -1){
1002989
//no index found
1003990
searchMore = false;
1004-
}else if (posloc + 1 + posplace[0] < sequence.length() - complementFoundEnzyme.length() - sample.getComplementBarcode().length()
1005-
// && posloc + 1 + posplace[0] + complementFoundEnzyme.length() + sample.getComplementBarcode().length() + extraAdaptorSearch < sequence.length()
1006-
){
991+
}else if (posloc + 1 + posplace[0] < sequence.length() - complementFoundEnzyme.length() - sample.getComplementBarcode().length()){
1007992
//if new found possible location is smaller then the maximum location
1008993
//and the the new found location + enzyme + barcode + extraAdaptor search is smaller than the length of the sequence
1009994
extraAdaptorSearch = this.parameters.getAdaptorCompareSize();
@@ -1040,21 +1025,12 @@ private int[] findRead2EnzymeLocation(String sequence, Sample sample, String fou
10401025
place[1] = complementFoundEnzyme.length();
10411026
if (place[0] == -1){
10421027
//find with no barcode
1043-
// int[] newplace = this.findingDistanceAlgorithm.indexOf(sequence.substring(sequence.length() - complementFoundEnzyme.length() - sample.getBarcode().length() - extraAdaptorSearch), complementFoundEnzyme, this.parameters.getAllowedMismatchesEnzyme());
10441028
int[] newplace = this.findingDistanceAlgorithm.indexOf(sequence.substring(sequence.length() - complementFoundEnzyme.length() - sample.getBarcode().length()), complementFoundEnzyme, this.parameters.getAllowedMismatchesEnzyme());
10451029

10461030
if (newplace[0] != -1){
1047-
// place[0] = (sequence.length() - complementFoundEnzyme.length() - sample.getBarcode().length() - extraAdaptorSearch + newplace[0]);
1048-
// if(this.findingDistanceAlgorithm.isEquivalent(sequence.substring(sequence.length() - sample.getBarcode().length() + newplace[0]), sample.getComplementBarcode().substring(0, sample.getBarcode().length() + complementFoundEnzyme.length() - newplace[0]), this.parameters.getAllowedMismatchesBarcode(sample))){
1049-
// place[0] = (sequence.length() - complementFoundEnzyme.length() - sample.getBarcode().length() + newplace[0]);
1050-
// }else{
1051-
// newplace[0] = -1;
1052-
// }
10531031
place[0] = (sequence.length() - complementFoundEnzyme.length() - sample.getBarcode().length() + newplace[0]);
10541032
}
10551033
else{
1056-
// if (newplace[0] == -1){
1057-
//find with part enzyme
10581034
for (int ei=0; ei < complementFoundEnzyme.length(); ei++){
10591035
newplace = this.findingDistanceAlgorithm.calculateEquivalentDistance(sequence.substring(sequence.length() - complementFoundEnzyme.length() + ei), complementFoundEnzyme.substring(0, complementFoundEnzyme.length() - ei), 0);
10601036
if (newplace[0] != -1){

src/be/uzleuven/gc/logistics/GBSX/demultiplexer/model/DemultiplexArguments.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,6 @@ public enum DemultiplexArguments implements Arguments{
7474
* Keep the enzyme cut sites
7575
*/
7676
KEEP_ENZYME_CUTSITES ("-kc"),
77-
/**
78-
* The allowed mismatches in a barcode, enzyme or combination
79-
* Optional
80-
*/
81-
ALLOWED_MISMATCHES ("-m"),
8277
/**
8378
* The used algorithm to search for mismatches
8479
*/

src/be/uzleuven/gc/logistics/GBSX/demultiplexer/model/DemultiplexParameters.java

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ public DemultiplexParameters(){
4444
this.arguments = new HashMap();
4545
//standard parameters
4646
this.arguments.put(DemultiplexArguments.OUTPUT_DIRECTORY, System.getProperty("user.dir"));
47-
this.arguments.put(DemultiplexArguments.ALLOWED_MISMATCHES, "1");
47+
this.arguments.put(DemultiplexArguments.ALLOWED_MISMATCHES_BARCODE, "1");
48+
this.arguments.put(DemultiplexArguments.ALLOWED_MISMATCHES_ENZYME, "1");
4849
this.arguments.put(DemultiplexArguments.START_BARCODE_DISTANCE, "0");
4950
this.arguments.put(DemultiplexArguments.COMPLETE_CHECK, "true");
5051
this.arguments.put(DemultiplexArguments.QUALITY_SCORE, FastqScores.ILLUMINA_1_8.getType());
@@ -163,10 +164,7 @@ public String getErrorRequiredParametersSet(){
163164
* @return int | the allowed mismatches for the barcode
164165
*/
165166
public int getAllowedMismatchesBarcode(){
166-
if (this.arguments.containsKey(DemultiplexArguments.ALLOWED_MISMATCHES_BARCODE)){
167-
return Integer.parseInt(this.arguments.get(DemultiplexArguments.ALLOWED_MISMATCHES_BARCODE));
168-
}
169-
return Integer.parseInt(this.arguments.get(DemultiplexArguments.ALLOWED_MISMATCHES));
167+
return Integer.parseInt(this.arguments.get(DemultiplexArguments.ALLOWED_MISMATCHES_BARCODE));
170168
}
171169

172170
/**
@@ -240,10 +238,7 @@ public boolean useLongFileNames(){
240238
* @return int | the allowed mismatches for the enzyme
241239
*/
242240
public int getAllowedMismatchesEnzyme(){
243-
if (this.arguments.containsKey(DemultiplexArguments.ALLOWED_MISMATCHES_ENZYME)){
244-
return Integer.parseInt(this.arguments.get(DemultiplexArguments.ALLOWED_MISMATCHES_ENZYME));
245-
}
246-
return Integer.parseInt(this.arguments.get(DemultiplexArguments.ALLOWED_MISMATCHES));
241+
return Integer.parseInt(this.arguments.get(DemultiplexArguments.ALLOWED_MISMATCHES_ENZYME));
247242
}
248243

249244
/**
@@ -556,7 +551,6 @@ public String getParametersHelp(){
556551
toHelp += "\t -lf \t use long file names (standard false) filename is standard the sample name, long file names is sample name _ barcode _ enzyme" + "\n";
557552
toHelp += "\t -rad \t if the data is rad data or not (-rad true for RAD data, -rad false for GBS data) standard false (GBS)" + "\n";
558553
toHelp += "\t -gzip \t the input and output are/must be gziped (.gz) (standard false: input and output are .fastq, if true this is .fastq.gz)" + "\n";
559-
toHelp += "\t -m \t the allowed mismatches in the barcodes + enzymes (standard this value is 1)" + "\n";
560554
toHelp += "\t -mb \t the allowed mismatches in the barcodes (overrides the option -m)" + "\n";
561555
toHelp += "\t -me \t the allowed mismatches in the enzymes (overrides the option -m)" + "\n";
562556
toHelp += "\t -minsl \t the minimum allowed length for the sequences (standard 0, rejected sequences are found in the stats for each sample in the rejected.count column. The sequences self are found untrimmed in the undetermined file.)" + "\n";

src/be/uzleuven/gc/logistics/GBSX/utils/fasta/infrastructure/FastaBufferedWriter.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public class FastaBufferedWriter {
3131
/**
3232
* creates a new FastaBufferedWriter of the given file.
3333
* @param file | the file that must be writen
34-
* @param zipped | true if the file must be zipped
34+
* @param ziped | true if the file must be zipped
3535
* @throws FileNotFoundException | if the given file isn't found
3636
* @throws IOException | if an error occures while opening the file
3737
*/
@@ -46,7 +46,7 @@ public FastaBufferedWriter(File file, boolean ziped) throws FileNotFoundExceptio
4646
/**
4747
* creates a new FastaBufferedWriter of the given file.
4848
* @param file | the file that must be writen
49-
* @param zipped | true if the file must be zipped
49+
* @param ziped | true if the file must be zipped
5050
* @param append | true if append to existing file
5151
* @throws FileNotFoundException | if the given file isn't found
5252
* @throws IOException | if an error occures while opening the file
@@ -62,7 +62,7 @@ public FastaBufferedWriter(File file, boolean ziped, boolean append) throws File
6262
/**
6363
* creates a new FastaBufferedReader of the given URL.
6464
* @param url | the URL of the file that must be writen
65-
* @param zipped | true if the file must be zipped
65+
* @param ziped | true if the file must be zipped
6666
* @throws FileNotFoundException | if the given file isn't found
6767
* @throws IOException | if an error occures while opening the file
6868
*/
@@ -76,7 +76,7 @@ public FastaBufferedWriter(URL url, boolean ziped) throws FileNotFoundException,
7676
/**
7777
* creates a new FastaBufferedReader of the given URL.
7878
* @param url | the URL of the file that must be writen
79-
* @param zipped | true if the file must be zipped
79+
* @param ziped | true if the file must be zipped
8080
* @param append | true if append to existing file
8181
* @throws FileNotFoundException | if the given file isn't found
8282
* @throws IOException | if an error occures while opening the file

src/be/uzleuven/gc/logistics/GBSX/utils/fasta/infrastructure/FastaPairBufferedReader.java

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -51,19 +51,6 @@ public FastaPairBufferedReader(File fileRead1, File fileRead2, boolean ziped) th
5151
this.fastaBufferedReader2 = new FastaBufferedReader(fileRead2, ziped);
5252
}
5353

54-
/**
55-
* creates 2 new FastqBufferedReader of the given files.
56-
* @param fileRead1 | the URL for read 1
57-
* @param fileRead2 | the URL for read 2
58-
* @param ziped | boolean if the fasta file is ziped (gz)
59-
* @throws FileNotFoundException | if the given file isn't found
60-
* @throws IOException | if an error occures while opening the file
61-
*/
62-
// public FastqPairBufferedReader(URL fileRead1, URL fileRead2, boolean ziped) throws FileNotFoundException, IOException{
63-
// this.fastaBufferedReader1 = new FastaBufferedReader(fileRead1, ziped);
64-
// this.fastaBufferedReader2 = new FastaBufferedReader(fileRead2, ziped);
65-
// }
66-
6754
/**
6855
* reads the next lines in the fasta file. and returns it as an fastaread
6956
* @return null if there are no fasta files anymore, else a FastaRead

src/be/uzleuven/gc/logistics/GBSX/utils/fasta/infrastructure/FastaPairBufferedWriter.java

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -49,19 +49,6 @@ public FastaPairBufferedWriter(File fileRead1, File fileRead2, boolean ziped) th
4949
this.fastaBufferedWriter2 = new FastaBufferedWriter(fileRead2, ziped);
5050
}
5151

52-
/**
53-
* creates 2 new FastaBufferedReader of the given files.
54-
* @param fileRead1 | the URL for read 1
55-
* @param fileRead2 | the URL for read 2
56-
* @param ziped | boolean if the fasta file is ziped (gz)
57-
* @throws FileNotFoundException | if the given file isn't found
58-
* @throws IOException | if an error occures while opening the file
59-
*/
60-
// public FastaPairBufferedReader(URL fileRead1, URL fileRead2, boolean ziped) throws FileNotFoundException, IOException{
61-
// this.fastaBufferedReader1 = new FastaBufferedReader(fileRead1, ziped);
62-
// this.fastaBufferedReader2 = new FastaBufferedReader(fileRead2, ziped);
63-
// }
64-
6552
/**
6653
* reads the next lines in the fasta file. and returns it as an fastaread
6754
* @return null if there are no fasta files anymore, else a FastqRead

0 commit comments

Comments
 (0)