Skip to content

Commit

Permalink
Add import of paf format, fix paf dump which was missing () for prope…
Browse files Browse the repository at this point in the history
…r operation order, add identity to paf dump
  • Loading branch information
skoren committed Jun 28, 2019
1 parent 7733c8c commit 360a37d
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/overlapInCore/overlapImport.C
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ main(int argc, char **argv) {
fprintf(stderr, " -coords as coordinates on each read (default)\n");
fprintf(stderr, " -hangs as dovetail hangs\n");
fprintf(stderr, " -unaligned as unaligned regions on each read\n");
fprintf(stderr, " -paf as miniasm Pairwise mApping Format (NOT IMPLEMENTED)\n");
fprintf(stderr, " -paf as miniasm Pairwise mApping Format\n");
fprintf(stderr, "\n");
fprintf(stderr, "READ VERSION:\n");
fprintf(stderr, " -raw uncorrected raw reads\n");
Expand Down
39 changes: 36 additions & 3 deletions src/stores/ovOverlap.C
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,15 @@ ovOverlap::toString(char *str,
case ovOverlapAsPaf:
// miniasm/map expects entries to be separated by tabs
// no padding spaces on names we don't confuse read identifiers
sprintf(str, "%" F_U32P "\t%6" F_U32P "\t%6" F_U32P "\t%6" F_U32P "\t%c\t%" F_U32P "\t%6" F_U32P "\t%6" F_U32P "\t%6" F_U32P "\t%6" F_U32P "\t%6" F_U32P "\t%6" F_U32P " %s",
sprintf(str, "%" F_U32P "\t%6" F_U32P "\t%6" F_U32P "\t%6" F_U32P "\t%c\t%" F_U32P "\t%6" F_U32P "\t%6" F_U32P "\t%6" F_U32P "\t%6" F_U32P "\t%6" F_U32P "\t%6" F_U32P " \tdv:f:%6.4f%s",
a_iid,
(g->sqStore_getRead(a_iid)->sqRead_sequenceLength()), a_bgn(), a_end(),
flipped() ? '-' : '+',
b_iid,
(g->sqStore_getRead(b_iid)->sqRead_sequenceLength()), flipped() ? b_end() : b_bgn(), flipped() ? b_bgn() : b_end(),
(uint32)floor(span() == 0 ? (1-erate() * (a_end()-a_bgn())) : (1-erate()) * span()),
(uint32)floor(span() == 0 ? ((1-erate()) * (a_end()-a_bgn())) : (1-erate()) * span()),
span() == 0 ? a_end() - a_bgn() : span(),
255,
255, erate(),
(newLine) ? "\n" : "");
break;
}
Expand Down Expand Up @@ -178,6 +178,39 @@ ovOverlap::fromString(splitToWords &W,
break;

case ovOverlapAsPaf:
a_iid = W.touint32(0);
b_iid = W.touint32(5);

flipped(W[4][0] == '-');

dat.ovl.span = W.touint32(3)-W.toint32(2);

uint32 alen = W.toint32(1);
uint32 blen = W.toint32(6);

uint32 abgn = W.touint32(2);
uint32 aend = W.touint32(3);

// paf looks like our coord format but the start/end aren't decreasing like ours so flip them then we can use the same math below
uint32 bbgn = (dat.ovl.flipped) ? W.touint32(8) : W.touint32(7);
uint32 bend = (dat.ovl.flipped) ? W.touint32(7) : W.touint32(8);

dat.ovl.ahg5 = abgn;
dat.ovl.ahg3 = alen - aend;

dat.ovl.bhg5 = (dat.ovl.flipped) ? blen-bbgn : bbgn;
dat.ovl.bhg3 = (dat.ovl.flipped) ? bend : blen - bend;

for (int i = 0; i < W.numWords(); i++) {
if (W[i][0] == 'd' && W[i][1] == 'v' && W[i][3] == 'f') {
erate(strtodouble(W[i]+5));
break;
}
}

dat.ovl.forUTG = true;
dat.ovl.forOBT = true;
dat.ovl.forDUP = true;
break;
}

Expand Down

0 comments on commit 360a37d

Please sign in to comment.