Exemplo n.º 1
0
        /// <summary>
        /// Reads rna, peptide Fasta-Sequence(s) and generates HELMNotation
        /// </summary>
        /// <param name="fastaString"></param>
        /// <returns></returns>

        public static string FastaToHelm(string fastaString)
        {
            string helm     = null;
            string errorMsg = "Can't convert FASTA to Helm";

            if (UseWebEditor)
            {
                throw new InvalidCastException(errorMsg);                 // can't do yet
            }

            else
            {
                string helm1 = HelmService.GenerateHELMFromFastaPeptide(fastaString);
                if (helm1 == null)
                {
                    throw new InvalidCastException(errorMsg);
                }

                string helm2 = HelmService.GenerateHELMFromFastaRNA(fastaString);
                if (helm2 == null)
                {
                    throw new InvalidCastException(errorMsg);
                }

                if (helm1.Length >= helm2.Length)
                {
                    return(helm1);
                }
                else
                {
                    return(helm2);
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Reads HELMNotation and converts it into peptide/RNA analogue (natural) sequence
        /// </summary>
        /// <param name="helm"></param>
        /// <returns></returns>

        public static string HelmToAnalogSequence(string helm)
        {
            string seq = null;

            if (UseWebEditor)
            {
                Browser.SetHelm(helm);
                seq = Browser.GetSequence();
            }

            else
            {
                if (IsPeptideString(helm))
                {
                    seq = HelmService.ConvertIntoPeptideAnalogSequence(helm);
                }

                else if (IsRnaString(helm))
                {
                    seq = HelmService.ConvertIntoRNAAnalogSequence(helm);
                }
            }

            return(seq);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Converts HELM Input into Fasta (RNA or Peptide)
        /// <param name="helm"></param>
        /// <returns></returns>

        public static string HelmToFastaString(string helm)
        {
            string fasta = null;

            if (UseWebEditor)
            {
                return("Can't convert Helm to FASTA");
            }

            else
            {
                fasta = HelmService.GenerateFastaFromHelm(helm);
            }

            return(fasta);
        }
Exemplo n.º 4
0
        public static string FastaRnaToHelm(string fastaString)
        {
            string helm = null;

            if (UseWebEditor)
            {
                throw new InvalidCastException("Can't convert FASTA to Helm");                 // can't do yet
            }

            else
            {
                helm = HelmService.GenerateHELMFromFastaRNA(fastaString);
            }

            return(helm);
        }
Exemplo n.º 5
0
        /// <summary>
        /// SMILES generation for  the whole HELM molecule
        /// </summary>
        /// <param name="helm"></param>
        /// <returns></returns>

        public static string HelmToSmiles(
            MoleculeMx mol,
            string helm)
        {
            string smiles = null;

            if (UseWebEditor && DebugMx.False)             // don't use this, only gets molfile at monomer level, not atoms/bonds
            {
                Browser.SetHelm(helm);
                smiles = Browser.GetSmiles();
            }

            else
            {
                smiles = HelmService.GenerateSMILESForHELM(helm);
            }

            return(smiles);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Reads RNA / peptide sequence and generates HELMNotation
        /// </summary>
        /// <param name="sequenceString"></param>
        /// <returns></returns>

        public static string SequenceToHelm(string seqString)
        {
            string helm = null;

            if (UseWebEditor)
            {
                throw new InvalidCastException("Can't convert sequence to Helm");                 // can't do yet
            }

            else
            {
                if (IsPeptideString(seqString))
                {
                    helm = HelmService.GenerateHELMFromPeptideSequence(seqString);
                }

                else
                {
                    helm = HelmService.GenerateHELMFromRnaSequence(seqString);
                }
            }

            return(helm);
        }
Exemplo n.º 7
0
        public static string FastaPeptideToHelm(string fastaString)
        {
            string helm = HelmService.GenerateHELMFromFastaPeptide(fastaString);

            return(helm);
        }