method to get only the nucleotide base for one MonomerNotationUnitRNA

@param rna
MonomerNotationUnitRNA
@param monomerStore
MonomerStore
@return List of Monomers
@throws HELM2HandledException
if HELM2 features were there
501075
private static List<Monomer> getMonomersRNAOnlyBase(MonomerNotationUnitRNA rna, MonomerStore monomerStore)
			throws HELM2HandledException {
		try {
			List<Monomer> monomers = new ArrayList<Monomer>();
			for (MonomerNotationUnit unit : rna.getContents()) {
				String id = unit.getUnit().replace("[", "");
				id = id.replace("]", "");
				Monomer mon = MethodsMonomerUtils.getMonomer(rna.getType(), id, "");

				if (mon.getMonomerType().equals(Monomer.BRANCH_MOMONER_TYPE)) {
					monomers.add(mon);
				}
			}
			return monomers;
		} catch (Exception e) {
			e.printStackTrace();
			throw new HELM2HandledException(e.getMessage());
		}

	}
874608
private static void initMapNucleotidesNaturalAnalog() throws FastaFormatException, ChemistryException {
		try {
			nucleotidesNaturalAnalog = MonomerFactory.getInstance().getMonomerDB().get("RNA");
		} catch (IOException e) {
			e.printStackTrace();
			LOG.error("Nucleotides can not be initialized");
			throw new FastaFormatException(e.getMessage());
		}
	}
754605
public final static void addPolymerNotation(int position, PolymerNotation polymer, HELM2Notation helm2notation) {
		helm2notation.getListOfPolymers().add(position, polymer);
	}
934509
private static Map<String, String> findAdHocMonomers(String elements, String type) throws HELM1FormatException, ValidationException, ChemistryException,
      org.helm.notation2.parser.exceptionparser.NotationException {
    /* find adHocMonomers */
    try {
      Map<String, String> listMatches = new HashMap<String, String>();
      String[] listelements = elements.split("\\.");
      if (type == "RNA") {
        for (String element : listelements) {
          List<String> monomerIds;
          monomerIds = NucleotideParser.getMonomerIDListFromNucleotide(element);

          for (String id : monomerIds) {

            Monomer monomer = MonomerFactory.getInstance().getMonomerStore().getMonomer(type, id);
            if (monomer.isAdHocMonomer()) {
              listMatches.put(element, "[" + monomer.getCanSMILES() + "]");

            }
          }
        }

      } else {
        for (String element : listelements) {
          Monomer monomer = MonomerFactory.getInstance().getMonomerStore().getMonomer(type, element.replace("[", "").replace("]", ""));
          try {
            if (monomer.isAdHocMonomer()) {
              listMatches.put(element, "[" + monomer.getCanSMILES() + "]");
            }
          } catch (NullPointerException e) {
            if (!(Chemistry.getInstance().getManipulator().validateSMILES(element.substring(1, element.length() - 1)))) {
              e.printStackTrace();
              throw new ValidationException("SMILES as Monomer is not valid :" + element);
            }
          }
        }
      }

      return listMatches;
    } catch (MonomerLoadingException e) {
      e.printStackTrace();
      throw new HELM1FormatException(e.getMessage());
    }
  }
634517
def rnaseq2ga(quantificationFilename, sqlFilename, localName, rnaType,
              dataset=None, featureType="gene",
              description="", programs="", featureSetNames="",
              readGroupSetNames="", biosampleId=""):
    
    readGroupSetName = ""
    if readGroupSetNames:
        readGroupSetName = readGroupSetNames.strip().split(",")[0]
    featureSetIds = ""
    readGroupIds = ""
    if dataset:
        featureSetIdList = []
        if featureSetNames:
            for annotationName in featureSetNames.split(","):
                featureSet = dataset.getFeatureSetByName(annotationName)
                featureSetIdList.append(featureSet.getId())
            featureSetIds = ",".join(featureSetIdList)
        # TODO: multiple readGroupSets
        if readGroupSetName:
            readGroupSet = dataset.getReadGroupSetByName(readGroupSetName)
            readGroupIds = ",".join(
                [x.getId() for x in readGroupSet.getReadGroups()])
    if rnaType not in SUPPORTED_RNA_INPUT_FORMATS:
        raise exceptions.UnsupportedFormatException(rnaType)
    rnaDB = RnaSqliteStore(sqlFilename)
    if rnaType == "cufflinks":
        writer = CufflinksWriter(rnaDB, featureType, dataset=dataset)
    elif rnaType == "kallisto":
        writer = KallistoWriter(rnaDB, featureType, dataset=dataset)
    elif rnaType == "rsem":
        writer = RsemWriter(rnaDB, featureType, dataset=dataset)
    writeRnaseqTable(rnaDB, [localName], description, featureSetIds,
                     readGroupId=readGroupIds, programs=programs,
                     biosampleId=biosampleId)
    writeExpressionTable(writer, [(localName, quantificationFilename)])
830535
private static MonomerNotation generateMonomerNotationRNA(MonomerNotation current) throws AnalogSequenceException {
		MonomerNotation change = null;
		try {
			/* simple MonomerNotationUnit */

			if (current instanceof MonomerNotationUnit) {
				change = new MonomerNotationUnit(changeIdForRNA(current), current.getType());
			} else if (current instanceof MonomerNotationGroup) {
				if (current instanceof MonomerNotationGroupOr) {
					StringBuilder sb = new StringBuilder();
					for (MonomerNotationGroupElement element : ((MonomerNotationGroup) current).getListOfElements()) {

						sb.append(changeIdForRNA(element.getMonomerNotation()) + ",");
					}
					sb.setLength(sb.length() - 1);
					change = new MonomerNotationGroupOr(sb.toString(), current.getType());

				} else if (current instanceof MonomerNotationGroupMixture) {
					StringBuilder sb = new StringBuilder();
					for (MonomerNotationGroupElement element : ((MonomerNotationGroup) current).getListOfElements()) {
						sb.append(changeIdForRNA(element.getMonomerNotation()) + "+");
					}
					sb.setLength(sb.length() - 1);
					change = new MonomerNotationGroupMixture(sb.toString(), current.getType());

				} else {
					/* throw new exception */
					throw new AnalogSequenceException("Unknown MonomerNotationGroup " + current.getClass());
				}

			} else if (current instanceof MonomerNotationList) {
				StringBuilder sb = new StringBuilder();
				for (MonomerNotation element : ((MonomerNotationList) current).getListofMonomerUnits()) {
					sb.append(changeIdForRNA(element) + ".");
				}
				sb.setLength(sb.length() - 1);
				change = new MonomerNotationList(sb.toString(), current.getType());

			} else {
				/* throw new exception */
				throw new AnalogSequenceException("Unknown MonomerNotation " + current.getClass());
			}

			change.setCount(current.getCount());
			if (current.getAnnotation() != null) {
				change.setAnnotation(current.getAnnotation());
			}

			return change;

		} catch (NotationException e) {
			e.printStackTrace();
			throw new AnalogSequenceException("Notation object can not be built");
		}

	}
640855
protected static String generateFastaFromRNA(List<Monomer> monomers) {
		StringBuilder fasta = new StringBuilder();
		for (Monomer monomer : monomers) {
			if (monomer.getMonomerType().equals(Monomer.BRANCH_MOMONER_TYPE)) {
				fasta.append(monomer.getNaturalAnalog());
			}
		}

		return fasta.toString();
	}
1102934
public IReaction parseReactionSmiles(String smiles) throws InvalidSmilesException {

        if (!smiles.contains(">"))
            throw new InvalidSmilesException("Not a reaction SMILES: " + smiles);

        final int first  = smiles.indexOf('>');
        final int second = smiles.indexOf('>', first + 1);

        if (second < 0)
            throw new InvalidSmilesException("Invalid reaction SMILES:" + smiles);

        final String reactants = smiles.substring(0, first);
        final String agents = smiles.substring(first + 1, second);
        final String products = smiles.substring(second + 1, smiles.length());

        IReaction reaction = builder.newInstance(IReaction.class);

        // add reactants
        if (!reactants.isEmpty()) {
            IAtomContainer reactantContainer = parseSmiles(reactants, true);
            IAtomContainerSet reactantSet = ConnectivityChecker.partitionIntoMolecules(reactantContainer);
            for (int i = 0; i < reactantSet.getAtomContainerCount(); i++) {
                reaction.addReactant(reactantSet.getAtomContainer(i));
            }
        }

        // add agents
        if (!agents.isEmpty()) {
            IAtomContainer agentContainer = parseSmiles(agents, true);
            IAtomContainerSet agentSet = ConnectivityChecker.partitionIntoMolecules(agentContainer);
            for (int i = 0; i < agentSet.getAtomContainerCount(); i++) {
                reaction.addAgent(agentSet.getAtomContainer(i));
            }
        }

        String title = null;

        // add products
        if (!products.isEmpty()) {
            IAtomContainer productContainer = parseSmiles(products, true);
            IAtomContainerSet productSet = ConnectivityChecker.partitionIntoMolecules(productContainer);
            for (int i = 0; i < productSet.getAtomContainerCount(); i++) {
                reaction.addProduct(productSet.getAtomContainer(i));
            }
            reaction.setProperty(CDKConstants.TITLE, title = productContainer.getProperty(CDKConstants.TITLE));
        }

        try {
            // CXSMILES layer
            parseRxnCXSMILES(title, reaction);
        } catch (Exception e) {
            e.printStackTrace();
            throw new InvalidSmilesException("Error parsing CXSMILES:" + e.getMessage());
        }

        return reaction;
    }
277660
protected static String generateFastaFromPeptide(List<Monomer> monomers) {
		StringBuilder fasta = new StringBuilder();
		for (Monomer monomer : monomers) {
			fasta.append(monomer.getNaturalAnalog());
		}
		return fasta.toString();
	}
141103
public ArrayList<String> getGeneAliases() throws XPathExpressionException {
		ArrayList<String> aliasList = new ArrayList<String>();
		if (uniprotDoc == null) {
			return aliasList;
		}
		Element uniprotElement = uniprotDoc.getDocumentElement();
		Element entryElement = XMLHelper.selectSingleElement(uniprotElement, "entry");
		ArrayList<Element> proteinElements = XMLHelper.selectElements(entryElement, "gene");
		for(Element proteinElement : proteinElements) {
			ArrayList<Element> keyWordElementList = XMLHelper.selectElements(proteinElement, "name");
			for (Element element : keyWordElementList) {
				aliasList.add(element.getTextContent());
			}
		}
		return aliasList;
	}
1244072
public Monomer getPhosphateMonomer(MonomerStore monomerStore) {
    String phosphateSymbol = getPhosphateSymbol();
    if (phosphateSymbol != null && !phosphateSymbol.equalsIgnoreCase("")) {
      try {
        Map<String, Monomer> monomers = monomerStore.getMonomers(Monomer.NUCLIEC_ACID_POLYMER_TYPE);
        Monomer m = monomers.get(phosphateSymbol);
        return m;
      } catch (Exception ex) {
        LOG.info("Unable to get phosphate monomer for "
            + phosphateSymbol);
        return null;
      }
    } else {
      return null;
    }
  }
13289
public final static PolymerNotation addMonomerNotation(int position, PolymerNotation polymer,
			MonomerNotation monomerNotation) {
		polymer.getPolymerElements().getListOfElements().add(position, monomerNotation);
		return polymer;
	}
214190
public Map<String, String> loadNucleotideStore() throws IOException,
      URISyntaxException {

    Map<String, String> nucleotides = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER);
    LOG.debug("Loading nucleotide store by Webservice Loader");
    LOG.debug(MonomerStoreConfiguration.getInstance().toString());
    CloseableHttpResponse response = null;
    try {
      response =
          WSAdapterUtils.getResource(MonomerStoreConfiguration.getInstance().getWebserviceNucleotidesFullURL());
      LOG.debug(response.getStatusLine().toString());

      JsonFactory jsonf = new JsonFactory();
      InputStream instream = response.getEntity().getContent();

      JsonParser jsonParser = jsonf.createJsonParser(instream);
      nucleotides = deserializeNucleotideStore(jsonParser);
      LOG.debug(nucleotides.size() + " nucleotides loaded");

      EntityUtils.consume(response.getEntity());

    } catch (ClientProtocolException e) {

      /* read file */
      JsonFactory jsonf = new JsonFactory();
      InputStream instream =
          new FileInputStream(new File(MonomerStoreConfiguration.getInstance().getWebserviceNucleotidesFullURL()));

      JsonParser jsonParser = jsonf.createJsonParser(instream);
      nucleotides = deserializeNucleotideStore(jsonParser);
      LOG.debug(nucleotides.size() + " nucleotides loaded");

    } finally {

      if (response != null) {
        response.close();
      }
    }

    return nucleotides;
  }
120858
public static String generateFastaFromRNAPolymer(List<PolymerNotation> polymers)
			throws FastaFormatException, ChemistryException {
		StringBuilder fasta = new StringBuilder();
		for (PolymerNotation polymer : polymers) {
			String header = polymer.getPolymerID().getId();
			if (polymer.getAnnotation() != null) {
				header = polymer.getAnnotation();
			}

			fasta.append(">" + header + "\n");
			try {
				fasta.append(
						generateFastaFromRNA(MethodsMonomerUtils.getListOfHandledMonomers(polymer.getListMonomers()))
								+ "\n");
			} catch (HELM2HandledException e) {
				e.printStackTrace();
				throw new FastaFormatException(e.getMessage());
			}
		}
		return fasta.toString();
	}
408699
public Monomer getPhosphateMonomer() {
    MonomerFactory factory = null;
    try {
      factory = MonomerFactory.getInstance();
    } catch (Exception ex) {
      Logger.getLogger(Nucleotide.class.getName()).log(Level.SEVERE, "Unable to initialize monomer factory", ex);
    }
    return getPhosphateMonomer(factory.getMonomerStore());
  }
999398
def enrich_proteins_with_rnas(graph):
    
    for protein_node in list(graph):
        if not isinstance(protein_node, Protein):
            continue

        if protein_node.variants:
            continue

        rna_node = protein_node.get_rna()
        graph.add_translation(rna_node, protein_node)
477578
private IAtomContainer readMolecule() throws Exception {
        boolean foundCompound = false;
        while (parser.next() != XMLEvent.END_DOCUMENT) {
            if (parser.getEventType() == XMLEvent.START_ELEMENT) {
                if (parser.getLocalName().equals("PC-Compound")) {
                    foundCompound = true;
                    break;
                }
            }
        }
        if (foundCompound) {
            return parserHelper.parseMolecule(parser, builder);
        }
        return null;
    }