/* Returns true if the given MSP should be shown in this exon view */
static gboolean showMspInExonView(const MSP *msp, DrawData *drawData)
{
  /* Check it's an exon or intron */
  gboolean showMsp = mspIsExon(msp) || mspIsIntron(msp);
  
  /* Check it's in a visible layer */
  showMsp &= mspLayerIsVisible(msp);
  
  /* Check it's the correct strand */
  showMsp &= (mspGetRefStrand(msp) == drawData->strand);

  /* Check it's for the correct sequence */
  if (drawData->horizontal)
    showMsp &= stringsEqual(msp->qname, drawData->dc->refSeqName, FALSE);
  else
    showMsp &= stringsEqual(msp->qname, drawData->dc->matchSeqName, FALSE);
  
  return showMsp;
}
Ejemplo n.º 2
0
void StringHash::SetSize(int newsize)
{
    int newmask = newsize - 1;

    String   ** newstrings = new String * [newsize];
    void     ** newobjects = new void * [newsize];
    unsigned int * newkeys = new unsigned int [newsize];

    for (int i = 0; i < newsize; i++)
    {
        newstrings[i] = NULL;
        newobjects[i] = NULL;
    }

    if (count)
        for (unsigned int i = 0; i < size; i++)
            if (strings[i] != NULL)
            {
                unsigned int key = keys[i];
                unsigned int h   = key & newmask;

                while (newstrings[h] != NULL &&
                        (newkeys[h] != key || 
                         (!stringsEqual(*(newstrings[h]), *(strings[i])))))
                    h = (h + 1) & newmask;

                newkeys[h] = key;
                newstrings[h] = strings[i];
                newobjects[h] = objects[i];
            }

    if(strings) delete [] strings;
    if(objects) delete [] objects;
    if(keys) delete [] keys;

    strings = newstrings;
    objects = newobjects;
    keys = newkeys;
    size = newsize;
    mask = newmask;
}
Ejemplo n.º 3
0
void StringDoubleHash::SetSize(int newsize)
{
    int newmask = newsize - 1;

    String   ** newstrings = new String * [newsize];
    double    * newdoubles = new double [newsize];
    unsigned int * newkeys = new unsigned int [newsize];

    for (int i = 0; i < newsize; i++)
        newstrings[i] = NULL;

    for (unsigned int i = 0; i < size; i++)
        if (strings[i] != NULL)
        {
            unsigned int key = keys[i];
            unsigned int h   = key & newmask;

            while (newstrings[h] != NULL &&
                    (newkeys[h] != key || (!stringsEqual(*(newstrings[h]), *(strings[i])))))
                h = (h + 1) & newmask;

            newkeys[h] = key;
            newstrings[h] = strings[i];
            newdoubles[h] = doubles[i];
        }

    if(strings) delete [] strings;
    if(doubles) delete [] doubles;
    if(keys) delete [] keys;

    strings = newstrings;
    doubles = newdoubles;
    keys = newkeys;
    size = newsize;
    mask = newmask;
}