private Map<String,String> parseTabFile(File namesTabFile){
  Map<String,String> result=new HashMap<String,String>();
  BufferedReader reader=null;
  int lineNumber=0;
  try {
    reader=new BufferedReader(new InputStreamReader(new FileInputStream(namesTabFile)));
    String line;
    while ((line=reader.readLine()) != null) {
      line=line.trim();
      lineNumber++;
      if (line.length() > 0 && line.startsWith("PTHR")) {
        String[] columns=line.split("\t");
        if (columns != null && columns.length == 2) {
          String familyId=columns[0];
          familyId=familyId.replace(".mod","");
          if (familyId.contains(".mag")) {
            familyId=familyId.replace(".mag","");
          }
 else {
            familyId=familyId.replace(".",":");
          }
          String familyName=columns[1];
          result.put(familyId,familyName);
        }
 else {
          LOGGER.warn("Columns is Null OR unexpected splitting of line. Line is splitted into " + (columns == null ? 0 : columns.length) + "columns!");
        }
      }
 else {
        LOGGER.warn("Unexpected start of line: " + line);
      }
    }
  }
 catch (  IOException e) {
    LOGGER.warn("Couldn't parse tab separated file with family names!",e);
  }
 finally {
    if (reader != null) {
      try {
        reader.close();
      }
 catch (      IOException e) {
        LOGGER.warn("Couldn't close buffered reader correctly!",e);
      }
    }
  }
  LOGGER.info(lineNumber + " lines parsed.");
  LOGGER.info(result.size() + " entries created in the map.");
  return result;
}

private Map < String , String > parseTabFile ( File namesTabFile ) { Map < String , String > result = new HashMap < String , String > ( ) ; BufferedReader reader = null ; int lineNumber = 0 ; try { reader = new BufferedReader ( new InputStreamReader ( new FileInputStream ( namesTabFile ) ) ) ; String line ; while ( ( line = reader . readLine ( ) ) != null ) { line = line . trim ( ) ; lineNumber ++ ; if ( line . length ( ) > 0 && line . startsWith ( "PTHR" ) ) { String [ ] columns = line . split ( "\t" ) ; if ( columns != null && columns . length == 2 ) { String familyId = columns [ 0 ] ; familyId = familyId . replace ( ".mod" , "" ) ; if ( familyId . contains ( ".mag" ) ) { familyId = familyId . replace ( ".mag" , "" ) ; } else { familyId = familyId . replace ( "." , ":" ) ; } String familyName = columns [ 1 ] ; result . put ( familyId , familyName ) ; } else { LOGGER . warn ( "Columns is Null OR unexpected splitting of line. Line is splitted into " + ( columns == null ? 0 : columns . length ) + "columns!" ) ; } } else { LOGGER . warn ( "Unexpected start of line: " + line ) ; } } } catch ( IOException e ) { LOGGER . warn ( "Couldn't parse tab separated file with family names!" , e ) ; } finally { if ( reader != null ) { try { reader . close ( ) ; } catch ( IOException e ) { LOGGER . warn ( "Couldn't close buffered reader correctly!" , e ) ; } } } LOGGER . info ( lineNumber + " lines parsed." ) ; LOGGER . info ( result . size ( ) + " entries created in the map." ) ; return result ; }
parses signature accessions and names out of the specified tab separated file .
