-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ALS-4461] Allow incremental vcf loading (#73)
* ALS-4461: Deserialize variant index from disk * ALS-4461: Add variant index builder for VCF loading * ALS-4461: Upgrade major version * ALS-4461: Store variants by index instead of full variant spec. Refactoring to support incremental vcf loading * ALS-4461: Initial commit for genomic dataset merger * ALS-4461: Add jar with dependencies build instructions * ALS-4461: Fix issue with hardcoded directory * ALS-4461: Fix more issues with non-relative file paths, various refactoring * ALS-4461: Parallelize chromosome mask merging * ALS-4461: Updated hpds version in dockerfile * ALS-4461: Update genomic directory on loading for variant index stores * ALS-4461: Change type of variant index store from String (variant spec) to Integer (variant id) * ALS-4461: Refactor duplicated variant store read/write code * ALS-4461: Fixing thread issues at startup * ALS-4461: Fix error handling * ALS-4461: Clean up error handling in file backed storages * ALS-4461: Remove IOExceptions thrown from FBBIS * ALS-4461: Fix deserialization issue * ALS-4461: Add comment explaining chromosome index merging * ALS-4461: Add comments * ALS-4461: Changes per PR * ALS-4461: Refactor variant spec index to make testing easier * ALS-4461: Refactor genomic dataset merger to support testing * ALS-4461: Add validation to prevent patient id duplicates * ALS-4461: Add main args validation * ALS-4461: Remove unused code * ALS-4461: Remove potential race condition
- Loading branch information
Showing
35 changed files
with
878 additions
and
499 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
32 changes: 32 additions & 0 deletions
32
...rc/main/java/edu/harvard/hms/dbmi/avillach/hpds/storage/FileBackedJavaIndexedStorage.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,32 @@ | ||
package edu.harvard.hms.dbmi.avillach.hpds.storage; | ||
|
||
import java.io.*; | ||
import java.util.zip.GZIPInputStream; | ||
import java.util.zip.GZIPOutputStream; | ||
|
||
public class FileBackedJavaIndexedStorage <K, V extends Serializable> extends FileBackedByteIndexedStorage<K, V> { | ||
public FileBackedJavaIndexedStorage(Class<K> keyClass, Class<V> valueClass, File storageFile) throws FileNotFoundException { | ||
super(keyClass, valueClass, storageFile); | ||
} | ||
|
||
protected ByteArrayOutputStream writeObject(V value) throws IOException { | ||
ByteArrayOutputStream out = new ByteArrayOutputStream(); | ||
ObjectOutputStream oos = new ObjectOutputStream(new GZIPOutputStream(out)); | ||
oos.writeObject(value); | ||
oos.flush(); | ||
oos.close(); | ||
return out; | ||
} | ||
|
||
@Override | ||
protected V readObject(byte[] buffer) { | ||
try (ObjectInputStream in = new ObjectInputStream(new GZIPInputStream(new ByteArrayInputStream(buffer)));) { | ||
V readObject = (V) in.readObject(); | ||
return readObject; | ||
} catch (IOException e) { | ||
throw new UncheckedIOException(e); | ||
} catch (ClassNotFoundException e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
.../src/main/java/edu/harvard/hms/dbmi/avillach/hpds/storage/FileBackedJsonIndexStorage.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,40 @@ | ||
package edu.harvard.hms.dbmi.avillach.hpds.storage; | ||
|
||
import org.codehaus.jackson.map.ObjectMapper; | ||
import org.codehaus.jackson.type.TypeReference; | ||
|
||
import java.io.*; | ||
import java.util.zip.GZIPInputStream; | ||
import java.util.zip.GZIPOutputStream; | ||
|
||
public abstract class FileBackedJsonIndexStorage <K, V extends Serializable> extends FileBackedByteIndexedStorage<K, V> { | ||
private static final long serialVersionUID = -1086729119489479152L; | ||
|
||
protected transient ObjectMapper objectMapper = new ObjectMapper(); | ||
|
||
public FileBackedJsonIndexStorage(File storageFile) throws FileNotFoundException { | ||
super(null, null, storageFile); | ||
} | ||
|
||
protected ByteArrayOutputStream writeObject(V value) throws IOException { | ||
ByteArrayOutputStream out = new ByteArrayOutputStream(); | ||
objectMapper.writeValue(new GZIPOutputStream(out), value); | ||
return out; | ||
} | ||
|
||
protected V readObject(byte[] buffer) { | ||
try { | ||
return objectMapper.readValue(new GZIPInputStream(new ByteArrayInputStream(buffer)), getTypeReference()); | ||
} catch (IOException e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
|
||
// Required to populate the objectMapper on deserialization | ||
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { | ||
in.defaultReadObject(); | ||
objectMapper = new ObjectMapper(); | ||
} | ||
|
||
public abstract TypeReference<V> getTypeReference(); | ||
} |
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
Oops, something went wrong.