Package org.broadinstitute.gatk.utils.text

Examples of org.broadinstitute.gatk.utils.text.XReadLines


    private List<File> parseVariantList(final List<File> rawFileList) {
        final List<File> result = new ArrayList<>(rawFileList.size());
        for (final File rawFile : rawFileList) {
            if (rawFile.getName().endsWith(".list")) {
                try {
                    for (final String line : new XReadLines(rawFile, true))
                        result.add(new File(line));
                } catch (IOException e) {
                    throw new UserException.CouldNotReadInputFile(rawFile, e);
                }
            } else {
View Full Code Here


    public static DefaultHashMap<String, Double> loadContaminationFile(File ContaminationFractionFile, final Double defaultContaminationFraction, final Set<String> AvailableSampleIDs, Logger logger) throws GATKException {
        DefaultHashMap<String, Double> sampleContamination = new DefaultHashMap<String, Double>(defaultContaminationFraction);
        Set<String> nonSamplesInContaminationFile = new HashSet<String>(sampleContamination.keySet());
        try {

            XReadLines reader = new XReadLines(ContaminationFractionFile, true);
            for (String line : reader) {

                if (line.length() == 0) {
                    continue;
                }
View Full Code Here

        // first, load data from the input meta data file
        Map<String,Map<String,String>> metaValues = new HashMap<String,Map<String,String>>();
        logger.debug("Reading in metadata...");
        try {
            if ( metaDataFile.getAbsolutePath().endsWith(".fam") ) {
                for ( String line : new XReadLines(metaDataFile) ) {
                    String[] famSplit = line.split("\\s+");
                    if ( famSplit.length != 6 ) {
                        throw new UserException("Line of the fam file is malformatted. Expected 6 entries. Line is "+line);
                    }
                    String sid = famSplit[1];
                    String fid = famSplit[0];
                    String mom = famSplit[2];
                    String dad = famSplit[3];
                    String sex = famSplit[4];
                    String pheno = famSplit[5];
                    HashMap<String,String> values = new HashMap<String, String>();
                    values.put("mom",mom);
                    values.put("dad",dad);
                    values.put("fid",fid);
                    values.put("sex",sex);
                    values.put("phenotype",pheno);
                    metaValues.put(sid,values);
                }
            } else {
                for ( String line : new XReadLines(metaDataFile) ) {
                    logger.debug(line);
                    String[] split = line.split("\\s+");
                    String sampleID = split[0];
                    String keyVals = split[1];
                    HashMap<String,String> values = new HashMap<String, String>();
View Full Code Here

        /** load in the IDs file to a hashset for matching */
        if ( rsIDFile != null ) {
            IDsToKeep = new HashSet<String>();
            try {
                for ( final String line : new XReadLines(rsIDFile).readLines() ) {
                    IDsToKeep.add(line.trim());
                }
                logger.info("Selecting only variants with one of " + IDsToKeep.size() + " IDs from " + rsIDFile);
            } catch ( FileNotFoundException e ) {
                throw new UserException.CouldNotReadInputFile(rsIDFile, e);
View Full Code Here

    public static VQSRCalibrationCurve readFromFile(File source) {
        List<VQSRRange> points = new ArrayList<VQSRRange>();

        try {
            for ( String line : new XReadLines(source).readLines() ) {
                if ( ! line.trim().isEmpty() ) {
                    String[] parts = line.split("\\s+");
                    double fpRate = Double.parseDouble(parts[2]);
                    double tpRate = fpRate >= 1.0 ? CERTAIN_FALSE_POSITIVE : 1.0 - fpRate;
                    points.add(new VQSRRange(Double.parseDouble(parts[0]), Double.parseDouble(parts[1]), tpRate));
View Full Code Here

            catch (Exception e) {
                if ( isPicardInterval ) // definitely a picard file, but we failed to parse
                    throw new UserException.CouldNotReadInputFile(inputFile, e);
                else {
                    try {
                        XReadLines reader = new XReadLines(new File(file_name));
                        for(String line: reader) {
                            if ( line.trim().length() > 0 ) {
                                ret.add(glParser.parseGenomeLoc(line));
                            }
                        }
                        reader.close();
                    }
                    catch (IOException e2) {
                        throw new UserException.CouldNotReadInputFile(inputFile, e2);
                    }
                }
View Full Code Here

        // Keep track of the files in this list so that we can check for duplicates and empty files
        final Set<String> fileValues = new HashSet<>();

        // parse each line separately using the given Tags if none are provided on each line
        for ( final String line: new XReadLines(file) ) {
            final String[] tokens = line.split("\\s+");
            final RodBinding binding;

            if ( tokens.length == 0 ) {
                continue; // empty line, so do nothing
View Full Code Here

            File forumKeyFile = new File(forumKeyPath);
            if (forumKeyFile.exists()) {
                String forumKey = null;
                // Read in a one-line file so we can do a for loop
                for (String line : new XReadLines(forumKeyFile))
                    forumKey = line;
                updateForum(myWorkUnits, forumKey);
            }
        } catch (FileNotFoundException e) {
            throw new RuntimeException(e);
View Full Code Here

TOP

Related Classes of org.broadinstitute.gatk.utils.text.XReadLines

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.