Removed gelitext package (deprecated) #753

Merged
merged 1 commit into from Jan 10, 2017
Jump to file or symbol
Failed to load files and symbols.
+0 −434
Split
@@ -29,7 +29,6 @@
import htsjdk.tribble.FeatureCodec;
import htsjdk.tribble.Tribble;
import htsjdk.tribble.bed.BEDCodec;
-import htsjdk.tribble.gelitext.GeliTextCodec;
import htsjdk.tribble.index.Index;
import htsjdk.tribble.index.IndexFactory;
import htsjdk.tribble.index.linear.LinearIndex;
@@ -193,8 +192,6 @@ public static FeatureCodec getFeatureCodec(File featureFile) {
// return new VCFCodec();
if (featureFile.getName().endsWith(".bed") || featureFile.getName().endsWith(".BED") )
return new BEDCodec();
- if (featureFile.getName().endsWith(".geli.calls") || featureFile.getName().endsWith(".geli") )
- return new GeliTextCodec();
throw new IllegalArgumentException("Unable to determine correct file type based on the file name, for file -> " + featureFile);
}
}
@@ -1,66 +0,0 @@
-/*
- * The MIT License
- *
- * Copyright (c) 2013 The Broad Institute
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-package htsjdk.tribble.gelitext;
-
-
-/**
- * Class DiploidGenotype
- *
- * Enum describing all possible combinations of diploid genotype variations;
- * AA, AC, etc.
- *
- * @author aaron
- */
-@Deprecated
-public enum DiploidGenotype {
- AA, AC, AG, AT, CC, CG, CT, GG, GT, TT;
-
- public static DiploidGenotype toDiploidGenotype(String genotype) {
- if (genotype.length() != 2)
- throw new DiploidGenotypeException("Genotype string for conversion should be of length 2, we were passed = " + genotype);
- genotype = genotype.toUpperCase();
- for (DiploidGenotype g: DiploidGenotype.values())
- if (g.toString().equals(genotype)) return g;
- throw new DiploidGenotypeException("Unable to find genotype matching " + genotype);
- }
-
- public boolean isHet() {
- return toString().toCharArray()[0] != toString().toCharArray()[1];
- }
-
- public boolean containsBase(char base) {
- return (toString().charAt(0) == base || toString().charAt(1) == base);
- }
-}
-
-@Deprecated
-class DiploidGenotypeException extends RuntimeException {
- DiploidGenotypeException(String s) {
- super(s);
- }
-
- DiploidGenotypeException(String s, Throwable throwable) {
- super(s, throwable);
- }
-}
@@ -1,117 +0,0 @@
-/*
- * The MIT License
- *
- * Copyright (c) 2013 The Broad Institute
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-package htsjdk.tribble.gelitext;
-
-import htsjdk.samtools.util.CollectionUtil;
-import htsjdk.tribble.AsciiFeatureCodec;
-import htsjdk.tribble.Feature;
-import htsjdk.tribble.exception.CodecLineParsingException;
-import htsjdk.tribble.readers.LineIterator;
-
-import java.util.Arrays;
-
-
-/**
- * <p/>
- * A codec for parsing geli text files, which is the text version of the geli binary format.
- * <p/>
- * <p/>
- * GELI text has the following tab-seperated fields:
- * contig the contig (string)
- * position the position on the contig (long)
- * refBase the reference base (char)
- * depthOfCoverage the depth of coverage at this position (int)
- * maximumMappingQual the maximum mapping quality of a read at this position (int)
- * genotype the called genotype (string)
- * LODBestToReference the LOD score of the best to the reference (double)
- * LODBestToNext the LOD score of the best to the next best genotype (double)
- * likelihoods the array of all genotype likelihoods, in ordinal ordering (array of 10 doubles, in ordinal order)
- *
- * @author aaron
- * @deprecated This is deprecated and unsupported.
- */
-@Deprecated
-public class GeliTextCodec extends AsciiFeatureCodec<GeliTextFeature> {
- public GeliTextCodec() {
- super(GeliTextFeature.class);
- }
-
- public Feature decodeLoc(final String line) {
- return decode(line);
- }
-
- @Override
- public GeliTextFeature decode(final String line) {
- // clean out header lines and comments
- if (line.startsWith("#") || line.startsWith("@"))
- return null;
-
- // parse into tokens
- final String[] parts = line.trim().split("\\s+");
- return decode(parts);
- }
-
- @Override
- public boolean canDecode(String path){
- return path.toLowerCase().endsWith(".geli.calls") || path.toLowerCase().endsWith(".geli");
- }
-
- @Override
- public Object readActualHeader(LineIterator reader) {
- return null;
- }
-
- public GeliTextFeature decode(final String[] tokens) {
- try {
- // check that we got the correct number of tokens in the split
- if (tokens.length != 18)
- throw new CodecLineParsingException("Invalid GeliTextFeature row found -- incorrect element count. Expected 18, got " + tokens.length + " line = " + CollectionUtil.join(Arrays.asList(tokens), " "));
-
- // UPPER case and sort
- final char[] x = tokens[5].toUpperCase().toCharArray();
- Arrays.sort(x);
- final String bestGenotype = new String(x);
-
- final double[] genotypeLikelihoods = new double[10];
- for (int pieceIndex = 8, offset = 0; pieceIndex < 18; pieceIndex++, offset++) {
- genotypeLikelihoods[offset] = Double.valueOf(tokens[pieceIndex]);
- }
- return new GeliTextFeature(tokens[0],
- Long.valueOf(tokens[1]),
- Character.toUpperCase(tokens[2].charAt(0)),
- Integer.valueOf(tokens[3]),
- Integer.valueOf(tokens[4]),
- DiploidGenotype.toDiploidGenotype(bestGenotype),
- Double.valueOf(tokens[6]),
- Double.valueOf(tokens[7]),
- genotypeLikelihoods);
- } catch (CodecLineParsingException e) {
- e.printStackTrace();
- throw new RuntimeException("Unable to parse line " + CollectionUtil.join(Arrays.asList(tokens), " "), e);
- } catch (NumberFormatException e) {
- e.printStackTrace();
- throw new RuntimeException("Unable to parse line " + CollectionUtil.join(Arrays.asList(tokens), " "), e);
- }
- }
-}
@@ -1,148 +0,0 @@
-/*
- * The MIT License
- *
- * Copyright (c) 2013 The Broad Institute
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-package htsjdk.tribble.gelitext;
-
-import htsjdk.tribble.Feature;
-
-import java.util.Arrays;
-
-
-/**
- * <p/>
- * Class GeliTextFeature
- * <p/>
- * This is a feature for the Geli text object, which is the text version of the Geli binary genotyping format.
- *
- * @author aaron
- * @deprecated this is deprecated and no longer supported
- */
-@Deprecated
-public class GeliTextFeature implements Feature {
-
- private final String contig; // the contig name
- private final long position; // the position on the contig
- private final char refBase; // the reference base
- private final int depthOfCoverage; // the depth of coverage at this position
- private final int maximumMappingQual; // the maximum mapping quality of a read at this position
- private final DiploidGenotype genotype; // the called genotype
- private final double LODBestToReference; // the LOD score of the best to the reference
- private final double LODBestToNext; // the LOD score of the best to the next best genotype
- private final double likelihoods[]; // the array of all genotype likelihoods, in ordinal order
-
- /**
- * Create a geli text feature, given:
- *
- * @param contig the contig
- * @param position the position on the contig
- * @param refBase the reference base
- * @param depthOfCoverage the depth of coverage at this position
- * @param maximumMappingQual the maximum mapping quality of a read at this position
- * @param genotype the called genotype
- * @param LODBestToReference the LOD score of the best to the reference
- * @param LODBestToNext the LOD score of the best to the next best genotype
- * @param likelihoods the array of all genotype likelihoods, in ordinal ordering
- */
- public GeliTextFeature(String contig,
- long position,
- char refBase,
- int depthOfCoverage,
- int maximumMappingQual,
- DiploidGenotype genotype,
- double LODBestToReference,
- double LODBestToNext,
- double[] likelihoods) {
- this.contig = contig;
- this.position = position;
- this.refBase = refBase;
- this.depthOfCoverage = depthOfCoverage;
- this.maximumMappingQual = maximumMappingQual;
- this.genotype = genotype;
- this.LODBestToReference = LODBestToReference;
- this.LODBestToNext = LODBestToNext;
- this.likelihoods = likelihoods;
- }
-
- @Override
- public String getContig() {
- return this.contig;
- }
-
- /** Return the start position in 1-based coordinates (first base is 1) */
- public int getStart() {
- return (int) this.position;
- }
-
- /**
- * Return the end position following 1-based fully closed conventions. The length of a feature is
- * end - start + 1;
- */
- public int getEnd() {
- return (int) this.position;
- }
-
- public char getRefBase() {
- return refBase;
- }
-
- public int getDepthOfCoverage() {
- return depthOfCoverage;
- }
-
- public int getMaximumMappingQual() {
- return maximumMappingQual;
- }
-
- public DiploidGenotype getGenotype() {
- return genotype;
- }
-
- public double getLODBestToNext() {
- return LODBestToNext;
- }
-
- public double getLODBestToReference() {
- return LODBestToReference;
- }
-
- public double[] getLikelihoods() {
- return likelihoods;
- }
-
- private static double Epsilon = 0.0001;
- public boolean equals(Object o) {
- if (!(o instanceof GeliTextFeature)) return false;
- GeliTextFeature other = (GeliTextFeature)o;
- if (!Arrays.equals(likelihoods,other.likelihoods)) return false;
- if (!contig.equals(other.contig)) return false;
- if (!(position == other.position)) return false;
- if (!(refBase == other.refBase)) return false;
- if (!(depthOfCoverage == other.depthOfCoverage)) return false;
- if (!(maximumMappingQual == other.maximumMappingQual)) return false;
- if (!(genotype == other.genotype)) return false;
- if (!(Math.abs(LODBestToReference - other.LODBestToReference) < Epsilon)) return false;
- if (!(Math.abs(LODBestToNext - other.LODBestToNext) < Epsilon)) return false;
- return true;
- }
-
-}
Oops, something went wrong.