<commit_before>﻿using System;
using System.Collections.Generic;
using System.Text;
using static UsefulProteomicsDatabases.ProteinDbRetriever;

namespace GuiFunctions.Databases
{
    /// <summary>
    /// We place functions from the GUI in the class to enable testing.
    /// </summary>
    
    public class DownloadUniProtDatabaseFunctions
    {

        //public static string GetUniProtHtmlQueryString(string proteomeID, bool reviewed, bool isoforms, bool xmlFormat, bool compressed)
        //{
        //    string htmlQueryString;
        //    if (!xmlFormat) //fasta
        //    {
        //        if (reviewed)
        //        {
        //            if (isoforms)
        //            {
        //                if (compressed)
        //                {
        //                    htmlQueryString = "https://www.uniprot.org/uniprot/?query=proteome:" + proteomeID + " reviewed:yes" + "&compress=yes" + "&format=fasta" + "&include:yes";
        //                }
        //                else //not compressed
        //                {
        //                    htmlQueryString = "https://www.uniprot.org/uniprot/?query=proteome:" + proteomeID + " reviewed:yes" + "&compress=no" + "&format=fasta" + "&include:yes";
        //                }
        //            }
        //            else//no isoforms
        //            {
        //                if (compressed)
        //                {
        //                    htmlQueryString = "https://www.uniprot.org/uniprot/?query=proteome:" + proteomeID + " reviewed:yes" + "&compress=yes" + "&format=fasta" + "&include:no";
        //                }
        //                else //not compressed
        //                {
        //                    htmlQueryString = "https://www.uniprot.org/uniprot/?query=proteome:" + proteomeID + " reviewed:yes" + "&compress=no" + "&format=fasta" + "&include:no";
        //                }
        //            }
        //        }
        //        else //revied and unreviewed both
        //        {
        //            if (isoforms)
        //            {
        //                if (compressed)
        //                {
        //                    htmlQueryString = "https://www.uniprot.org/uniprot/?query=proteome:" + proteomeID + "&compress=yes" + "&format=fasta" + "&include:yes";
        //                }
        //                else //not compressed
        //                {
        //                    htmlQueryString = "https://www.uniprot.org/uniprot/?query=proteome:" + proteomeID + "&compress=no" + "&format=fasta" + "&include:yes";
        //                }
        //            }
        //            else//no isoforms
        //            {
        //                if (compressed)
        //                {
        //                    htmlQueryString = "https://www.uniprot.org/uniprot/?query=proteome:" + proteomeID + "&compress=yes" + "&format=fasta" + "&include:no";
        //                }
        //                else //not compressed
        //                {
        //                    htmlQueryString = "https://www.uniprot.org/uniprot/?query=proteome:" + proteomeID + "&compress=no" + "&format=fasta" + "&include:no";
        //                }
        //            }
        //        }
        //    }
        //    else //xml -- currently isoforms are automatically included (I think)
        //    {
        //        if (reviewed)
        //        {
        //            if (isoforms)
        //            {
        //                if (compressed)
        //                {
        //                    htmlQueryString = "https://www.uniprot.org/uniprot/?query=proteome:" + proteomeID + " reviewed:yes" + "&compress=yes" + "&format=xml" + "&include:yes";
        //                }
        //                else //not compressed
        //                {
        //                    htmlQueryString = "https://www.uniprot.org/uniprot/?query=proteome:" + proteomeID + " reviewed:yes" + "&compress=no" + "&format=xml" + "&include:yes";
        //                }
        //            }
        //            else//no isoforms
        //            {
        //                if (compressed)
        //                {
        //                    htmlQueryString = "https://www.uniprot.org/uniprot/?query=proteome:" + proteomeID + " reviewed:yes" + "&compress=yes" + "&format=xml" + "&include:no";
        //                }
        //                else //not compressed
        //                {
        //                    htmlQueryString = "https://www.uniprot.org/uniprot/?query=proteome:" + proteomeID + " reviewed:yes" + "&compress=no" + "&format=xml" + "&include:no";
        //                }
        //            }
        //        }
        //        else //revied and unreviewed both
        //        {
        //            if (isoforms)
        //            {
        //                if (compressed)
        //                {
        //                    htmlQueryString = "https://www.uniprot.org/uniprot/?query=proteome:" + proteomeID + "&compress=yes" + "&format=xml" + "&include:yes";
        //                }
        //                else //not compressed
        //                {
        //                    htmlQueryString = "https://www.uniprot.org/uniprot/?query=proteome:" + proteomeID + "&compress=no" + "&format=xml" + "&include:yes";
        //                }
        //            }
        //            else//no isoforms
        //            {
        //                if (compressed)
        //                {
        //                    htmlQueryString = "https://www.uniprot.org/uniprot/?query=proteome:" + proteomeID + "&compress=yes" + "&format=xml" + "&include:no";
        //                }
        //                else //not compressed
        //                {
        //                    htmlQueryString = "https://www.uniprot.org/uniprot/?query=proteome:" + proteomeID + "&compress=no" + "&format=xml" + "&include:no";
        //                }
        //            }
        //        }
        //    }

        //    return htmlQueryString;
        //}

        public static string GetUniProtHtmlQueryString(string proteomeID, bool reviewed, bool isoforms, bool xmlFormat, bool compressed)
        {
            StringBuilder sb = new StringBuilder();
            sb.Append("https://www.uniprot.org/uniprot/?query=proteome:" + proteomeID + " ");

            if (!xmlFormat) //fasta
            {
                sb.Append("&format=fasta");
                if (reviewed)
                {
                    sb.Append("&reviewed:yes");
                    if (isoforms)
                    {
                        sb.Append("&include:yes");
                        if (compressed)
                        {
                            sb.Append("&compress=yes");
                        }
                        else //not compressed
                        {
                            sb.Append("&compress=no");
                        }
                    }<commit_msg>remove unused code<commit_after>﻿using System.Text;

namespace GuiFunctions.Databases
{
    /// <summary>
    /// We place functions from the GUI in the class to enable testing.
    /// </summary>

    public class DownloadUniProtDatabaseFunctions
    {
        public static string GetUniProtHtmlQueryString(string proteomeID, bool reviewed, bool isoforms, bool xmlFormat, bool compressed)
        {
            StringBuilder sb = new StringBuilder();
            sb.Append("https://www.uniprot.org/uniprot/?query=proteome:" + proteomeID + " ");

            if (!xmlFormat) //fasta
            {
                sb.Append("&format=fasta");
                if (reviewed)
                {
                    sb.Append("&reviewed:yes");
                    if (isoforms)
                    {
                        sb.Append("&include:yes");
                        if (compressed)
                        {
                            sb.Append("&compress=yes");
                        }
                        else //not compressed
                        {
                            sb.Append("&compress=no");
                        }
                    }
{'fraction_non_alphanumeric': 0.13413159167876149, 'fraction_numerical': 0.0, 'mean_word_length': 0.9632003798670465, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 18, 'lorem ipsum': 0, 'www.': 18, 'xml': 15}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2978716', 'n_tokens_mistral': 2246, 'n_tokens_neox': 2084, 'n_words': 326}