public class PHGdbAccess extends Object implements PHGDataWriter, AutoCloseable
| Constructor and Description |
|---|
PHGdbAccess(Connection dbConnection) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
int |
createRefRangeGroup(String method)
Creates an entry in the ref_range_groups table using method_id associated
with the name indicated via the method parameter.
|
List<String> |
getChromNamesForHaplotype(String line_name,
int hap_number,
String version)
Method grabs a list of distinct chromosome names for a genome_interval version
|
int |
getGameteGroupIDFromTaxaList(List<String> gametes)
Takes a list of taxa and returns the corresponding gamete_group_id or 0
|
int |
getGenoidFromLine(String line_name)
Return genoid
|
Map<Integer,net.maizegenetics.util.Tuple<String,byte[]>> |
getHapCountsIDAndDataForVersionMethod(String method)
This method pulls the haplotype_counts_id with corresponding genotypes line name and data for all DB entries
based on the supplied method
|
Map<Integer,byte[]> |
getHapCountsIDAndPathsForMethod(String method)
THis method pulls the haplotype_counts_id and corresponding path for all entries
in the paths table with the specified method.
|
int |
getHapidForGenoidHapNumber(int genoid,
int hap_number)
Returns hapid for given line name and hap_number
|
Map<Integer,String> |
getHapidHapNumberLineNamesForLines(List<String> lineNames)
Retrieves line name and hapnumber, and returns them with the hapid.
|
Map<String,Integer> |
getHapidMapFromLinenameHapNumber()
Returns a map of
|
List<Integer> |
getHapidsForGenoid(int genoid)
Returns list of hapids for a given line name
|
int |
getHaplotypeIDFromFastaIDLine(String idLine,
String methodName)
Returns the haplotype_id from the haplotypes table based on the gamete_grp_id
(calculated from the taxa list), the ref_range_id (calculated from the
ref coordinates part of the idline) and the method.
|
com.google.common.collect.RangeMap<net.maizegenetics.dna.map.Position,Integer> |
getIntervalRangesWithIDForChrom(String chrom)
Returns sorted treeRangeMap of Positions for specified chromosome
|
net.maizegenetics.util.Tuple<String,Integer> |
getLineNameHapNumberFromHapid(int gameteid)
Method to retrieve both a line name and the hap number given a hapid.
|
int |
getMethodIdFromName(String method_name)
Returns method_id given a method name.
|
int |
getRefRangeIDFromString(String refData)
Returns reference range id
|
boolean |
putAllAnchors(List<AnchorDataPHG> adata,
String refGroupMethod)
Stores chrom, start pos, end pos to referenece_ranges table
isFocus identifies focus intervals from the user's bed file
|
boolean |
putAssemblyInterAnchorSequences(String line_name,
int hapNumber,
String method,
com.google.common.collect.Multimap<Integer,AnchorDataPHG> anchorSequences)
Adds inter-anchor sequences for the specified assembly to the anchor_sequences
and anchor_haplotypes table.
|
void |
putConsensusSequences(com.google.common.collect.Multimap<net.maizegenetics.dna.map.Position,net.maizegenetics.util.Tuple<AnchorDataPHG,List<String>>> consensusMap,
int method_id)
This method takes a map of consensus data, finds the anchorIds based on Position,
finds the hapids of the taxa whose sequences at the specified anchorID map
to the consensus.
|
boolean |
putGameteGroupAndHaplotypes(List<String> gametes)
Takes a list of gametes and stores to the gamete_groups and gamete_haplotypes table
Skips if this grouping already exists
|
boolean |
putGenoAndHaploTypeData(GenoHaploData ghData)
Stores required data to the genotypes and haplotypes tables
for each entry on the list.
|
void |
putHaplotypeCountsData(String method,
String methodDetails,
String taxonName,
String fastqFile,
byte[] counts)
This method adds data to the haplotype_counts table.
|
void |
putHaplotypesForGamete(int gamete_grp_id,
String method,
Map<Integer,AnchorDataPHG> anchorSequences)
Stores gamete sequence data to the haplotypes table
This method associates all entries with the single gamete_grp_id which is passed.
|
void |
putHaplotypesForMultipleGroups(com.google.common.collect.Multimap<net.maizegenetics.dna.map.Position,net.maizegenetics.util.Tuple<AnchorDataPHG,String>> mapWithGroupHash,
int method_id)
Add data to the haplotypes table.
|
int |
putMethod(String name,
DBLoadingUtils.MethodType type,
String description)
Adds a method, its type and its description to the anchor_methods table
These are used to identify how sequences were created,how the were combined into consensus
sequences, how haplotype counts were scores, how paths through the graph were create
or how an edge was created.
|
void |
putPathsData(String method,
String methodDetails,
com.google.common.collect.Multimap<Integer,HaplotypeNode> paths)
This method stores paths data to the paths table.
|
boolean |
putRefAnchorData(String line_name,
int hapnumber,
List<AnchorDataPHG> anchorData,
String hapMethod,
String refGrpMethod,
String gvcf,
String variant_list)
Fills in the haplotypes table
for the reference ranges.
|
void |
putRefRangeRefRangeGroups(int group_method_id,
List<Integer> refRangeIDList)
Takes a method id and a list of reference ranges.
|
public PHGdbAccess(Connection dbConnection)
public int getRefRangeIDFromString(String refData)
PHGDatagetRefRangeIDFromString in interface PHGDatarefData - needs to be of form chr1:startpos:endPospublic int getHaplotypeIDFromFastaIDLine(String idLine, String methodName)
PHGDatagetHaplotypeIDFromFastaIDLine in interface PHGDataidLine - expected form: refchr:refStartPos:refEndPos;taxa_hapnumber:taxa_hapnumber:etcmethodName - This is the method used for creating the haplotypespublic int getMethodIdFromName(String method_name)
PHGDatagetMethodIdFromName in interface PHGDatapublic int getGameteGroupIDFromTaxaList(List<String> gametes)
PHGDatagetGameteGroupIDFromTaxaList in interface PHGDatagametes - Items on the list must be of the form taxon_hapNumberpublic int getGenoidFromLine(String line_name)
PHGDatagetGenoidFromLine in interface PHGDatapublic int getHapidForGenoidHapNumber(int genoid,
int hap_number)
PHGDatagetHapidForGenoidHapNumber in interface PHGDatapublic List<Integer> getHapidsForGenoid(int genoid)
PHGDatagetHapidsForGenoid in interface PHGDatapublic net.maizegenetics.util.Tuple<String,Integer> getLineNameHapNumberFromHapid(int gameteid)
PHGDatagetLineNameHapNumberFromHapid in interface PHGDatapublic Map<Integer,String> getHapidHapNumberLineNamesForLines(List<String> lineNames)
PHGDatagetHapidHapNumberLineNamesForLines in interface PHGDatapublic com.google.common.collect.RangeMap<net.maizegenetics.dna.map.Position,Integer> getIntervalRangesWithIDForChrom(String chrom)
PHGDatagetIntervalRangesWithIDForChrom in interface PHGDatapublic List<String> getChromNamesForHaplotype(String line_name, int hap_number, String version)
PHGDatagetChromNamesForHaplotype in interface PHGDataversion - Version name for anchorspublic Map<String,Integer> getHapidMapFromLinenameHapNumber()
PHGDatagetHapidMapFromLinenameHapNumber in interface PHGDatapublic Map<Integer,byte[]> getHapCountsIDAndPathsForMethod(String method)
PHGDatagetHapCountsIDAndPathsForMethod in interface PHGDatapublic Map<Integer,net.maizegenetics.util.Tuple<String,byte[]>> getHapCountsIDAndDataForVersionMethod(String method)
PHGDatagetHapCountsIDAndDataForVersionMethod in interface PHGDatapublic int putMethod(String name, DBLoadingUtils.MethodType type, String description)
PHGDataWriterputMethod in interface PHGDataWriterpublic boolean putGameteGroupAndHaplotypes(List<String> gametes)
PHGDataWriterputGameteGroupAndHaplotypes in interface PHGDataWritergametes - list consisting of taxa/gamete number in the form taxaName_gameteNumberpublic boolean putAllAnchors(List<AnchorDataPHG> adata, String refGroupMethod)
PHGDataWriterputAllAnchors in interface PHGDataWriterrefGroupMethod - name of method used for creating this ref_range_grouppublic int createRefRangeGroup(String method)
PHGDataWritercreateRefRangeGroup in interface PHGDataWriterpublic void putRefRangeRefRangeGroups(int group_method_id,
List<Integer> refRangeIDList)
PHGDataWriterputRefRangeRefRangeGroups in interface PHGDataWriterpublic boolean putGenoAndHaploTypeData(GenoHaploData ghData)
PHGDataWriterputGenoAndHaploTypeData in interface PHGDataWriterpublic boolean putRefAnchorData(String line_name, int hapnumber, List<AnchorDataPHG> anchorData, String hapMethod, String refGrpMethod, String gvcf, String variant_list)
PHGDataWriterputRefAnchorData in interface PHGDataWriteranchorData - Anchor data, including chrom, start/end positionshapMethod - Name of method used to create anchors. Maps to method table for id.refGrpMethod - Name of method used to create the ref_range_groupgvcf - String - name of gvcf filevariant_list - String - name of file containing list of variantspublic void putHaplotypesForMultipleGroups(com.google.common.collect.Multimap<net.maizegenetics.dna.map.Position,net.maizegenetics.util.Tuple<AnchorDataPHG,String>> mapWithGroupHash, int method_id)
PHGDataWriterputHaplotypesForMultipleGroups in interface PHGDataWritermethod_id - Id in the methods table for this group of sequencespublic void putHaplotypesForGamete(int gamete_grp_id,
String method,
Map<Integer,AnchorDataPHG> anchorSequences)
PHGDataWriterputHaplotypesForGamete in interface PHGDataWriterpublic void putConsensusSequences(com.google.common.collect.Multimap<net.maizegenetics.dna.map.Position,net.maizegenetics.util.Tuple<AnchorDataPHG,List<String>>> consensusMap, int method_id)
PHGDataWriterputConsensusSequences in interface PHGDataWriterconsensusMap - Multimapmethod_id - method used for collapsing anchorspublic void putHaplotypeCountsData(String method, String methodDetails, String taxonName, String fastqFile, byte[] counts)
PHGDataWriterputHaplotypeCountsData in interface PHGDataWriterpublic void putPathsData(String method, String methodDetails, com.google.common.collect.Multimap<Integer,HaplotypeNode> paths)
PHGDataWriterputPathsData in interface PHGDataWritermethod - - Method Name for Path detemination processmethodDetails - Details of how these paths were createdpaths - Compressed byte array of HaplotypeNode idspublic boolean putAssemblyInterAnchorSequences(String line_name, int hapNumber, String method, com.google.common.collect.Multimap<Integer,AnchorDataPHG> anchorSequences)
PHGDataWriterputAssemblyInterAnchorSequences in interface PHGDataWriterpublic void close()
throws Exception
close in interface AutoCloseableExceptionCopyright © 2018. All rights reserved.