0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7,
})
}
+
+ f, err = os.Open(npydir + "/onehot-columns.npy")
+ c.Assert(err, check.IsNil)
+ defer f.Close()
+ npy, err = gonpy.NewReader(f)
+ c.Assert(err, check.IsNil)
+ c.Check(npy.Shape, check.DeepEquals, []int{8, 5})
+ onehotcols, err := npy.GetInt32()
+ if c.Check(err, check.IsNil) {
+ for r := 0; r < npy.Shape[0]; r++ {
+ c.Logf("%v", onehotcols[r*npy.Shape[1]:(r+1)*npy.Shape[1]])
+ }
+ c.Check(onehotcols, check.DeepEquals, []int32{
+ 0, 0, 1, 4, 4, 4, 6, 6,
+ 2, 3, 2, 2, 3, 4, 2, 3,
+ 0, 1, 0, 0, 0, 0, 0, 0,
+ 157299, 157299, 157299, 157299, 157299, 157299, 157299, 157299,
+ 803273, 803273, 803273, 803273, 803273, 803273, 803273, 803273,
+ })
+ }
}
}
return 1
}
fnm = fmt.Sprintf("%s/onehot-columns.npy", *outputDir)
- err = writeNumpyInt32(fnm, onehotXref2int32(xrefs), 4, len(xrefs))
+ err = writeNumpyInt32(fnm, onehotXref2int32(xrefs), 5, len(xrefs))
if err != nil {
return 1
}
// P-value row contains 1000000x actual p-value.
func onehotXref2int32(xrefs []onehotXref) []int32 {
xcols := len(xrefs)
- xdata := make([]int32, 4*xcols)
+ xdata := make([]int32, 5*xcols)
for i, xref := range xrefs {
xdata[i] = int32(xref.tag)
xdata[xcols+i] = int32(xref.variant)
xdata[xcols*2+i] = 1
}
xdata[xcols*3+i] = int32(xref.pvalue * 1000000)
+ xdata[xcols*4+i] = int32(-math.Log10(xref.pvalue) * 1000000)
}
return xdata
}