All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.maizegenetics.util.BuilderFromVCFUtil Maven / Gradle / Ivy

Go to download

TASSEL is a software package to evaluate traits associations, evolutionary patterns, and linkage disequilibrium.

The newest version!
package net.maizegenetics.util;

import java.util.ArrayList;

public class BuilderFromVCFUtil {

    //This method is designed to import multiple indels on a single VCF line
    public static char[][] createSmallCallTable(ArrayList variants) {
        
        //Calculate the longest variant sequence.  This is how big we will need each char array to be
        int maxVarLength = 0;
        for(String variant : variants) {
            maxVarLength = (variant.length() > maxVarLength)?variant.length() : maxVarLength;
        }
        //Create a call table
        char[][] alleleCallTable = new char[variants.size()][maxVarLength];
       
        for(int varCounter = 0; varCounter < alleleCallTable.length; varCounter++ ) {
            for(int posCounter = 0; posCounter < alleleCallTable[varCounter].length; posCounter++) {
                if(variants.get(varCounter).length()<=posCounter) {
                    alleleCallTable[varCounter][posCounter] = '-';
                }
                else {
                    alleleCallTable[varCounter][posCounter] = variants.get(varCounter).charAt(posCounter);
                }
            }
        }
        return alleleCallTable;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy