-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
change the partial members of genomix-data, genomix-hyracks for adapting ray-style #60
Changes from 9 commits
cb22472
ec2081e
1661432
9c26dc2
d672c7a
9db851c
0b81fcc
d417ccf
547603f
8522c18
a8e0e32
90ebdfe
9affc37
87d90dd
59346bc
c90a6ee
1033803
30f7255
ce34294
5f1d6ae
8a6a000
524f258
a4cadb0
7887496
cbb120f
0995d14
f975ac2
e21ceea
97b5ce2
b227f65
30beef5
17886d9
cb84316
4ab3820
c4ead19
cce134f
9d9eec7
7b25a64
ed6733c
8d45898
85539b8
40846bc
14d7781
16523c3
9587903
cc8838d
3c7df0a
4acc66b
7d604bc
67add02
12b7a7a
603e47a
2566c8d
f7b170b
42a5bb2
246c623
6763566
e5099ac
cd7c12d
d1e1e4a
8cae514
9e2fdd6
2af7a94
4c61c2c
d96e25b
3048f59
e4ec721
79664c2
d3e3869
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,22 +67,22 @@ public static class NeighborInfo { | |
public ReadIdSet readIds; | ||
public VKmer kmer; | ||
|
||
public NeighborInfo(EDGETYPE edgeType, VKmer kmer, ReadIdSet readIds) { | ||
set(edgeType, kmer, readIds); | ||
public NeighborInfo(EDGETYPE edgeType, VKmer kmer) { | ||
set(edgeType, kmer); | ||
} | ||
|
||
public NeighborInfo(EDGETYPE edgeType, Entry<VKmer, ReadIdSet> edge) { | ||
set(edgeType, edge.getKey(), edge.getValue()); | ||
} | ||
// public NeighborInfo(EDGETYPE edgeType, VKmer edge) { | ||
// set(edgeType, edge.getKey(), edge.getValue()); | ||
// } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. just remove these... no point in having them commented out in the code. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
|
||
public void set(EDGETYPE edgeType, Entry<VKmer, ReadIdSet> edge) { | ||
set(edgeType, edge.getKey(), edge.getValue()); | ||
} | ||
// public void set(EDGETYPE edgeType, Entry<VKmer, ReadIdSet> edge) { | ||
// set(edgeType, edge.getKey(), edge.getValue()); | ||
// } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove commented out stuff There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
|
||
public void set(EDGETYPE edgeType, VKmer kmer, ReadIdSet readIds) { | ||
public void set(EDGETYPE edgeType, VKmer kmer) { | ||
this.et = edgeType; | ||
this.kmer = kmer; | ||
this.readIds = readIds; | ||
// this.readIds = readIds; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove commented out stuff There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
} | ||
|
||
public String toString() { | ||
|
@@ -96,9 +96,9 @@ public String toString() { | |
|
||
public static class NeighborsInfo implements Iterable<NeighborInfo> { | ||
public final EDGETYPE et; | ||
public final EdgeMap edges; | ||
public final VKmerList edges; | ||
|
||
public NeighborsInfo(EDGETYPE edgeType, EdgeMap edgeList) { | ||
public NeighborsInfo(EDGETYPE edgeType, VKmerList edgeList) { | ||
et = edgeType; | ||
edges = edgeList; | ||
} | ||
|
@@ -107,7 +107,7 @@ public NeighborsInfo(EDGETYPE edgeType, EdgeMap edgeList) { | |
public Iterator<NeighborInfo> iterator() { | ||
return new Iterator<NeighborInfo>() { | ||
|
||
private Iterator<Entry<VKmer, ReadIdSet>> it = edges.entrySet().iterator(); | ||
private Iterator<VKmer> it = edges.iterator(); | ||
|
||
private NeighborInfo info = null; | ||
|
||
|
@@ -138,7 +138,7 @@ public void remove() { | |
|
||
private static final int SIZE_FLOAT = 4; | ||
|
||
private EdgeMap[] edges = { null, null, null, null }; | ||
private VKmerList[] edges = { null, null, null, null }; | ||
|
||
private ReadHeadSet unflippedReadIds; // first internalKmer in read | ||
private ReadHeadSet flippedReadIds; // first internalKmer in read (but | ||
|
@@ -156,7 +156,7 @@ public void remove() { | |
public Node() { | ||
|
||
for (EDGETYPE e : EDGETYPE.values()) { | ||
edges[e.get()] = new EdgeMap(); | ||
edges[e.get()] = new VKmerList(); | ||
} | ||
unflippedReadIds = new ReadHeadSet(); | ||
flippedReadIds = new ReadHeadSet(); | ||
|
@@ -169,7 +169,7 @@ public Node() { | |
// this.stepCount = 0; | ||
} | ||
|
||
public Node(EdgeMap[] edges, ReadHeadSet unflippedReadIds, ReadHeadSet flippedReadIds, VKmer kmer, float coverage) { | ||
public Node(VKmerList[] edges, ReadHeadSet unflippedReadIds, ReadHeadSet flippedReadIds, VKmer kmer, float coverage) { | ||
this(); | ||
setAsCopy(edges, unflippedReadIds, flippedReadIds, kmer, coverage); | ||
} | ||
|
@@ -194,7 +194,7 @@ public void setAsCopy(Node node) { | |
setAsCopy(node.edges, node.unflippedReadIds, node.flippedReadIds, node.internalKmer, node.averageCoverage); | ||
} | ||
|
||
public void setAsCopy(EdgeMap[] edges, ReadHeadSet unflippedReadIds, ReadHeadSet flippedReadIds, VKmer kmer, | ||
public void setAsCopy(VKmerList[] edges, ReadHeadSet unflippedReadIds, ReadHeadSet flippedReadIds, VKmer kmer, | ||
float coverage) { | ||
for (EDGETYPE e : EDGETYPE.values()) { | ||
this.edges[e.get()].setAsCopy(edges[e.get()]); | ||
|
@@ -209,7 +209,7 @@ public void setAsCopy(EdgeMap[] edges, ReadHeadSet unflippedReadIds, ReadHeadSet | |
|
||
public void reset() { | ||
for (EDGETYPE e : EDGETYPE.values()) { | ||
edges[e.get()].clear(); | ||
edges[e.get()].reset(); | ||
} | ||
unflippedReadIds.clear(); | ||
flippedReadIds.clear(); | ||
|
@@ -236,7 +236,7 @@ public EDGETYPE getNeighborEdgeType(DIR direction) { | |
"getEdgetypeFromDir is used on the case, in which the vertex has and only has one EDGETYPE!"); | ||
EnumSet<EDGETYPE> ets = direction.edgeTypes(); | ||
for (EDGETYPE et : ets) { | ||
if (getEdgeMap(et).size() > 0) | ||
if (getEdgeList(et).size() > 0) | ||
return et; | ||
} | ||
throw new IllegalStateException("Programmer error: we shouldn't get here... Degree is 1 in " + direction | ||
|
@@ -251,8 +251,8 @@ public NeighborInfo getSingleNeighbor(DIR direction) { | |
return null; | ||
} | ||
for (EDGETYPE et : direction.edgeTypes()) { | ||
if (getEdgeMap(et).size() > 0) { | ||
return new NeighborInfo(et, getEdgeMap(et).firstEntry()); | ||
if (getEdgeList(et).size() > 0) { | ||
return new NeighborInfo(et, getEdgeList(et).getPosition(0)); | ||
} | ||
} | ||
throw new IllegalStateException("Programmer error!!!"); | ||
|
@@ -262,24 +262,24 @@ public NeighborInfo getSingleNeighbor(DIR direction) { | |
* Get this node's edgeType and edgeList in this given edgeType. Return null if there is no neighbor | ||
*/ | ||
public NeighborsInfo getNeighborsInfo(EDGETYPE et) { | ||
if (getEdgeMap(et).size() == 0) | ||
if (getEdgeList(et).size() == 0) | ||
return null; | ||
return new NeighborsInfo(et, getEdgeMap(et)); | ||
return new NeighborsInfo(et, getEdgeList(et)); | ||
} | ||
|
||
public EdgeMap getEdgeMap(EDGETYPE edgeType) { | ||
public VKmerList getEdgeList(EDGETYPE edgeType) { | ||
return edges[edgeType.get()]; | ||
} | ||
|
||
public void setEdgeMap(EDGETYPE edgeType, EdgeMap edgeMap) { | ||
public void setEdgeMap(EDGETYPE edgeType, VKmerList edgeMap) { | ||
this.edges[edgeType.get()].setAsCopy(edgeMap); | ||
} | ||
|
||
public EdgeMap[] getEdges() { | ||
public VKmerList[] getEdges() { | ||
return edges; | ||
} | ||
|
||
public void setEdges(EdgeMap[] edges) { | ||
public void setEdges(VKmerList[] edges) { | ||
this.edges = edges; | ||
} | ||
|
||
|
@@ -341,7 +341,7 @@ public void setFlippedReadIds(ReadHeadSet flippedReadIds) { | |
public int getSerializedLength() { | ||
int length = 0; | ||
for (EDGETYPE e : EnumSet.allOf(EDGETYPE.class)) { | ||
length += edges[e.get()].getLengthInBytes(); | ||
length += edges[e.get()].getLength(); | ||
} | ||
length += unflippedReadIds.getLengthInBytes(); | ||
length += flippedReadIds.getLengthInBytes(); | ||
|
@@ -364,7 +364,7 @@ public void setAsCopy(byte[] data, int offset) { | |
int curOffset = offset; | ||
for (EDGETYPE e : EnumSet.allOf(EDGETYPE.class)) { | ||
edges[e.get()].setAsCopy(data, curOffset); | ||
curOffset += edges[e.get()].getLengthInBytes(); | ||
curOffset += edges[e.get()].getLength(); | ||
} | ||
unflippedReadIds.setAsCopy(data, curOffset); | ||
curOffset += unflippedReadIds.getLengthInBytes(); | ||
|
@@ -379,7 +379,7 @@ public void setAsReference(byte[] data, int offset) { | |
int curOffset = offset; | ||
for (EDGETYPE e : EnumSet.allOf(EDGETYPE.class)) { | ||
edges[e.get()].setAsReference(data, curOffset); | ||
curOffset += edges[e.get()].getLengthInBytes(); | ||
curOffset += edges[e.get()].getLength(); | ||
} | ||
unflippedReadIds.setAsCopy(data, curOffset); | ||
curOffset += unflippedReadIds.getLengthInBytes(); | ||
|
@@ -537,11 +537,11 @@ protected void addUnflippedAndFlippedReadIds(boolean flip, final Node other) { | |
// stream theirs in, adjusting to the new total length | ||
for (ReadHeadInfo p : other.unflippedReadIds) { | ||
unflippedReadIds.add(p.getMateId(), p.getReadId(), | ||
(int) ((p.getOffset() + 1) * lengthFactor - lengthFactor)); | ||
(int) ((p.getOffset() + 1) * lengthFactor - lengthFactor), p.getReadSequenceSameWithMateId(), p.getReadSequenceDiffWithMateId()); | ||
} | ||
for (ReadHeadInfo p : other.flippedReadIds) { | ||
flippedReadIds.add(p.getMateId(), p.getReadId(), | ||
(int) ((p.getOffset() + 1) * lengthFactor - lengthFactor)); | ||
(int) ((p.getOffset() + 1) * lengthFactor - lengthFactor), p.getReadSequenceSameWithMateId(), p.getReadSequenceDiffWithMateId()); | ||
} | ||
} else { | ||
// int newOtherOffset = (int) ((otherLength - 1) * lengthFactor); | ||
|
@@ -550,12 +550,12 @@ protected void addUnflippedAndFlippedReadIds(boolean flip, final Node other) { | |
for (ReadHeadInfo p : other.unflippedReadIds) { | ||
newPOffset = otherLength - 1 - p.getOffset(); | ||
flippedReadIds | ||
.add(p.getMateId(), p.getReadId(), (int) ((newPOffset + 1) * lengthFactor - lengthFactor)); | ||
.add(p.getMateId(), p.getReadId(), (int) ((newPOffset + 1) * lengthFactor - lengthFactor), p.getReadSequenceSameWithMateId(), p.getReadSequenceDiffWithMateId()); | ||
} | ||
for (ReadHeadInfo p : other.flippedReadIds) { | ||
newPOffset = otherLength - 1 - p.getOffset(); | ||
unflippedReadIds.add(p.getMateId(), p.getReadId(), | ||
(int) ((newPOffset + 1) * lengthFactor - lengthFactor)); | ||
(int) ((newPOffset + 1) * lengthFactor - lengthFactor), p.getReadSequenceSameWithMateId(), p.getReadSequenceDiffWithMateId()); | ||
} | ||
} | ||
} | ||
|
@@ -641,50 +641,50 @@ protected void mergeUnflippedAndFlippedReadIDs(EDGETYPE edgeType, Node other) { | |
newOtherOffset = thisLength - K + 1; | ||
// stream theirs in with my offset | ||
for (ReadHeadInfo p : other.unflippedReadIds) { | ||
unflippedReadIds.add(p.getMateId(), p.getReadId(), newOtherOffset + p.getOffset()); | ||
unflippedReadIds.add(p.getMateId(), p.getReadId(), newOtherOffset + p.getOffset(), p.getReadSequenceSameWithMateId(), p.getReadSequenceDiffWithMateId()); | ||
} | ||
for (ReadHeadInfo p : other.flippedReadIds) { | ||
flippedReadIds.add(p.getMateId(), p.getReadId(), newOtherOffset + p.getOffset()); | ||
flippedReadIds.add(p.getMateId(), p.getReadId(), newOtherOffset + p.getOffset(), p.getReadSequenceSameWithMateId(), p.getReadSequenceDiffWithMateId()); | ||
} | ||
break; | ||
case FR: | ||
newOtherOffset = thisLength - K + otherLength; | ||
// stream theirs in, offset and flipped | ||
for (ReadHeadInfo p : other.unflippedReadIds) { | ||
flippedReadIds.add(p.getMateId(), p.getReadId(), newOtherOffset - p.getOffset()); | ||
flippedReadIds.add(p.getMateId(), p.getReadId(), newOtherOffset - p.getOffset(), p.getReadSequenceSameWithMateId(), p.getReadSequenceDiffWithMateId()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sorry, what's mean of copyWithNewOffset()? you mean add a new function? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah. the |
||
} | ||
for (ReadHeadInfo p : other.flippedReadIds) { | ||
unflippedReadIds.add(p.getMateId(), p.getReadId(), newOtherOffset - p.getOffset()); | ||
unflippedReadIds.add(p.getMateId(), p.getReadId(), newOtherOffset - p.getOffset(), p.getReadSequenceSameWithMateId(), p.getReadSequenceDiffWithMateId()); | ||
} | ||
break; | ||
case RF: | ||
newThisOffset = otherLength - K + 1; | ||
newOtherOffset = otherLength - 1; | ||
// shift my offsets (other is prepended) | ||
for (ReadHeadInfo p : unflippedReadIds) { | ||
p.set(p.getMateId(), p.getReadId(), newThisOffset + p.getOffset()); | ||
p.set(p.getMateId(), p.getReadId(), newThisOffset + p.getOffset(), p.getReadSequenceSameWithMateId(), p.getReadSequenceDiffWithMateId()); | ||
} | ||
for (ReadHeadInfo p : flippedReadIds) { | ||
p.set(p.getMateId(), p.getReadId(), newThisOffset + p.getOffset()); | ||
p.set(p.getMateId(), p.getReadId(), newThisOffset + p.getOffset(), p.getReadSequenceSameWithMateId(), p.getReadSequenceDiffWithMateId()); | ||
} | ||
// System.out.println(startReads.size()); | ||
// System.out.println(endReads.size()); | ||
//stream theirs in, not offset (they are first now) but flipped | ||
for (ReadHeadInfo p : other.unflippedReadIds) { | ||
flippedReadIds.add(p.getMateId(), p.getReadId(), newOtherOffset - p.getOffset()); | ||
flippedReadIds.add(p.getMateId(), p.getReadId(), newOtherOffset - p.getOffset(), p.getReadSequenceSameWithMateId(), p.getReadSequenceDiffWithMateId()); | ||
} | ||
for (ReadHeadInfo p : other.flippedReadIds) { | ||
unflippedReadIds.add(p.getMateId(), p.getReadId(), newOtherOffset - p.getOffset()); | ||
unflippedReadIds.add(p.getMateId(), p.getReadId(), newOtherOffset - p.getOffset(), p.getReadSequenceSameWithMateId(), p.getReadSequenceDiffWithMateId()); | ||
} | ||
break; | ||
case RR: | ||
newThisOffset = otherLength - K + 1; | ||
// shift my offsets (other is prepended) | ||
for (ReadHeadInfo p : unflippedReadIds) { | ||
p.set(p.getMateId(), p.getReadId(), newThisOffset + p.getOffset()); | ||
p.set(p.getMateId(), p.getReadId(), newThisOffset + p.getOffset(), p.getReadSequenceSameWithMateId(), p.getReadSequenceDiffWithMateId()); | ||
} | ||
for (ReadHeadInfo p : flippedReadIds) { | ||
p.set(p.getMateId(), p.getReadId(), newThisOffset + p.getOffset()); | ||
p.set(p.getMateId(), p.getReadId(), newThisOffset + p.getOffset(), p.getReadSequenceSameWithMateId(), p.getReadSequenceDiffWithMateId()); | ||
} | ||
for (ReadHeadInfo p : other.unflippedReadIds) { | ||
unflippedReadIds.add(p); | ||
|
@@ -701,8 +701,8 @@ protected void mergeUnflippedAndFlippedReadIDs(EDGETYPE edgeType, Node other) { | |
*/ | ||
public NeighborInfo findEdge(final VKmer kmer) { | ||
for (EDGETYPE et : EDGETYPE.values()) { | ||
if (edges[et.get()].containsKey(kmer)) { | ||
return new NeighborInfo(et, kmer, edges[et.get()].get(kmer)); | ||
if (edges[et.get()].contains(kmer)) { | ||
return new NeighborInfo(et, kmer); | ||
} | ||
} | ||
return null; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@anbangx since there are no readids on the edges in this version, we'll have to reconsider what
DIRECTED_GRAPH_WITH_ALLDETAILS
now means. Perhaps it should print theinternalKmer
instead of the key?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jakebiesinger WITH_ALLDETAILS includes all the other fields inside the node, this key is only for edge connection.