private void init ( Reader reader ) { names = new TreeSet < String > ( ) ; failedLines = new LinkedHashMap < Integer , String > ( ) ; BufferedReader br = null ; try { br = new BufferedReader ( reader ) ; logger . info ( "Reading ASTRAL file..." ) ; String line = "" ; int i = 0 ; while ( ( line = br . readLine ( ) ) != null ) { if ( line . startsWith ( ">" ) ) { try { String scopId = line . split ( "\\s" ) [ 0 ] . substring ( 1 ) ; names . add ( scopId ) ; if ( i % 1000 == 0 ) { logger . debug ( "Reading ASTRAL line for " + scopId ) ; } i ++ ; } catch ( RuntimeException e ) { failedLines . put ( i , line ) ; logger . warn ( "Couldn't read line " + line , e ) ; } } } br . close ( ) ; } catch ( IOException e ) { throw new RuntimeException ( "Couldn't read the input stream " , e ) ; } finally { if ( br != null ) { try { br . close ( ) ; } catch ( IOException e ) { logger . warn ( "Could not close stream" , e ) ; } } } }
Parses the FASTA file opened by reader .