List<Feature> features = getFeatures(chr);
if (features != null) {
long offset = genome.getCumulativeOffset(chr);
for (Feature feature : features) {
if (feature instanceof IGVFeature) {
IGVFeature f = (IGVFeature) feature;
int genStart = (int) ((offset + f.getStart()) / 1000);
int genEnd = (int) ((offset + f.getEnd()) / 1000);
if (genEnd > lastFeaturePosition + sampleLength) {
BasicFeature f2 = new BasicFeature(Globals.CHR_ALL, genStart, genEnd);
if (f instanceof BasicFeature) {
BasicFeature bf = (BasicFeature) f;
f2.setThickEnd((int) ((offset + bf.getThickEnd()) / 1000));
f2.setThickStart((int) ((offset + bf.getThickStart()) / 1000));
f2.setName(f.getName());
}
chrAllFeatures.add(f2);
lastFeaturePosition = genEnd;
}