Package versusSNP.blast.util

Source Code of versusSNP.blast.util.SNPFinder

package versusSNP.blast.util;

import versusSNP.blast.BlastSet;
import versusSNP.genome.SNP;

public class SNPFinder {

  public SNPFinder() {
    super();
    // TODO Auto-generated constructor stub
  }
 
  public void find(BlastSet set) {
    int qPos = set.getQBegin() - set.biasQStrand();
    int sPos = set.getSBegin() - set.biasSStrand();
    int length = set.getQSeqLength();
    for (int i = 0; i < length; i++) {
      char qBase = set.atQSeq(i);
      char sBase = set.atSSeq(i);
      if (qBase != '-')
        qPos += set.biasQStrand();
      if (sBase != '-')
        sPos += set.biasSStrand();
      if (qBase != sBase) {
        if (sBase != '-') {
          set.addSNP(new SNP(qPos, sPos, qBase, sBase));
        } else {
          set.addSNP(new SNP(qPos, set.isSStrand() ? sPos + 1 : sPos, qBase, sBase));
        }
      }
    }
    set.emptyQuerySubjectSeq();
  }
}
TOP

Related Classes of versusSNP.blast.util.SNPFinder

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.