package bioutils;

import java.util.HashMap;
import java.util.Vector;

/**
 * Created by antoine on 4/7/15.
 */
public class BioStringUtil {

    private HashMap<String, Integer> initHmAnalysis;

    public static Vector<String> groupByString(String str, int groupLength){

        Vector<String> res = new Vector<String>();

        for(int i = 0; (i+groupLength) <= str.length();i += groupLength){
            res.add(str.substring(i, i+groupLength));
        }

        return res;
    }

    public static int countTrinucleotide(Vector<String> vSeq, String tri){

        int nbTri = 0;

        for(String currentTri : vSeq){
            if(currentTri.equals(tri.toLowerCase())){
                nbTri++;
            }
        }

        return nbTri;
    }

    public static String join (Vector<HashMap<String, Integer>> intervals, String sSeq){

        String joinedSeq = "";

        for(HashMap<String, Integer> interval : intervals){
            joinedSeq += sSeq.substring((interval.get("from") - 1), interval.get("to"));
        }

        return joinedSeq;
    }

    public static String complement (String seq){
        return seq;
    }

    public static String complement(Vector<HashMap<String, Integer>> intervals, String sSeq){
        return complement(join(intervals, sSeq));
    }

    public static HashMap<String, Integer> processTriAnalysis(String seq){

        HashMap<String, Integer> hmRes = new HashMap<String, Integer>();




        return hmRes;
    }

	public HashMap<String, Integer> getInitHmAnalysis() {
		return initHmAnalysis;
	}

	public void setInitHmAnalysis(HashMap<String, Integer> initHmAnalysis) {
		this.initHmAnalysis = initHmAnalysis;
	}

}

@@ -1118,24 +1118,253 @@
 tring seq)%7B%0A
+%0A        String strComp = seq.toUpperCase()%0A                .replaceAll(%22A%22, %22t%22)%0A                .replaceAll(%22G%22, %22c%22)%0A                .replaceAll(%22C%22, %22g%22)%0A                .replaceAll(%22T%22, %22a%22)%0A                .toUpperCase();%0A%0A
         retu
@@ -1367,18 +1367,22 @@
 return s
-eq
+trComp
 ;%0A    %7D%0A

Add Gene and Genome directory