Ejemplo n.º 1
0
static int read_DB(DAZZ_DB *block, char *name, int kmer)
{ int i, isdam;

  isdam = Open_DB(name,block);
  if (isdam < 0)
    Clean_Exit(1);

  Trim_DB(block);

  if (block->cutoff < kmer)
    { for (i = 0; i < block->nreads; i++)
        if (block->reads[i].rlen < kmer)
          { fprintf(stderr,"%s: Block %s contains reads < %dbp long !  Run DBsplit.\n",
                           Prog_Name,name,kmer);
            Clean_Exit(1);
          }
    }

  Read_All_Sequences(block,0);

  return (isdam);
}
Ejemplo n.º 2
0
static HITS_DB *read_DB(char *name, int dust)
{ static HITS_DB  block;
  HITS_TRACK     *dtrack;

  if (Open_DB(name,&block))
    exit (1);

  if (dust)
    dtrack = Load_Track(&block,"dust");
  else
    dtrack = NULL;

  Trim_DB(&block);

  if (block.totlen > 0x7fffffffll)
    { fprintf(stderr,"File (%s) is too large\n",name);
      exit (1);
    }
  if (block.nreads > 0xffff)
    { fprintf(stderr,"There are more than %d reads in file (%s)\n",0xffff,name);
      exit (1);
    }
  if (block.maxlen > 0xffff)
    { fprintf(stderr,"Reads are over %d bases long in file (%s)\n",0xffff,name);
      exit (1);
    }

  Read_All_Sequences(&block,0);

  if (dtrack != NULL)
    { int *anno = (int *) (dtrack->anno); 
      int  i;

      for (i = 0; i <= block.nreads; i++)
        anno[i] /= sizeof(int);
    }

  return (&block);
}
Ejemplo n.º 3
0
static int read_DB(HITS_DB *block, char *name, char **mask, int *mstat, int mtop, int kmer)
{ int i, isdam, status, kind, stop;

  isdam = Open_DB(name,block);
  if (isdam < 0)
    exit (1);

  for (i = 0; i < mtop; i++)
    { status = Check_Track(block,mask[i],&kind);
      if (status >= 0)
        if (kind == MASK_TRACK)
          mstat[i] = 0;
        else
          mstat[i] = -3;
      else
        mstat[i] = status;
      if (status == 0 && kind == MASK_TRACK)
        Load_Track(block,mask[i]);
    }

  Trim_DB(block);

  stop = 0;
  for (i = 0; i < mtop; i++)
    { HITS_TRACK *track;
      int64      *anno;
      int         j;

      status = Check_Track(block,mask[i],&kind);
      if (status < 0 || kind != MASK_TRACK)
        continue;
      stop += 1;
      track = Load_Track(block,mask[i]);

      anno = (int64 *) (track->anno); 
      for (j = 0; j <= block->nreads; j++)
        anno[j] /= sizeof(int);
    }

  if (stop > 1)
    { int64       nsize;
      HITS_TRACK *track;

      nsize = Merge_Size(block,stop);
      track = Merge_Tracks(block,stop,nsize);

      while (block->tracks != NULL)
        Close_Track(block,block->tracks->name);

      block->tracks = track;
    }

  if (block->cutoff < kmer)
    { for (i = 0; i < block->nreads; i++)
        if (block->reads[i].rlen < kmer)
          { fprintf(stderr,"%s: Block %s contains reads < %dbp long !  Run DBsplit.\n",
                           Prog_Name,name,kmer);
            exit (1);
          }
    }

  Read_All_Sequences(block,0);

  return (isdam);
}