Populates the instance variables of this ReadGroupSet from the
        specified dataUrl and indexFile. If indexFile is not specified
        guess usual form.
420493
def populateFromFile(self, dataUrl, indexFile=None):
        
        self._dataUrl = dataUrl
        self._indexFile = indexFile
        if indexFile is None:
            self._indexFile = dataUrl + ".bai"
        samFile = self.getFileHandle(self._dataUrl)
        self._setHeaderFields(samFile)
        if 'RG' not in samFile.header or len(samFile.header['RG']) == 0:
            readGroup = HtslibReadGroup(self, self.defaultReadGroupName)
            self.addReadGroup(readGroup)
        else:
            for readGroupHeader in samFile.header['RG']:
                readGroup = HtslibReadGroup(self, readGroupHeader['ID'])
                readGroup.populateFromHeader(readGroupHeader)
                self.addReadGroup(readGroup)
        self._bamHeaderReferenceSetName = None
        for referenceInfo in samFile.header['SQ']:
            if 'AS' not in referenceInfo:
                infoDict = parseMalformedBamHeader(referenceInfo)
            else:
                infoDict = referenceInfo
            name = infoDict.get('AS', references.DEFAULT_REFERENCESET_NAME)
            if self._bamHeaderReferenceSetName is None:
                self._bamHeaderReferenceSetName = name
            elif self._bamHeaderReferenceSetName != name:
                raise exceptions.MultipleReferenceSetsInReadGroupSet(
                    self._dataUrl, name, self._bamFileReferenceName)
        self._numAlignedReads = samFile.mapped
        self._numUnalignedReads = samFile.unmapped
197712
public void configure(String rootUrl, Settings settings) {
    Data<Read, ReadGroupSet, Reference> data = dataSources.get(rootUrl);
    if (data == null) {
      data = new Data<Read, ReadGroupSet, Reference>(settings, null);
      dataSources.put(rootUrl, data);
    } else {
      data.settings = settings;
    }
  }
1235359
private void initialiseInstanceVariables() {
		backing = new HashMap<>();
		booleanBacking = new HashSet<>();
		locations = new HashMap<>();

		// subContextCache is updated on the fly so ensure no concurrent modification.
		subcontextCache = Collections.synchronizedMap(new HashMap());
		runtimeProperties = new IncludeProperties("Runtime: added at runtime");
	}
575186
public final Set<RegData> load(String dirName, String className, String methodName) {
        String fullName = className + '.' + methodName;
        return load(openFileRead(dirName, fullName, className, methodName));
    }
274387
private ExampleSet readDataSet(File in) throws IOException {
        logger.info("read the example set");

        //
        ExampleSet inputSet1 = new SentenceSetCopy();
        inputSet1.read(new BufferedReader(new FileReader(in)));

        return inputSet1;
    }
356614
private void processAssignmentData() throws IOException
   {
      FieldMap fieldMap = new FieldMap9(m_file.getProjectProperties(), m_file.getCustomFields());
      fieldMap.createAssignmentFieldMap(m_projectProps);

      DirectoryEntry assnDir = (DirectoryEntry) m_projectDir.getEntry("TBkndAssn");
      VarMeta assnVarMeta = new VarMeta9(new DocumentInputStream(((DocumentEntry) assnDir.getEntry("VarMeta"))));
      Var2Data assnVarData = new Var2Data(assnVarMeta, new DocumentInputStream(((DocumentEntry) assnDir.getEntry("Var2Data"))));

      FixedMeta assnFixedMeta = new FixedMeta(new DocumentInputStream(((DocumentEntry) assnDir.getEntry("FixedMeta"))), 34);
      FixedData assnFixedData = new FixedData(142, m_inputStreamFactory.getInstance(assnDir, "FixedData"));
      if (assnFixedData.getItemCount() != assnFixedMeta.getAdjustedItemCount())
      {
         assnFixedData = new FixedData(assnFixedMeta, m_inputStreamFactory.getInstance(assnDir, "FixedData"));
      }

      ResourceAssignmentFactory factory = new ResourceAssignmentFactory();
      factory.process(m_file, fieldMap, null, m_reader.getUseRawTimephasedData(), m_reader.getPreserveNoteFormatting(), assnVarMeta, assnVarData, assnFixedMeta, assnFixedData, null, assnFixedMeta.getAdjustedItemCount());
   }
331381
private ExampleSet readDataSet(File in) throws IOException {
        logger.info("read the example set");

        //
        logger.info("read data set");
        ExampleSet inputSet = new SentenceSetCopy();
        inputSet.read(new BufferedReader(new FileReader(in)));

        return inputSet;
    }
1232172
def populateFromFile(self, dataUrl):
        
        self._dbFilePath = dataUrl
        self._db = SqliteRnaBackend(self._dbFilePath)
        self.getRnaQuantMetadata()
1178967
private static DataSet loadG(Reader reader, double sparseRatio, int vectorLength, boolean classification, DataStore store) throws IOException
    {
        StringBuilder processBuffer = new StringBuilder(20);
        StringBuilder charBuffer = new StringBuilder(1024);
        char[] buffer = new char[1024];
        DataStore sparceVecs = store.emptyClone();
        sparceVecs.setCategoricalDataInfo(new CategoricalData[0]);
        /**
         * The category "label" for each value loaded in
         */
        List<Double> labelVals = new DoubleList();
        Map<Double, Integer> possibleCats = new HashMap<>();
        int maxLen= 1;
        
        STATE state = STATE.INITIAL;
        int position = 0;
        SparseVector tempVec = new SparseVector(1, 1);
        /**
         * The index that we have parse out of a non zero pair
         */
        int indexProcessing = -1;
        while(true)
        {
            
            while(charBuffer.length()-position <= 1)//make sure we have chars to handle
            {
                //move everything to the front
                charBuffer.delete(0, position);
                position = 0;
                
                int read = reader.read(buffer);
                if(read < 0)
                    break;
                charBuffer.append(buffer, 0, read);
            }
            
            if(charBuffer.length()-position == 0)//EOF, no more chars
            {
                if(state == STATE.LABEL)//last line was empty
                {
                    double label = Double.parseDouble(processBuffer.toString());

                    if (!possibleCats.containsKey(label) && classification)
                        possibleCats.put(label, possibleCats.size());
                    labelVals.add(label);
                    
                    sparceVecs.addDataPoint(new DataPoint(new SparseVector(maxLen, 0)));
                }
                else if(state == STATE.WHITESPACE_AFTER_LABEL)//last line was empty, but we have already eaten the label
                {
                    sparceVecs.addDataPoint(new DataPoint(new SparseVector(maxLen, 0)));
                }
                else if(state == STATE.FEATURE_VALUE || state == STATE.WHITESPACE_AFTER_FEATURE)//line ended after a value pair
                {
                    //process the last value pair & insert into vec
                    double value = StringUtils.parseDouble(processBuffer, 0, processBuffer.length());
                    processBuffer.delete(0, processBuffer.length());

                    maxLen = Math.max(maxLen, indexProcessing+1);
                    tempVec.setLength(maxLen);
                    if (value != 0)
                        tempVec.set(indexProcessing, value);
                    sparceVecs.addDataPoint(new DataPoint(tempVec.clone()));
                }
                else if(state == STATE.NEWLINE)
                {
                    //nothing to do and everything already processed, just return
                    break;
                }
                else
                    throw new RuntimeException();
                //we may have ended on a line, and have a sparse vec to add before returning
                break;
            }
            
            char ch = charBuffer.charAt(position);
            switch(state)
            {
                case INITIAL:
                    state = STATE.LABEL;
                    break;
                case LABEL:
                    if (Character.isDigit(ch)  || ch == '.' || ch == 'E' || ch == 'e' || ch == '-' || ch == '+')
                    {
                        processBuffer.append(ch);
                        position++;
                    }
                    else if (Character.isWhitespace(ch))//this gets spaces and new lines
                    {
                        double label = Double.parseDouble(processBuffer.toString());

                        if (!possibleCats.containsKey(label) && classification)
                            possibleCats.put(label, possibleCats.size());
                        labelVals.add(label);

                        //clean up and move to new state
                        processBuffer.delete(0, processBuffer.length());
                        
                        if (ch == '\n' || ch == '\r')//empty line, so add a zero vector
                        {
                            tempVec.zeroOut();
                            sparceVecs.addDataPoint(new DataPoint(new SparseVector(maxLen, 0)));
                            state = STATE.NEWLINE;
                        }
                        else//just white space
                        {
                            tempVec.zeroOut();
                            state = STATE.WHITESPACE_AFTER_LABEL;
                        }
                    }
                    else
                        throw new RuntimeException("Invalid LIBSVM file");
                    break;
                case WHITESPACE_AFTER_LABEL:
                    if (Character.isDigit(ch))//move to next state
                    {
                        state = STATE.FEATURE_INDEX;
                    }
                    else if (Character.isWhitespace(ch))
                    {
                        if (ch == '\n' || ch == '\r')
                        {
                            tempVec.zeroOut();
                            sparceVecs.addDataPoint(new DataPoint(new SparseVector(maxLen, 0)));///no features again, add zero vec
                            state = STATE.NEWLINE;
                        }
                        else//normal whie space
                            position++;
                    }
                    else
                        throw new RuntimeException();
                    break;
                case FEATURE_INDEX:
                    if (Character.isDigit(ch))
                    {
                        processBuffer.append(ch);
                        position++;
                    }
                    else if(ch == ':')
                    {
                        indexProcessing = StringUtils.parseInt(processBuffer, 0, processBuffer.length())-1;
                        processBuffer.delete(0, processBuffer.length());
                        
                        
                        state = STATE.FEATURE_VALUE;
                        position++;
                    }
                    else
                        throw new RuntimeException();
                    break;
                case FEATURE_VALUE:
                    //we need to accept all the values that may be part of a float value
                    if (Character.isDigit(ch) || ch == '.' || ch == 'E' || ch == 'e' || ch == '-' || ch == '+')
                    {
                        processBuffer.append(ch);
                        position++;
                    }
                    else
                    {
                        double value = StringUtils.parseDouble(processBuffer, 0, processBuffer.length());
                        processBuffer.delete(0, processBuffer.length());
   
                        maxLen = Math.max(maxLen, indexProcessing+1);
                        tempVec.setLength(maxLen);
                        if (value != 0)
                            tempVec.set(indexProcessing, value);
                        
                        if (Character.isWhitespace(ch))
                            state = STATE.WHITESPACE_AFTER_FEATURE;
                        else
                            throw new RuntimeException();
                    }
                    
                    break;
                case WHITESPACE_AFTER_FEATURE:
                    if (Character.isDigit(ch))
                        state = STATE.FEATURE_INDEX;
                    else if (Character.isWhitespace(ch))
                    {
                        if (ch == '\n' || ch == '\r')
                        {
                            sparceVecs.addDataPoint(new DataPoint(tempVec.clone()));
                            tempVec.zeroOut();
                            state = STATE.NEWLINE;
                        }
                        else
                            position++;
                    }
                    break;
                case NEWLINE:
                    if (ch == '\n' || ch == '\r')
                        position++;
                    else
                    {
                        state = STATE.LABEL;
                    }
                    break;
            }
        }
        
        if (vectorLength > 0)
            if (maxLen > vectorLength)
                throw new RuntimeException("Length given was " + vectorLength + ", but observed length was " + maxLen);
            else
                maxLen = vectorLength;

        if(classification)
        {
            CategoricalData predicting = new CategoricalData(possibleCats.size());

            //Give categories a unique ordering to avoid loading issues based on the order categories are presented
            List<Double> allCatKeys = new DoubleList(possibleCats.keySet());
            Collections.sort(allCatKeys);
            for(int i = 0; i < allCatKeys.size(); i++)
                possibleCats.put(allCatKeys.get(i), i);
            //apply to target values now 
            
            IntList label_targets = IntList.view(labelVals.stream()
                    .mapToInt(possibleCats::get)
                    .toArray());

            sparceVecs.setNumNumeric(maxLen);
            sparceVecs.finishAdding();
            ClassificationDataSet cds = new ClassificationDataSet(sparceVecs, label_targets);

            if(store instanceof RowMajorStore)
                cds.applyTransform(new DenseSparceTransform(sparseRatio));

            return cds;
        }
        else//regression
        {
            sparceVecs.setNumNumeric(maxLen);
            sparceVecs.finishAdding();
            RegressionDataSet rds = new RegressionDataSet(sparceVecs, labelVals);
            rds.applyTransform(new DenseSparceTransform(sparseRatio));

            return rds;
        }
    }
1352789
def getAllReadGroupSets(self):
        
        for dataset in self.getAllDatasets():
            iterator = self._client.search_read_group_sets(
                dataset_id=dataset.id)
            for readGroupSet in iterator:
                yield readGroupSet
69681
public void loadParamFile() throws IOException {
		SeekableLineReaderFactory fact = null;
		SeekableLineReaderIterator iter = null;

		try {
			fact = GeneralURIStreamFactory.createSeekableStreamFactory(
				paramFile, false);
			iter = new SeekableLineReaderIterator(fact.get());

			paramSet = new HashSet<String>();

			while (iter.hasNext()) {
				String param = iter.next();
				param = param.trim();

				if (param.isEmpty() || param.startsWith("#")) {
					continue;
				}

				// Use only the first word, ignore the rest
				int wordEnd = param.indexOf(delim);

				if (wordEnd > 0) {
					param = param.substring(0, wordEnd);
				}

				paramSet.add(param);
			}
		} finally {
			if (iter != null) {
				iter.close();
			}

			if (fact != null) {
				fact.close();
			}
		}
	}
1346982
def getReadGroupSet(self, id_):
        
        compoundId = datamodel.ReadGroupSetCompoundId.parse(id_)
        dataset = self.getDataset(compoundId.dataset_id)
        return dataset.getReadGroupSet(id_)
363607
def addReadGroupSet(self):
        
        self._openRepo()
        dataset = self._repo.getDatasetByName(self._args.datasetName)
        dataUrl = self._args.dataFile
        indexFile = self._args.indexFile
        parsed = urlparse.urlparse(dataUrl)
        # TODO, add https support and others when they have been
        # tested.
        if parsed.scheme in ['http', 'ftp']:
            if indexFile is None:
                raise exceptions.MissingIndexException(dataUrl)
        else:
            if indexFile is None:
                indexFile = dataUrl + ".bai"
            dataUrl = self._getFilePath(self._args.dataFile,
                                        self._args.relativePath)
            indexFile = self._getFilePath(indexFile, self._args.relativePath)
        name = self._args.name
        if self._args.name is None:
            name = getNameFromPath(dataUrl)
        readGroupSet = reads.HtslibReadGroupSet(dataset, name)
        readGroupSet.populateFromFile(dataUrl, indexFile)
        referenceSetName = self._args.referenceSetName
        if referenceSetName is None:
            # Try to find a reference set name from the BAM header.
            referenceSetName = readGroupSet.getBamHeaderReferenceSetName()
        referenceSet = self._repo.getReferenceSetByName(referenceSetName)
        readGroupSet.setReferenceSet(referenceSet)
        readGroupSet.setAttributes(json.loads(self._args.attributes))
        self._updateRepo(self._repo.insertReadGroupSet, readGroupSet)
653347
def populateFromRow(self, dataset):
        
        self._description = dataset.description
        self.setAttributesJson(dataset.attributes)
273277
def populateFromDirectory(self, vcfDirectory):
        
        pattern = os.path.join(vcfDirectory, "*.vcf.gz")
        dataFiles = []
        indexFiles = []
        for vcfFile in glob.glob(pattern):
            dataFiles.append(vcfFile)
            indexFiles.append(vcfFile + ".tbi")
        self.populateFromFile(dataFiles, indexFiles)
290024
private ExampleSet readDataSet(File in) throws IOException
	{
		logger.info("read the example set");

		//
		ExampleSet inputSet = new SentenceSetCopy();
		inputSet.read(new BufferedReader(new FileReader(in)));

		String trainFrac = parameter.getProperty("train-frac");
		if (trainFrac != null)
		{
			double f = Double.parseDouble(trainFrac);
			logger.info("training original size: " + inputSet.size());
			logger.info("training fraction: " + (100 * f) + "%");
			return inputSet.subSet(0, (int) (inputSet.size() * f));
		}

		return inputSet;
	}
1221267
private void initReader(Object obj) {
		if (obj instanceof WorkingDirectoryLocationAware) {
			((WorkingDirectoryLocationAware) obj).setWorkingDirectory(workingDirectory);
		}
		if (obj instanceof ServletContextAware) {
			((ServletContextAware) obj).setServletContext(servletContext);
		}

		if (obj instanceof ResourceBrowser) {
			resourceInfoProviders.add(0, (ResourceBrowser) obj);
		}
	}