dotnetbio / bio

Bioinformatics library for .NET
Apache License 2.0
145 stars 49 forks source link

Sequence type parameter required #28

Open TayyabaQamar opened 7 years ago

TayyabaQamar commented 7 years ago

// [2] Prepare data string seq = @"GACGCCGCCGCCACCACCGCCACCGCCGCAGCAGAAGCAGCGCACCGCAGGAGGGAAG"; seq.ToString(); Sequence sequence = new Sequence(Alphabets.DNA, seq);

        // [3] Create and configure service handler
        EbiWuBlastHandler blastService = new EbiWuBlastHandler();
       // NCBIBlastHandler blastService = new NCBIBlastHandler();

        ConfigParameters configParams = new ConfigParameters();
        configParams.UseBrowserProxy = true;
        blastService.Configuration = configParams;

        // [4] Define query.
        BlastParameters searchParams = new BlastParameters();
        searchParams.Add("Program", "blastn");

        searchParams.Add("Database", "em_rel");
        searchParams.Add("Expect", "1e-10");
        //searchParams.Add("Email", "YourAddress@YourInstitution");

        // [5] create and submit request
        string jobID;
        try
        {
            jobID = blastService.SubmitRequest(sequence, searchParams);
        }
        catch (Exception ex)
        {
            Console.WriteLine("Service is not available.");
            Console.WriteLine(ex);
            return;
        }

        // [6] Wait for Ready status
        ServiceRequestInformation info = blastService.GetRequestStatus(jobID);

        if (info.Status != ServiceRequestStatus.Waiting
               && info.Status != ServiceRequestStatus.Ready)
        {
            Console.WriteLine("Service is not ready or waiting.");
            return;
        }

        int maxAttempts = 10;
        int attempt = 1;
        while (attempt <= maxAttempts
                && info.Status != ServiceRequestStatus.Error
                && info.Status != ServiceRequestStatus.Ready)
        {
            ++attempt;
            info = blastService.GetRequestStatus(jobID);
            Thread.Sleep(
                info.Status == ServiceRequestStatus.Waiting
                || info.Status == ServiceRequestStatus.Queued
                ? 20000 * attempt
                : 0);
        }

        // [7] Get results
        IList<BlastResult> results2 =
              blastService.FetchResultsSync(jobID, searchParams) as List<BlastResult>;

I'm running this code mentioned in MBF programming guide but it is giving me an error that sequence type parameter is required: Service not available