private void increment(List<String> features, int transition, float delta) { for (String feat : features) { if (!data.containsKey(feat)) { data.put(feat, new FeatureWeights()); } data.get(feat).increment(transition, delta, i); } }
public float weight(Collection<String> features, int trans) { float score = 0.0f; for (String feature : features) { if (data.containsKey(feature)) { score += data.get(feature).scoreForTransition(trans); } } return score; }
public float[] weight(Collection<String> features) { float[] scores = new float[index.size()]; for (String feature : features) { if (!data.containsKey(feature)) { continue; } if (isAveraged || data.get(feature).used > opts.minupdate) { data.get(feature).sumScoresForAllTransitions(scores); } } return scores; }
/** * Return all Genbank IDs associated to this probeset. * * @param probesetID * @return Genbank IDs associated to this probeset. */ public String[] getGenbankList(final String probesetID) { final String gbList = (String) probesetId2GenbankList.get(probesetID); if (gbList == null) { return ArrayUtils.EMPTY_STRING_ARRAY; } else { return gbList.split("[ ]"); } }
public Weights<T> average() { System.err.print("averaging (this may take a while)... "); Weights<T> result = new Weights<T>(opts, true); result.data = new Object2ObjectOpenHashMap<>(); result.index = index; result.gram = gram; int cnt = 0; for (String feat : data.keySet()) { FeatureWeights dw = data.get(feat); if (dw.used > opts.minupdate) { cnt++; FeatureWeights fw = new FeatureWeights(); for (int trans : index.indices()) { float averaged = dw.getAveraged(trans, i); if (!Float.isNaN(averaged)) { fw.increment(trans, averaged, 0); } } result.data.put(feat, fw); } } System.err.println("done, averaged " + cnt + " features."); return result; }
/** * Utility method to check whether a given walker has been deprecated in a previous GATK release * * @param walkerName the walker class name (not the full package) to check */ public static boolean isDeprecatedWalker(final String walkerName) { return deprecatedGATKWalkers.containsKey(walkerName); }
static { // Same comments as for walkers deprecatedGATKAnnotations.put("DepthOfCoverage", "2.4 (renamed to Coverage)"); }
static { // Indicate recommended replacement in parentheses if applicable deprecatedGATKWalkers.put( "ReduceReads", "3.0 (use recommended best practices pipeline with the HaplotypeCaller)"); deprecatedGATKWalkers.put( "CountCovariates", "2.0 (use BaseRecalibrator instead; see documentation for usage)"); deprecatedGATKWalkers.put( "TableRecalibration", "2.0 (use PrintReads with -BQSR instead; see documentation for usage)"); deprecatedGATKWalkers.put("AlignmentWalker", "2.2 (no replacement)"); deprecatedGATKWalkers.put("CountBestAlignments", "2.2 (no replacement)"); deprecatedGATKWalkers.put( "SomaticIndelDetector", "2.0 (replaced by MuTect2; see documentation for usage)"); deprecatedGATKWalkers.put( "BeagleOutputToVCF", "3,4 (replaced by Beagle native functions; see Beagle 4 documentation at https://faculty.washington.edu/browning/beagle/beagle.html)"); deprecatedGATKWalkers.put( "VariantsToBeagleUnphased", "3.4 (replaced by Beagle native functions; see Beagle 4 documentation at https://faculty.washington.edu/browning/beagle/beagle.html)"); deprecatedGATKWalkers.put( "ProduceBeagleInput", "3.4 (replaced by Beagle native functions; see Beagle 4 documentation at https://faculty.washington.edu/browning/beagle/beagle.html)"); deprecatedGATKWalkers.put( "ReadAdaptorTrimmer", "3.5 (this tool was unsound and untested -- no specific replacement, see Picard tools for alternatives)"); deprecatedGATKWalkers.put( "BaseCoverageDistribution", "3.5 (use DiagnoseTargets instead; see documentation for usage)"); deprecatedGATKWalkers.put( "CoveredByNSamplesSites", "3.5 (use DiagnoseTargets instead; see documentation for usage)"); deprecatedGATKWalkers.put( "VariantValidationAssessor", "3.5 (this tool was unsound and untested -- no replacement)"); deprecatedGATKWalkers.put( "LiftOverVariants", "3.5 (use Picard LiftoverVCF instead; see documentation for usage)"); deprecatedGATKWalkers.put( "FilterLiftedVariants", "3.5 (use Picard LiftoverVCF instead; see documentation for usage)"); deprecatedGATKWalkers.put( "ListAnnotations", "3.5 (this tool was impractical; see the online documentation instead)"); }
/** * Utility method to pull up the version number at which an annotation was deprecated and the * suggested replacement, if any * * @param annotationName the annotation class name (not the full package) to check */ public static String getAnnotationDeprecationInfo(final String annotationName) { return deprecatedGATKAnnotations.get(annotationName).toString(); }
/** * Utility method to pull up the version number at which a walker was deprecated and the suggested * replacement, if any * * @param walkerName the walker class name (not the full package) to check */ public static String getWalkerDeprecationInfo(final String walkerName) { return deprecatedGATKWalkers.get(walkerName).toString(); }
/** * Utility method to check whether a given annotation has been deprecated in a previous GATK * release * * @param annotationName the annotation class name (not the full package) to check */ public static boolean isDeprecatedAnnotation(final String annotationName) { return deprecatedGATKAnnotations.containsKey(annotationName); }
/** * Read the platform information from a GEO platform file. * * @param filename * @throws SyntaxErrorException * @throws IOException */ public void read(final String filename) throws SyntaxErrorException, IOException { if (filename == null) { return; } final GeoPlatformFileReader reader = new GeoPlatformFileReader(); final Reader lowLevelReader; if (filename.endsWith(".gz")) { lowLevelReader = new InputStreamReader(new GZIPInputStream(new FileInputStream(filename))); } else { lowLevelReader = new FileReader(filename); } final Table platformFileContent = reader.read(lowLevelReader); final Table.RowIterator ri = platformFileContent.firstRow(); int probeSetIdColumnIndex = -1; int genbankAcColumnIndex = -1; int genbankListColumnIndex = -1; int genbankColumnIndex = -1; final String probeIdColumnName = "ID"; final String genbankAcColumnName = "GB_ACC"; final String genbankListColumnName = "GB_LIST"; try { probeSetIdColumnIndex = platformFileContent.getColumnIndex(probeIdColumnName); } catch (InvalidColumnException e) { assert false; } try { genbankAcColumnIndex = platformFileContent.getColumnIndex(genbankAcColumnName); } catch (InvalidColumnException e) { // NOPMD // OK, see below. } try { genbankListColumnIndex = platformFileContent.getColumnIndex(genbankListColumnName); } catch (InvalidColumnException e) { // NOPMD // OK, see below. } genbankColumnIndex = (genbankListColumnIndex != -1 ? genbankListColumnIndex : genbankAcColumnIndex); if (probeSetIdColumnIndex == -1 || genbankColumnIndex == -1) { throw new SyntaxErrorException( 0, "One of the following column names could not be found in the platformFileContent description file: " + probeIdColumnName + ", (at least one of : " + genbankAcColumnName + ", " + genbankListColumnName + " )."); } int count = 0; while (!ri.end()) { try { final String probesetId = (String) platformFileContent.getValue(probeSetIdColumnIndex, ri); final String genbankAccession = (String) platformFileContent.getValue(genbankColumnIndex, ri); probesetId2GenbankList.put(probesetId, genbankAccession); count++; } catch (TypeMismatchException e) { throw new InternalError("Column type does not match" + e.getMessage()); } catch (InvalidColumnException e) { throw new InternalError("Should never happen"); } ri.next(); } this.count = count; }