Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions gortools/src/main/scala/gorsat/Analysis/GtGenAnalysis.scala
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ object GtGenAnalysis {
sh.buckValueCols(i).setLength(buckSize)
var j = 0
while (j < buckSize) {
sh.buckValueCols(i).setCharAt(j, '3') // Missing
sh.buckValueCols(i).setCharAt(j, '#') // Missing
j += 1
}
i += 1
Expand Down Expand Up @@ -180,7 +180,7 @@ object GtGenAnalysis {
if (!useGroup) groupMap += (-1 -> singleGroupHolder)

def set_coverage(lSeg: CovSEGinfo, rSeg: CovSEGinfo): Unit = {
if (lSeg.values.charAt(rSeg.buckPos) =='4') lSeg.values.setCharAt(rSeg.buckPos, '0')
if (lSeg.values.charAt(rSeg.buckPos) =='#') lSeg.values.setCharAt(rSeg.buckPos, '0')
}

def nested_process(lr: Row, next_lr: Row): Unit = {
Expand Down Expand Up @@ -291,7 +291,7 @@ object GtGenAnalysis {
}

//#######
super.process(RowObj(s"${lr.colsSlice(0, bucketCol+1)}\t${lSeg.values.toString() }"))
super.process(RowObj(s"${lr.colsSlice(0, bucketCol+1)}\t${lSeg.values.toString().replace('#','3') }"))

if ((lr.chr == lastLeftChr && maxLeftStop < leftStop) || lr.chr != lastLeftChr) maxLeftStop = leftStop
lastLeftChr = lr.chr
Expand Down
15 changes: 15 additions & 0 deletions gortools/src/test/java/gorsat/gtgen/UTestGTGen.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package gorsat.gtgen;

import gorsat.TestUtils;
import org.junit.Assert;
import org.junit.Test;

Expand Down Expand Up @@ -232,4 +233,18 @@ public void test_getAn() {
gtGen.setPrior(0.01, 1000);
Assert.assertEquals(1001, gtGen.getAn());
}

@Test
public void testGTGENunknown() {
TestUtils.runGorPipe("""
create #vars# = gorrow chr1,1 | calc ref 'A,A' | calc alt 'C,C' | calc GT '1,1' | calc pn 'pn1,pn2' | split ref,alt,gt,pn;
create #goodcov# = gorrow chr1,0,3 | calc pn 'pn1,pn2' | split pn;
create #bucket# = nor [#vars#] | select pn | calc bucket 'b1';

gor [#vars#] | gtgen -gc ref,alt [#bucket#] [#goodcov#] | throwif values != '11'
| merge <(gor [#vars#] | where pn != 'pn2' | gtgen -gc ref,alt [#bucket#] [#goodcov#] | throwif values != '10')
| merge <(gor [#vars#] | where pn != 'pn2' | gtgen -gc ref,alt [#bucket#] <(gor [#goodcov#] | where pn != 'pn2') | throwif values != '13')
""" );
}

}
Loading