-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve the Gene2Go parser memory efficiency
Finish early if all the taxa we needed to parse were seen already. Do not produce records for inactive taxa.
- Loading branch information
Showing
5 changed files
with
122 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
src/test/java/ubc/pavlab/rdp/util/Gene2GoParserIntegrationTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package ubc.pavlab.rdp.util; | ||
|
||
import org.junit.Test; | ||
import org.springframework.core.io.UrlResource; | ||
|
||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.util.Collections; | ||
import java.util.zip.GZIPInputStream; | ||
|
||
import static org.junit.Assume.assumeNoException; | ||
|
||
public class Gene2GoParserIntegrationTest { | ||
|
||
/** | ||
* This test can be lengthy! | ||
*/ | ||
@Test | ||
public void parse_withOnlineFile_thenSucceeds() throws ParseException { | ||
Gene2GoParser parser = new Gene2GoParser( Collections.singleton( 9606 ) ); | ||
try ( InputStream is = new GZIPInputStream( new UrlResource( "ftp://ftp.ncbi.nlm.nih.gov/gene/DATA/gene2go.gz" ).getInputStream() ) ) { | ||
parser.parse( is ); | ||
} catch ( IOException e ) { | ||
assumeNoException( e ); | ||
} | ||
} | ||
|
||
@Test | ||
public void parse_withOnlineFile_whenFileIsEmpty_thenSkipTheWholeFile() throws ParseException { | ||
Gene2GoParser parser = new Gene2GoParser( Collections.emptySet() ); | ||
try ( InputStream is = new GZIPInputStream( new UrlResource( "ftp://ftp.ncbi.nlm.nih.gov/gene/DATA/gene2go.gz" ).getInputStream() ) ) { | ||
parser.parse( is ); | ||
} catch ( IOException e ) { | ||
assumeNoException( e ); | ||
} | ||
} | ||
} |