Bug in setContig() fixed: sequence dictionary's .getSequences().contains() and .getSequences().indexOf() do NOT work when applied to contig names (Strings), since getSequences() returns a list of SAMSequenceRecord's; changed to querying the dictionary directly for specified contig name

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@1147 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
asivache 2009-07-01 20:50:09 +00:00
parent 76fd4b3848
commit 7462f3f344
1 changed files with 4 additions and 2 deletions

View File

@ -487,10 +487,12 @@ public class GenomeLocParser {
*/
public static GenomeLoc setContig(GenomeLoc loc, String contig) {
checkSetup();
if (!GenomeLocParser.contigInfo.getSequences().contains(contig)) {
int index = -1;
if ( ( index = contigInfo.getSequenceIndex(contig) ) < 0 ) {
throw new StingException("Contig name ( " + contig + " ) not in the set sequence dictionary.");
}
return verifyGenomeLoc(new GenomeLoc(contig, GenomeLocParser.contigInfo.getSequences().indexOf(contig), loc.start, loc.getStop()));
return verifyGenomeLoc(new GenomeLoc(contig, index, loc.start, loc.getStop()));
}
/** Sets contig index. UNSAFE since it 1) does NOT update contig name; 2) does not validate the index