Skip to content

Commit

Permalink
Use ratio when computing the unitig positions within contigs too
Browse files Browse the repository at this point in the history
  • Loading branch information
skoren committed Nov 14, 2019
1 parent 43ddb77 commit 39afb6d
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions src/gfa/alignGFA.C
Original file line number Diff line number Diff line change
Expand Up @@ -476,19 +476,23 @@ checkRecord_align(char *label,
bool
checkRecord(bedRecord *record,
sequences &ctgs,
sequences &ctgs_orig,
sequences &utgs,
sequences &utgs_orig,
bool beVerbose,
bool UNUSED(doPlot)) {

char *Aseq = ctgs[record->_Aid].seq;
char *Bseq = utgs[record->_Bid].seq, *Brev = NULL;

int32 Abgn = record->_bgn;
int32 Aend = record->_end;

int32 Alen = ctgs[record->_Aid].len;
int32 Blen = utgs[record->_Bid].len;

double ratio = max((double)Alen/ctgs_orig[record->_Aid].len, (double)Blen/utgs_orig[record->_Bid].len);

int32 Abgn = (int32)(ceil(record->_bgn*ratio));
int32 Aend = (int32)(ceil(record->_end*ratio));

bool success = true;
int32 alignScore = 0;

Expand Down Expand Up @@ -688,11 +692,21 @@ processBED(char *tigName,

bedFile *bed = new bedFile(inBED);

fprintf(stderr, "-- Loading sequences from tigStore '%s' version %u.\n", tigName, tigVers-1);

sequences *utgs_origp = new sequences(tigName, tigVers-1);
sequences &utgs_orig = *utgs_origp;

fprintf(stderr, "-- Loading sequences from tigStore '%s' version %u.\n", tigName, tigVers);

sequences *utgsp = new sequences(tigName, tigVers);
sequences &utgs = *utgsp;

fprintf(stderr, "-- Loading sequences from tigStore '%s' version %u.\n", seqName, seqVers-1);

sequences *ctgs_origp = new sequences(seqName, seqVers-1);
sequences &ctgs_orig = *ctgs_origp;

fprintf(stderr, "-- Loading sequences from tigStore '%s' version %u.\n", seqName, seqVers);

sequences *ctgsp = new sequences(seqName, seqVers);
Expand All @@ -713,7 +727,7 @@ processBED(char *tigName,
for (uint32 ii=0; ii<iiLimit; ii++) {
bedRecord *record = bed->_records[ii];

if (checkRecord(record, ctgs, utgs, (verbosity > 0), false)) {
if (checkRecord(record, ctgs, ctgs_orig, utgs, utgs_orig, (verbosity > 0), false)) {
pass++;
} else {
delete bed->_records[ii];
Expand Down

0 comments on commit 39afb6d

Please sign in to comment.