/**
   * Get the non-terminal modifications as a string in the Tide format.
   *
   * @param modifications the modifications to check
   * @param fixed if the modifications are to to be added as fixed or variable
   * @return the non-terminal modifications as a string in the Tide forma
   */
  private String getNonTerminalModifications(ArrayList<String> modifications, boolean fixed) {

    // tide ptm pattern: [max_per_peptide]residues[+/-]mass_change
    String nonTerminalModifications = "";

    for (String ptmName : modifications) {

      PTM ptm = ptmFactory.getPTM(ptmName);

      if (!ptm.isNTerm() && !ptm.isCTerm()) {

        if (!nonTerminalModifications.isEmpty()) {
          nonTerminalModifications += ",";
        }

        // add the number of allowed ptms per peptide
        if (!fixed) {
          nonTerminalModifications +=
              tideParameters
                  .getMaxVariablePtmsPerTypePerPeptide(); // @TODO: make this modification specific?
        }

        // add the residues affected
        AminoAcidPattern ptmPattern = ptm.getPattern();
        if (ptmPattern != null && ptmPattern.length() > 0) {
          for (Character aminoAcid : ptmPattern.getAminoAcidsAtTarget()) {
            nonTerminalModifications += aminoAcid;
          }
        }

        // add the ptm mass
        if (ptm.getRoundedMass() > 0) {
          nonTerminalModifications += "+";
        }
        nonTerminalModifications += ptm.getRoundedMass();
      }
    }

    return nonTerminalModifications;
  }