public gooneJensType getGooneType(ISequence seq1, ISequence seq2) { try { gooneJensType gt = gooneJensType.unKnown; dnaSequenceUtil dsc = new dnaSequenceUtil(); string[] seq1ID = dsc.getAbbrID(seq1).Split('_'); string[] seq2ID = dsc.getAbbrID(seq2).Split('_'); if (seq1ID.Count() == 3 && seq2ID.Count() == 3) { if (seq1ID[1] == seq2ID[1]) { if (seq1ID[2] == seq2ID[2]) { gt = gooneJensType.daroon_goone; } else { gt = gooneJensType.bein_goone; } } else { gt = gooneJensType.bein_jens; } } return(gt); } catch (Exception ex) { throw ex; } }
public pairwisedDNA(ISequence _seq1, ISequence _seq2) { seq1 = _seq1; seq2 = _seq2; k2pDistance = calcK2PDistance(seq1, seq2); gType = getGooneType(seq1, seq2); }
public int getFrequency(List <List <pairwisedDNA> > pairwisedDnaMatrix, gooneJensType gt, double min = -1, double max = -1) { try { int freq = 0; for (int i = 0; i < pairwisedDnaMatrix.Count; i++) { for (int j = 0; j < pairwisedDnaMatrix.Count; j++) { if (min != -1 && max != -1) { if ((pairwisedDnaMatrix[i][j].k2pDistance > min) && (pairwisedDnaMatrix[i][j].k2pDistance <= max) && pairwisedDnaMatrix[i][j].gType == gt) { freq++; } } else if (min != -1 && max == -1) { if ((pairwisedDnaMatrix[i][j].k2pDistance <= min) && pairwisedDnaMatrix[i][j].gType == gt) { freq++; } } else if (min == -1 && max != -1) { if ((pairwisedDnaMatrix[i][j].k2pDistance > max) && pairwisedDnaMatrix[i][j].gType == gt) { freq++; } } } } return(freq); } catch (Exception ex) { throw ex; } }
public List <pairwisedDNAGraph> createDNAGraph(List <List <pairwisedDNA> > pairwisedDnaMatrix, gooneJensType gt, double intervals = 10) { try { List <pairwisedDNAGraph> graphValues = new List <pairwisedDNAGraph>(); double maxXValue = getMaxValueInMatrix(pairwisedDnaMatrix); double minValue = getMinValueInMatrix(pairwisedDnaMatrix); double difference = maxXValue - minValue; string xLabel = ""; double yValue = 0; double xValue = 0, xValue_left = 0, xValue_right = 0; graphValues.Add(new pairwisedDNAGraph(0, "0", 0, 0, 0)); if (intervals != -1) { for (double i = minValue; i < intervals; i++) { if (i == 0) { xLabel = " <= " + Math.Round(minValue + (difference / intervals), 6); xValue = Math.Round(minValue + (difference / intervals), 6); xValue_right = Math.Round(minValue + (difference / intervals), 6); yValue = getFrequency(pairwisedDnaMatrix, gt, (maxXValue / intervals), -1); } else if (i == intervals - 1) { xLabel = " > " + Math.Round(minValue + i * (difference / intervals), 6); xValue = Math.Round(minValue + i * (difference / intervals), 6); xValue_left = Math.Round(minValue + i * (difference / intervals), 6); yValue = getFrequency(pairwisedDnaMatrix, gt, -1, i * (maxXValue / intervals)); } else { xLabel = " ( " + Math.Round(minValue + i * (difference / intervals), 6) + " - " + Math.Round(minValue + (i + 1) * (difference / intervals), 6) + " ] "; xValue = Math.Round((minValue + i * (difference / intervals) + minValue + (i + 1) * (difference / intervals)) / 2, 6); xValue_left = Math.Round(minValue + i * (difference / intervals), 6); xValue_right = Math.Round(minValue + (i + 1) * (difference / intervals), 6); yValue = getFrequency(pairwisedDnaMatrix, gt, (minValue + i * (difference / intervals)), minValue + (i + 1) * (difference / intervals)); } graphValues.Add(new pairwisedDNAGraph(xValue, xLabel, yValue, xValue_left, xValue_right)); } } else { } return(graphValues); } catch (Exception ex) { throw ex; } }