@@ -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 ){
0 commit comments