code: public static ProteinSequence removeGaps(ProteinSequence gapped) {
  		final String[] gapStrings = {"-","."};
  
  		StringBuilder seq = new StringBuilder();
  
  		CompoundSet<AminoAcidCompound> aaSet = gapped.getCompoundSet();
  		AminoAcidCompound[] gaps = new AminoAcidCompound[gapStrings.length];
  
  		for(int i=0;i<gapStrings.length;i++) {
  			gaps[i] = aaSet.getCompoundForString(gapStrings[i]);
  		}
  
  		for(int i=1; i<=gapped.getLength();i++) { //1-indexed
  			AminoAcidCompound aa = gapped.getCompoundAt(i);
  			boolean isGap = false;
  			for(AminoAcidCompound gap : gaps) {
  				if( aa.equals(gap)) {
  					isGap = true;
  					break;
  				}
  			}
  			if(!isGap) {
  				seq.append(aa.getShortName());
  			}
  		}
  
  		ProteinSequence ungapped = null;
  		try {
  			ungapped = new ProteinSequence(seq.toString());
  		} catch (CompoundNotFoundException e) {
  			// this can't happen, if it does there's a bug somewhere
  			logger.error("Could not create ungapped protein sequence, found unknown compounds: {}. This is most likely a bug.", e.getMessage());
  		}
  
  		return ungapped;
  	}
docs: Removes all gaps ('-') from a protein sequence
  @param gapped
  @return