Fixed bug in retaining proper RefSeq records
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@4768 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
7caf666f48
commit
9ac0f98d0d
|
|
@ -150,6 +150,7 @@ public class MergeSegregatingAlternateAllelesVCFWriter implements VCFWriter {
|
||||||
else { // waiting to merge vcfrWaitingToMerge, and curVcIsNotFiltered. So, attempt to merge them:
|
else { // waiting to merge vcfrWaitingToMerge, and curVcIsNotFiltered. So, attempt to merge them:
|
||||||
numRecordsAttemptToMerge++;
|
numRecordsAttemptToMerge++;
|
||||||
boolean shouldAttemptToMerge = vcMergeRule.shouldAttemptToMerge(vcfrWaitingToMerge.vc, vc);
|
boolean shouldAttemptToMerge = vcMergeRule.shouldAttemptToMerge(vcfrWaitingToMerge.vc, vc);
|
||||||
|
logger.debug("shouldAttemptToMerge? = " + shouldAttemptToMerge);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
TODO: -- CONSIDER THE FOLLOWING EXAMPLE: WHAT DO WE WANT HERE??? --
|
TODO: -- CONSIDER THE FOLLOWING EXAMPLE: WHAT DO WE WANT HERE??? --
|
||||||
|
|
|
||||||
|
|
@ -46,11 +46,23 @@ public class RefSeqDataParser {
|
||||||
Map<String, String> entriesToNames = new HashMap<String, String>();
|
Map<String, String> entriesToNames = new HashMap<String, String>();
|
||||||
Integer numRecords = vc.getAttributeAsIntegerNoException(NUM_RECORDS_KEY);
|
Integer numRecords = vc.getAttributeAsIntegerNoException(NUM_RECORDS_KEY);
|
||||||
if (numRecords != null) {
|
if (numRecords != null) {
|
||||||
for (int i = 1; i <= numRecords; i++) {
|
boolean done = false;
|
||||||
String key = nameKeyToUseMultiplePrefix + i;
|
|
||||||
String name = vc.getAttributeAsStringNoException(key);
|
if (numRecords == 1) { // Check if perhaps the single record doesn't end with "_1":
|
||||||
if (name != null)
|
String name = vc.getAttributeAsStringNoException(nameKeyToUse);
|
||||||
entriesToNames.put(key, name);
|
if (name != null) {
|
||||||
|
entriesToNames.put(nameKeyToUse, name);
|
||||||
|
done = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!done) {
|
||||||
|
for (int i = 1; i <= numRecords; i++) {
|
||||||
|
String key = nameKeyToUseMultiplePrefix + i;
|
||||||
|
String name = vc.getAttributeAsStringNoException(key);
|
||||||
|
if (name != null)
|
||||||
|
entriesToNames.put(key, name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else { // no entry with the # of records:
|
else { // no entry with the # of records:
|
||||||
|
|
@ -90,7 +102,7 @@ public class RefSeqDataParser {
|
||||||
Set<String> commonNames = entriesMap1.keySet();
|
Set<String> commonNames = entriesMap1.keySet();
|
||||||
commonNames.retainAll(entriesMap2.keySet());
|
commonNames.retainAll(entriesMap2.keySet());
|
||||||
boolean addSuffix = commonNames.size() > 1;
|
boolean addSuffix = commonNames.size() > 1;
|
||||||
int count = 1;
|
int nextCount = 1;
|
||||||
|
|
||||||
for (String name : commonNames) {
|
for (String name : commonNames) {
|
||||||
RefSeqEntry refseq1 = entriesMap1.get(name);
|
RefSeqEntry refseq1 = entriesMap1.get(name);
|
||||||
|
|
@ -98,7 +110,7 @@ public class RefSeqDataParser {
|
||||||
|
|
||||||
String keySuffix = "";
|
String keySuffix = "";
|
||||||
if (addSuffix)
|
if (addSuffix)
|
||||||
keySuffix = "_" + count;
|
keySuffix = "_" + nextCount;
|
||||||
|
|
||||||
boolean added = false;
|
boolean added = false;
|
||||||
for (String key : NAME_KEYS) {
|
for (String key : NAME_KEYS) {
|
||||||
|
|
@ -111,10 +123,11 @@ public class RefSeqDataParser {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (added)
|
if (added)
|
||||||
count++;
|
nextCount++;
|
||||||
}
|
}
|
||||||
if (count > 1)
|
int totalCount = nextCount - 1; // since incremented count one extra time
|
||||||
refSeqNameAttribs.put(NUM_RECORDS_KEY, count - 1); // since incremented count one extra time
|
if (totalCount > 1)
|
||||||
|
refSeqNameAttribs.put(NUM_RECORDS_KEY, totalCount);
|
||||||
|
|
||||||
return refSeqNameAttribs;
|
return refSeqNameAttribs;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue