public synchronized void processCas(CAS aCAS) throws ResourceProcessException {
    JCas jcas;
    try {
      jcas = aCAS.getJCas();
    } catch (CASException e) {
      throw new ResourceProcessException(e);
    }
    
    /*Code added try to iterate over annotations
     *Retrieve the built index, iterate over the annotations
     *Generate the output in the required form */
	FSIndex anIndex = jcas.getAnnotationIndex(Sentence.type);
	FSIterator anIter = anIndex.iterator();
    while (anIter.isValid()) {
      Sentence annot = (Sentence) anIter.get();
      try {
    	  
    	//Code snippet to find number of spaces in the obtained gene
    	int cnt=1;
    	String geneName=annot.getGeneName();
    	for(int i=0;i<geneName.length();i++)
    	{
    		if(geneName.charAt(i)==' ')
    			cnt=cnt+1;
    	}
    	//Retrieve features and display them in the required format
    	//System.out.println("writing");
    	//System.out.println((String) getUimaContext().getConfigParameterValue("outputFile"));
		fileWriter.write(annot.getSentenceID() + "|" + 
						 annot.getGeneLoc() + ""  +
						 " " +(Integer.parseInt(annot.getGeneLoc()) + annot.getGeneName().length()-cnt) + "|" +
						 annot.getGeneName() + "\n");
	} catch (IOException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
      anIter.moveToNext();
    }
  }