Creates amino acid AminoAcid objects.

@return aminoAcids, a HashMap containing the amino acids as AminoAcids.
335348
public synchronized static AminoAcid[] createAAs() {
        if (aminoAcids != null) {
            return aminoAcids;
        }

        // Create set of AtomContainers
        aminoAcids = new AminoAcid[20];

        IChemFile list = new ChemFile();
        CMLReader reader = new CMLReader(AminoAcids.class.getClassLoader().getResourceAsStream(
                "org/openscience/cdk/templates/data/list_aminoacids.cml"));
        try {
            list = (IChemFile) reader.read(list);
            List<IAtomContainer> containersList = ChemFileManipulator.getAllAtomContainers(list);
            Iterator<IAtomContainer> iterator = containersList.iterator();
            int counter = 0;
            while (iterator.hasNext()) {
                IAtomContainer ac = (IAtomContainer) iterator.next();
                LOGGER.debug("Adding AA: ", ac);
                // convert into an AminoAcid
                AminoAcid aminoAcid = new AminoAcid();
                Iterator<IAtom> atoms = ac.atoms().iterator();
                Iterator<Object> props = ac.getProperties().keySet().iterator();
                while (props.hasNext()) {
                    Object next = props.next();
                    LOGGER.debug("Prop class: " + next.getClass().getName());
                    LOGGER.debug("Prop: " + next.toString());
                    if (next instanceof DictRef) {
                        DictRef dictRef = (DictRef) next;
                        // logger.debug("DictRef type: " + dictRef.getType());
                        if (dictRef.getType().equals("pdb:residueName")) {
                            aminoAcid.setProperty(RESIDUE_NAME, ac.getProperty(dictRef).toString().toUpperCase());
                            aminoAcid.setMonomerName(ac.getProperty(dictRef).toString());
                        } else if (dictRef.getType().equals("pdb:oneLetterCode")) {
                            aminoAcid.setProperty(RESIDUE_NAME_SHORT, ac.getProperty(dictRef));
                        } else if (dictRef.getType().equals("pdb:id")) {
                            aminoAcid.setProperty(ID, ac.getProperty(dictRef));
                            LOGGER.debug("Set AA ID to: ", ac.getProperty(dictRef));
                        } else {
                            LOGGER.error("Cannot deal with dictRef!");
                        }
                    }
                }
                while (atoms.hasNext()) {
                    IAtom atom = (IAtom) atoms.next();
                    String dictRef = (String) atom.getProperty("org.openscience.cdk.dict");
                    if (dictRef != null && dictRef.equals("pdb:nTerminus")) {
                        aminoAcid.addNTerminus(atom);
                    } else if (dictRef != null && dictRef.equals("pdb:cTerminus")) {
                        aminoAcid.addCTerminus(atom);
                    } else {
                        aminoAcid.addAtom(atom);
                    }
                }
                Iterator<IBond> bonds = ac.bonds().iterator();
                while (bonds.hasNext()) {
                    IBond bond = (IBond) bonds.next();
                    aminoAcid.addBond(bond);
                }
                AminoAcidManipulator.removeAcidicOxygen(aminoAcid);
                aminoAcid.setProperty(NO_ATOMS, "" + aminoAcid.getAtomCount());
                aminoAcid.setProperty(NO_BONDS, "" + aminoAcid.getBondCount());
                if (counter < aminoAcids.length) {
                    aminoAcids[counter] = aminoAcid;
                } else {
                    LOGGER.error("Could not store AminoAcid! Array too short!");
                }
                counter++;
            }
            reader.close();
        } catch (CDKException | IOException exception) {
            LOGGER.error("Failed reading file: ", exception.getMessage());
            LOGGER.debug(exception);
        }

        return aminoAcids;
    }
28802
public static <R, C, V> HashBasedTable<R, C, V> create() {
    return new HashBasedTable<R, C, V>(
        new HashMap<R, Map<C, V>>(), new Factory<C, V>(0));
  }
270822
public static Atom[] getAtomCAArray(Structure s) {

		List<Atom> atoms = new ArrayList<Atom>();

		for (Chain c : s.getChains()) {
			for (Group g : c.getAtomGroups()) {
				if (g.hasAtom(CA_ATOM_NAME)
						&& g.getAtom(CA_ATOM_NAME).getElement() == Element.C) {
					atoms.add(g.getAtom(CA_ATOM_NAME));
				}
			}
		}

		return atoms.toArray(new Atom[atoms.size()]);
	}
277154
@Override
	public AbstractSequence<AminoAcidCompound> getSequence(String sequence, long index) throws CompoundNotFoundException, IOException {
		SequenceFileProxyLoader<AminoAcidCompound> sequenceFileProxyLoader =
				new SequenceFileProxyLoader<AminoAcidCompound>(
						file,
						sequenceParser,
						index,
						sequence.length(),
						compoundSet
						);
		return new ProteinSequence(sequenceFileProxyLoader, compoundSet);
	}
478047
@Override
    public Iterable<IChemModel> chemModels() {
        return new Iterable<IChemModel>() {

            @Override
            public Iterator<IChemModel> iterator() {
                return new ChemModelIterator();
            }
        };
    }
348728
public HashMappedList getAsMap() {

        HashMappedList map = new HashMappedList();

        while (true) {
            HsqlArrayList list = getSection();

            if (list.size() < 1) {
                break;
            }

            String key   = (String) list.get(0);
            String value = LineGroupReader.convertToString(list, 1);

            map.put(key, value);
        }

        return map;
    }
653556
public static IReactionScheme createReactionScheme(IReactionSet reactionSet) {
        IReactionScheme reactionScheme = reactionSet.getBuilder().newInstance(IReactionScheme.class);

        // Looking for those reactants which doesn't have any precursor. They are the top.
        ArrayList<IReaction> listTopR = new ArrayList<IReaction>();
        for (IReaction reaction : reactionSet.reactions()) {
            if (extractPrecursorReaction(reaction, reactionSet).getReactionCount() == 0) listTopR.add(reaction);
        }

        for (IReaction reaction : listTopR) {
            reactionScheme.addReaction(reaction);
            IReactionScheme newReactionScheme = setScheme(reaction, reactionSet);
            if (newReactionScheme.getReactionCount() != 0 || newReactionScheme.getReactionSchemeCount() != 0)
                reactionScheme.add(newReactionScheme);
        }
        return reactionScheme;
    }
1341556
public int[] makeLut() {
        int numKnots = x.length;
        float[] nx = new float[numKnots + 2];
        float[] ny = new float[numKnots + 2];
        System.arraycopy(x, 0, nx, 1, numKnots);
        System.arraycopy(y, 0, ny, 1, numKnots);
        nx[0] = nx[1];
        ny[0] = ny[1];
        nx[numKnots + 1] = nx[numKnots];
        ny[numKnots + 1] = ny[numKnots];

        int[] table = new int[256];
        for (int i = 0; i < 1024; i++) {
            float f = i / 1024.0f;
            int x = (int) (255 * Curve.Spline(f, nx.length, nx) + 0.5f);
            int y = (int) (255 * Curve.Spline(f, nx.length, ny) + 0.5f);
            x = x > 255 ? 255 : x;
            x = x < 0 ? 0 : x;
            y = y > 255 ? 255 : y;
            y = y < 0 ? 0 : y;
            table[x] = y;
        }
        return table;
    }
716800
private static double getRadiusForAmino(AminoAcid amino, Atom atom) {

		if (atom.getElement().equals(Element.H)) return Element.H.getVDWRadius();
		// some unusual entries (e.g. 1tes) contain Deuterium atoms in standard aminoacids
		if (atom.getElement().equals(Element.D)) return Element.D.getVDWRadius();

		String atomCode = atom.getName();
		char aa = amino.getAminoType();

		// here we use the values that Chothia gives in his paper (as NACCESS does)
		if (atom.getElement()==Element.O) {
			return OXIGEN_VDW;
		}
		else if (atom.getElement()==Element.S) {
			return SULFUR_VDW;
		}
		else if (atom.getElement()==Element.N) {
			if (atomCode.equals("NZ")) return TETRAHEDRAL_NITROGEN_VDW; // tetrahedral Nitrogen
			return TRIGONAL_NITROGEN_VDW;								// trigonal Nitrogen
		}
		else if (atom.getElement()==Element.C) { // it must be a carbon
			if (atomCode.equals("C") ||
					atomCode.equals("CE1") || atomCode.equals("CE2") || atomCode.equals("CE3") ||
					atomCode.equals("CH2") ||
					atomCode.equals("CZ") || atomCode.equals("CZ2") || atomCode.equals("CZ3")) {
				return TRIGONAL_CARBON_VDW; 							// trigonal Carbon
			}
			else if (atomCode.equals("CA") || atomCode.equals("CB") ||
					atomCode.equals("CE") ||
					atomCode.equals("CG1") || atomCode.equals("CG2")) {
				return TETRAHEDRAL_CARBON_VDW;							// tetrahedral Carbon
			}
			// the rest of the cases (CD, CD1, CD2, CG) depend on amino acid
			else {
				switch (aa) {
				case 'F':
				case 'W':
				case 'Y':
				case 'H':
				case 'D':
				case 'N':
					return TRIGONAL_CARBON_VDW;

				case 'P':
				case 'K':
				case 'R':
				case 'M':
				case 'I':
				case 'L':
					return TETRAHEDRAL_CARBON_VDW;

				case 'Q':
				case 'E':
					if (atomCode.equals("CD")) return TRIGONAL_CARBON_VDW;
					else if (atomCode.equals("CG")) return TETRAHEDRAL_CARBON_VDW;

				default:
					logger.info("Unexpected carbon atom "+atomCode+" for aminoacid "+aa+", assigning its standard vdw radius");
					return Element.C.getVDWRadius();
				}
			}

			// not any of the expected atoms
		} else {
			// non standard aas, (e.g. MSE, LLP) will always have this problem,
			logger.info("Unexpected atom "+atomCode+" for aminoacid "+aa+ " ("+amino.getPDBName()+"), assigning its standard vdw radius");


			return atom.getElement().getVDWRadius();
		}
	}
1233116
public static void writeProteinSequence(OutputStream outputStream,
			Collection<ProteinSequence> proteinSequences) throws Exception {

		FastaWriter<ProteinSequence, AminoAcidCompound> fastaWriter = new FastaWriter<ProteinSequence, AminoAcidCompound>(
				outputStream, proteinSequences,
				new GenericFastaHeaderFormat<ProteinSequence, AminoAcidCompound>());
		fastaWriter.process();

	}
36023
def modSymbolsFromLabelInfo(labelDescriptor):
    
    modSymbols = set()
    for labelStateEntry in viewvalues(labelDescriptor.labels):
        for labelPositionEntry in viewvalues(labelStateEntry['aminoAcidLabels']):
            for modSymbol in aux.toList(labelPositionEntry):
                if modSymbol != '':
                    modSymbols.add(modSymbol)
    return modSymbols
194137
@Override
	public List<Sequence<AminoAcidCompound>> createSequences(
			Sequence<NucleotideCompound> originalSequence) {

		List<List<AminoAcidCompound>> workingList = new ArrayList<List<AminoAcidCompound>>();

		Iterable<SequenceView<NucleotideCompound>> iter = new WindowedSequence<NucleotideCompound>(
				originalSequence, 3);

		boolean first = true;

		// If not waiting for a start codon, start translating immediately
		boolean doTranslate = !waitForStartCodon;

		for (SequenceView<NucleotideCompound> element : iter) {
			AminoAcidCompound aminoAcid = null;

			int i = 1;
			Table.CaseInsensitiveTriplet triplet = new Table.CaseInsensitiveTriplet(
					element.getCompoundAt(i++), element.getCompoundAt(i++),
					element.getCompoundAt(i++));

			Codon target = null;

			target = quickLookup.get(triplet);

			// Check for a start
			if (!doTranslate && target.isStart()) {
				doTranslate = true;
			}

			if (doTranslate) {
				if (target != null)
					aminoAcid = target.getAminoAcid();
				if (aminoAcid == null && translateNCodons()) {
					aminoAcid = unknownAminoAcidCompound;
				} else {
					if (first && initMetOnly && target.isStart()) {
						aminoAcid = methionineAminoAcidCompound;
					}
				}

				addCompoundsToList(Arrays.asList(aminoAcid), workingList);
			}

			if (doTranslate && stopAtStopCodons && target.isStop()) {
				// Check if we need to stop, but dont stop until started!
				break;
			}

			first = false;
		}
		postProcessCompoundLists(workingList);

		return workingListToSequences(workingList);
	}
977615
@Nonnull
    public final ArrayList<A> toArrayList() {
        ArrayList<A> list = new ArrayList<>(this.length);
        ImmutableList<A> l = this;
        for (int i = 0; i < length; i++) {
            list.add(((NonEmptyImmutableList<A>) l).head);
            l = ((NonEmptyImmutableList<A>) l).tail;
        }
        return list;
    }
1139565
public static final boolean isConnected(AminoAcid a, AminoAcid b) {
		Atom C = null ;
		Atom N = null;

		C = a.getC();
		N = b.getN();

		if ( C == null || N == null)
			return false;

		// one could also check if the CA atoms are < 4 A...
		double distance = getDistance(C,N);
		return distance < 2.5;
	}
1276655
public Pair<String> getCrystalIds() {
		return new Pair<>(
			moleculeIds.getFirst()+transforms.getFirst().getTransformId()+transforms.getFirst().getCrystalTranslation(),
			moleculeIds.getSecond()+transforms.getSecond().getTransformId()+transforms.getSecond().getCrystalTranslation());
	}
507805
public Iterable<IIsotope> isotopes() {
        return new Iterable<IIsotope>() {

            @Override
            public Iterator<IIsotope> iterator() {
                return isotopesMax.keySet().iterator();
            }
        };
    }
1179498
public static void main(final String[] args) {
        Switch about = new Switch("a", "about", "display about message");
        Switch help = new Switch("h", "help", "display help message");
        FileArgument aminoAcidHmm2File = new FileArgument("m", "amino-acid-hmm2-file", "amino acid HMM file in HMMER2 format", true);
        FileArgument inputFastaFile = new FileArgument("i", "input-fasta-file", "input FASTA file, default stdin", false);
        FileArgument outputFastaFile = new FileArgument("o", "output-fasta-file", "output FASTA file, default stdout", false);

        ArgumentList arguments = new ArgumentList(about, help, aminoAcidHmm2File, inputFastaFile, outputFastaFile);
        CommandLine commandLine = new CommandLine(args);

        FilterInterpretableExons filterInterpretableExons = null;
        try {
            CommandLineParser.parse(commandLine, arguments);
            if (about.wasFound()) {
                About.about(System.out);
                System.exit(0);
            }
            if (help.wasFound()) {
                Usage.usage(USAGE, null, commandLine, arguments, System.out);
                System.exit(0);
            }
            filterInterpretableExons = new FilterInterpretableExons(aminoAcidHmm2File.getValue(), inputFastaFile.getValue(), outputFastaFile.getValue());
        }
        catch (CommandLineParseException e) {
            if (about.wasFound()) {
                About.about(System.out);
                System.exit(0);
            }
            if (help.wasFound()) {
                Usage.usage(USAGE, null, commandLine, arguments, System.out);
                System.exit(0);
            }
            Usage.usage(USAGE, e, commandLine, arguments, System.err);
            System.exit(-1);
        }
        catch (NullPointerException e) {
            Usage.usage(USAGE, e, commandLine, arguments, System.err);
            System.exit(-1);
        }
        try {
            System.exit(filterInterpretableExons.call());
        }
        catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        }
    }