added conversion from iupac format and new rod to deal with FLT file format
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@1254 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
702cdd087f
commit
5be5e1d45f
|
|
@ -0,0 +1,52 @@
|
|||
package org.broadinstitute.sting.gatk.refdata;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import org.broadinstitute.sting.utils.*;
|
||||
|
||||
/**
|
||||
* 1 469 C S 51 52 0.00 44 1 C 0 M
|
||||
* 1 492 C Y 130 51 0.00 46 1 C 0 T
|
||||
* 1 20786 G K 5 6 0.00 46 1 T 38 G
|
||||
*
|
||||
*/
|
||||
public class rodFLT extends TabularROD implements SNPCallFromGenotypes {
|
||||
public rodFLT(final String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
public GenomeLoc getLocation() {
|
||||
loc = GenomeLocParser.createGenomeLoc(this.get("0"), Long.parseLong(this.get("1")));
|
||||
return loc;
|
||||
}
|
||||
public String getRefBasesFWD() { return this.get("2"); }
|
||||
public char getRefSnpFWD() throws IllegalStateException { return getRefBasesFWD().charAt(0); }
|
||||
public String getAltBasesFWD() { return new String(BaseUtils.iupacToBases(this.get("3").charAt(0))); }
|
||||
public char getAltSnpFWD() throws IllegalStateException {
|
||||
char[] bases = BaseUtils.iupacToBases(this.get("3").charAt(0));
|
||||
if ( bases[0] != getRefSnpFWD() )
|
||||
return bases[0];
|
||||
else
|
||||
return bases[1];
|
||||
}
|
||||
public boolean isReference() { return false; }
|
||||
public boolean isSNP() { return true; }
|
||||
public boolean isInsertion() { return false; }
|
||||
public boolean isDeletion() { return false; }
|
||||
public boolean isIndel() { return false; }
|
||||
public double getMAF() { return 0.0; }
|
||||
public double getHeterozygosity() { return 0.0; }
|
||||
public boolean isGenotype() { return false; }
|
||||
public double getVariationConfidence() { return Double.parseDouble(this.get("6")); }
|
||||
public double getConsensusConfidence() { return -1; }
|
||||
public List<String> getGenotype() throws IllegalStateException { throw new IllegalStateException(); }
|
||||
public int getPloidy() throws IllegalStateException { return 2; }
|
||||
public boolean isBiallelic() { return true; }
|
||||
|
||||
// SNPCallFromGenotypes interface
|
||||
public int nIndividuals() { return -1; }
|
||||
public int nHomRefGenotypes() { return -1; }
|
||||
public int nHetGenotypes() { return -1; }
|
||||
public int nHomVarGenotypes() { return -1; }
|
||||
public List<Genotype> getGenotypes() { return null; }
|
||||
}
|
||||
|
|
@ -46,6 +46,67 @@ public class BaseUtils {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Converts a IUPAC nucleotide code to a pair of bases
|
||||
*
|
||||
* @param code
|
||||
* @return 0, 1, 2, 3, or -1 if the base can't be understood
|
||||
*/
|
||||
static public char[] iupacToBases(char code) {
|
||||
char[] bases = new char[2];
|
||||
switch (code) {
|
||||
case '*': // the wildcard character counts as an A
|
||||
case 'A':
|
||||
case 'a':
|
||||
bases[0] = bases[1] = 'A';
|
||||
break;
|
||||
case 'C':
|
||||
case 'c':
|
||||
bases[0] = bases[1] = 'C';
|
||||
break;
|
||||
case 'G':
|
||||
case 'g':
|
||||
bases[0] = bases[1] = 'G';
|
||||
break;
|
||||
case 'T':
|
||||
case 't':
|
||||
bases[0] = bases[1] = 'T';
|
||||
break;
|
||||
case 'R':
|
||||
case 'r':
|
||||
bases[0] = 'A';
|
||||
bases[1] = 'G';
|
||||
break;
|
||||
case 'Y':
|
||||
case 'y':
|
||||
bases[0] = 'C';
|
||||
bases[1] = 'T';
|
||||
break;
|
||||
case 'S':
|
||||
case 's':
|
||||
bases[0] = 'G';
|
||||
bases[1] = 'C';
|
||||
break;
|
||||
case 'W':
|
||||
case 'w':
|
||||
bases[0] = 'A';
|
||||
bases[1] = 'T';
|
||||
break;
|
||||
case 'K':
|
||||
case 'k':
|
||||
bases[0] = 'G';
|
||||
bases[1] = 'T';
|
||||
break;
|
||||
case 'M':
|
||||
case 'm':
|
||||
bases[0] = 'A';
|
||||
bases[1] = 'C';
|
||||
break;
|
||||
default:
|
||||
bases[0] = bases[1] = 'N';
|
||||
}
|
||||
return bases;
|
||||
}
|
||||
/**
|
||||
* Converts a simple base to a base index
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue