Parse a Pedigree file and return a list of Pedigree objects.

@param   pedigreePath    Path to the Pedigree file
@return                  List of Pedigree objects
@throws IOException
1050
public static List<Pedigree> parse(Path pedigreePath) throws IOException {
        FileUtils.checkFile(pedigreePath);

        Map<String, Pedigree> pedigreeMap = new HashMap<>();
        Map<String, Member> individualMap = new HashMap<>();

        String pedigreeName, individualName;
        Member.Sex sex;
        Member.AffectionStatus affectionStatus;
        //String line, key;
        String[] fields, labels = null;

        Member member;

        // Read the whole pedigree file
        List<String> individualStringLines = Files.readAllLines(pedigreePath);

        // First loop: initializing individual map
        for (int i = 0; i < individualStringLines.size(); i++) {
            String line = individualStringLines.get(i);
            if (line != null) {
                fields = line.split("[ \t]");
                if (fields.length < 6) {
                    throw new IOException("Pedigree file '" + pedigreePath + "' contains " + fields.length
                            + ", it must contain minimum 6 columns!\n" + line);
                }
                if (i == 0 && line.startsWith("#")) {
                    // header with variables, labels are optional
                    labels = line.split("[ \t]");
                } else {
                    // normal line
                    pedigreeName = fields[0];
                    individualName = fields[1];
                    sex = Member.Sex.getEnum(fields[4]);
                    affectionStatus = Member.AffectionStatus.getEnum(fields[5]);
                    if (!pedigreeMap.containsKey(pedigreeName)) {
                        pedigreeMap.put(pedigreeName, new Pedigree(pedigreeName, new ArrayList<>(), new HashMap<>()));
                    }

                    member = new Member(individualName, sex, affectionStatus);

                    // labels are optional
                    if (labels != null && fields.length > 6 && labels.length == fields.length) {
                        Map<String, Object> attributes = new HashMap<>();
                        for (int j = 6; j < fields.length; j++) {
                            attributes.put(labels[j], fields[j]);
                        }
                        member.setAttributes(attributes);
                    }
                    pedigreeMap.get(pedigreeName).getMembers().add(member);
                    individualMap.put(pedigreeName + "_" + individualName, member);
                }
            }
        }

        // second loop: setting fathers, mothers, partners and children
        for (int i = 1; i < individualStringLines.size(); i++) {
            String line = individualStringLines.get(i);
            if (line != null) {
                fields = line.split("[ \t]");
                if (!line.startsWith("#")) {
                    // update father, mother and child
                    Member father = individualMap.get(fields[0] + "_" + fields[2]);
                    Member mother = individualMap.get(fields[0] + "_" + fields[3]);
                    Member child = individualMap.get(fields[0] + "_" + fields[1]);

                    // setting father and children
                    if (father != null) {
                        child.setFather(father);
                        if (father.getMultiples() == null) {
                            Multiples multiples = new Multiples().setType("children").setSiblings(new ArrayList<>());
                            father.setMultiples(multiples);
                        }
                        father.getMultiples().getSiblings().add(child.getName());
                    }

                    // setting mother and children
                    if (mother != null) {
                        child.setMother(mother);
                        if (mother.getMultiples() == null) {
                            Multiples multiples = new Multiples().setType("children").setSiblings(new ArrayList<>());
                            mother.setMultiples(multiples);
                        }
                        mother.getMultiples().getSiblings().add(child.getName());
                    }
                }
            }
        }

        // create the list of Pedigree objects from the map
        return new ArrayList<>(pedigreeMap.values());
    }
799155
public void genDotFile(Path path, String name,
                           Configuration configuration,
                           Attributes attributes)
        throws IOException
    {
        // transitive reduction
        Graph<String> graph = apiOnly
                ? requiresTransitiveGraph(configuration, Set.of(name))
                : gengraph(configuration);

        DotGraphBuilder builder = new DotGraphBuilder(name, graph, attributes);
        builder.subgraph("se", "java", attributes.javaSubgraphColor(),
                         DotGraphBuilder.JAVA_SE_SUBGRAPH)
               .subgraph("jdk", "jdk", attributes.jdkSubgraphColor(),
                         DotGraphBuilder.JDK_SUBGRAPH)
               .modules(graph.nodes().stream()
                                 .map(mn -> configuration.findModule(mn).get()
                                                .reference().descriptor()));
        // build dot file
        builder.build(path);
    }
362370
public static Optional<List<String>> getStringListAsOptWithClasspath(
            String classpathOrFilePath) {
        return getResourceInputStreamAsOpt(classpathOrFilePath)
                .map(JMInputStream::readLines);
    }
228007
private Path[] listPaths(final Path path)
      throws IOException {
    Path[] children = null;
    ArrayList<Path> tmpChildrenPath = new ArrayList<>();
    if (fs.isDirectory(path)) {
      // Get children's path list.
      FileStatus[] chiledrenFileStatus = pathFilter == null ? fs.listStatus(path) : fs.listStatus(path, pathFilter);
      for (FileStatus childFileStatus : chiledrenFileStatus) {
        tmpChildrenPath.add(childFileStatus.getPath());
      }
      children = tmpChildrenPath.toArray(new Path[tmpChildrenPath.size()]);
    }
    if (children == null) {
      children = EMPTY_PATH_ARRAY;
    }
    if (comparator != null && children.length > 1) {
      Arrays.sort(children, comparator);
    }
    return children;
  }
733326
public static SimpleFeatureCollection readPropertiesfile( String path ) throws IOException {

        OmsPropertiesFeatureReader reader = new OmsPropertiesFeatureReader();
        reader.file = path;
        reader.readFeatureCollection();

        return reader.geodata;
    }
88580
public static <K, V> HadoopInputFormat<K, V> readSequenceFile(Class<K> key, Class<V> value, String inputPath) throws IOException {
		return readHadoopFile(new org.apache.hadoop.mapred.SequenceFileInputFormat<K, V>(), key, value, inputPath);
	}
360575
public static List<String> listClassnames(final File parentDirectory,
                                            final List<File> classFileList) throws IOException {
    if (null == classFileList || classFileList.isEmpty()) {
      return Collections.emptyList();
    }
    final List<String> list = new ArrayList<String>(classFileList.size());
    for (final File file : classFileList) {
      list.add(extractClassNameFromFile(parentDirectory, file));
    }
    return list;
  }
46090
public PropertyPath parse(final String path) {
        
        ArgUtils.notEmpty(path, "path");
        
        final PropertyPath tokenStore = new PropertyPath(path);
        splitToken(tokenStore, path);
        return tokenStore;
    }
1137211
def parse_file(file_path)
      node = parse_xml(file_path)
      node.xpath('*').each do |node_child|
        case node_child.name
        when 'Relationships'
          parse(node_child)
        end
      end
      self
    end
1094172
function parseIndexedPaths(path) {
                var opensb = path.lastIndexOf('[');
                info.entityPath = path.substring(0, opensb);  // path to entity is before last [
                var propertyPath = path.substring(opensb + 1, path.length - 1); // property is between [ ]
                // eval it, in case it's an angular expression
                try { var evalPath = info.scope.$eval(propertyPath); }
                catch (_) { }
                info.propertyPath = evalPath ? evalPath : propertyPath;
            }
516031
void parseOneFile(final Path inputPath, final Writer outputWriter) throws IOException {
    try (final TFile.Reader.Scanner scanner = this.getScanner(inputPath)) {
      while (!scanner.atEnd()) {
        new LogFileEntry(scanner.entry()).write(outputWriter);
        scanner.advance();
      }
    }
  }
207240
public void read(String filePath) throws IOException{


		String line;
		ArrayList<String> words = new ArrayList<String>();
		ArrayList<String> markP = new ArrayList<String>();
		ArrayList<String> typeP = new ArrayList<String>();
		ArrayList<String> markC = new ArrayList<String>();
		ArrayList<String> typeC = new ArrayList<String>();
		if(filePath == null)
			return;
		File file = new File(filePath);
		BufferedReader reader = null;
		entityType = new HashSet<String>();

		//按行读取文件内容，一次读一整行
		reader = new BufferedReader(new InputStreamReader(new FileInputStream(file),"UTF-8"));

		//从文件中提取实体并存入队列中

		while ((line = reader.readLine()) != null) {
			line = line.trim();
			if(line.equals("")){

				newextract(words, markP, typeP, markC, typeC);


			}else{
				//判断实体,实体开始的边界为B-***或者S-***，结束的边界为E-***或N（O）或空白字符或B-***
				//predict
				String[] toks = line.split("\\s+");

				int ci = 1;
				int cj=2;

				if(toks.length>3){//如果列数大于三，默认取最后两列
					ci=toks.length-2;
					cj=toks.length-1;
				}else if(toks.length<3){
					System.out.println(line);
					return;
				}

				String[] marktype = getMarkType(toks[ci]);
				words.add(toks[0]);
				markP.add(marktype[0]);
				typeP.add(marktype[1]);
				entityType.add(marktype[1]);	

				//correct
				marktype = getMarkType(toks[cj]);
				markC.add(marktype[0]);
				typeC.add(marktype[1]);	
				entityType.add(marktype[1]);	

			}
		}
		reader.close();
		if(words.size()>0){
			newextract(words, markP, typeP, markC, typeC);
		}
		//从entityPs和entityCs提取正确估计的实体，存到entityCinPs，并更新mpc中的统计信息
		extractCInPEntity();
	}
837268
public static List<String> readLinesWithFilePathOrClasspath(
            String filePathOrClasspath) {
        return JMOptional
                .getOptional(JMFiles.readLines(filePathOrClasspath))
                .orElseGet(() -> getStringListAsOptWithClasspath(
                        filePathOrClasspath)
                        .orElseGet(Collections::emptyList));
    }
710486
private void setClassPath() throws IOException {
    String fullPath = file.getAbsolutePath();
    String rootPath = fullPath.substring(0, fullPath.lastIndexOf(classFile.getRelativePath()));
    List<File> classPath = new ArrayList<>();
    classPath.add(new File(rootPath));
    parserEnv.fileManager().setLocation(StandardLocation.CLASS_PATH, classPath);
  }
448914
public VariantMetadata loadPedigree(List<Pedigree> pedigrees, String studyId) {
        VariantMetadata variantMetadata = null;
        for(Pedigree pedigree: pedigrees) {
            variantMetadata = loadPedigree(pedigree, studyId);
        }
        return variantMetadata;
    }
907860
public <A> ListPath<A, PathBuilder<A>> getList(String property, Class<A> type) {
        return this.<A, PathBuilder<A>>getList(property, type, PathBuilder.class);
    }
163110
public static ProtoFile parseUtf8(Path path) throws IOException {
    try (Reader reader = Files.newBufferedReader(path, UTF_8)) {
      return parse(path.toString(), reader);
    }
  }