public void CanSortGenomes()
        {
            const int someRidiculouslyHighNumberOfGenomes = 1000;
            var       genomesListRequest = new ListGenomeRequest()
            {
                Limit = someRidiculouslyHighNumberOfGenomes, Offset = 0, SortBy = GenomeSortByParameters.SpeciesName, SortDir = SortDirection.Asc
            };
            var genomesListResponse = Client.ListGenomes(genomesListRequest, null);

            Assert.NotNull(genomesListResponse);
            var genomeList = genomesListResponse.Response;

            string[] genomeSpeciesList =
            {
                "Arabidopsis thaliana",
                "Bacillus Cereus",
                "Bos Taurus",
                "Escherichia coli",
                "H**o sapiens",
                "Mus musculus",
                "Phix",
                "Rattus norvegicus",
                "Rhodobacter sphaeroides",
                "Saccharomyces cerevisiae",
                "Staphylococcus aureus"
            };

            // this set will only work if we continue to test against the contents of the test db and if that does not change.
            Assert.True(genomeList.Items.Length == genomeSpeciesList.Length);
            for (int i = 0; i < genomeSpeciesList.Length; i++)
            {
                Assert.True(genomeList.Items[i].SpeciesName == genomeSpeciesList[i]);
            }
        }
Пример #2
0
        public void CanListGenomeFileSets()
        {
            var genomesListRequest = new ListGenomeRequest()
            {
                Limit = 1000
            };
            var genomesListResponse = Client.ListGenomes(genomesListRequest, null);
            var oneWithFileSets     = genomesListResponse.Response.Items.Where(x => x.HrefFileSets != null).FirstOrDefault();

            Assert.NotNull(oneWithFileSets);

            var fileSets = Client.ListFileSets(new ListGenomeFileSetsRequest(oneWithFileSets), null);

            Assert.NotNull(fileSets);
            Assert.NotEmpty(fileSets.Response.Items);
            var item = fileSets.Response.Items[0];

            Assert.NotNull(item.Href);
            Assert.NotNull(item.OriginalPath);
            Assert.NotNull(item.HrefFiles);
            Assert.NotNull(item.Type);
            Assert.NotNull(item.Category);

            // make sure we can list files
            var files = Client.ListFiles(new ListFileSetFilesRequest(item));

            Assert.NotNull(files);
            Assert.NotNull(files.Response);
            Assert.NotEmpty(files.Response.Items);
            Assert.NotEmpty(files.Response.Items[0].Name);
        }
        public void CanListGenomeAnnotationFileSets()
        {
            var genomesListRequest = new ListGenomeRequest() { Limit = 1000 };
            var genomesListResponse = Client.ListGenomes(genomesListRequest, null);
            var oneWithFileSets = genomesListResponse.Response.Items.Where(x => x.HrefFileSets != null).FirstOrDefault();
            // we know these have annotqations with file sets too

            Assert.NotNull(oneWithFileSets);

            // this verifies I can list annotations too
            var annotations = Client.ListGenomeAnnotations(new ListGenomeAnnotationsRequest(oneWithFileSets));
            Assert.NotNull(annotations);
            Assert.NotEmpty(annotations.Response.Items);

            var annotationWithFileSets = annotations.Response.Items.Where(x => x.HrefFileSets != null).FirstOrDefault();
            Assert.NotNull(annotationWithFileSets);

            var fileSets = Client.ListFileSets(new ListGenomeAnnotationFileSetsRequest(annotationWithFileSets), null);
            Assert.NotNull(fileSets);
            Assert.NotEmpty(fileSets.Response.Items);
            var item = fileSets.Response.Items[0];
            Assert.NotNull(item.Href);
            Assert.NotNull(item.OriginalPath);
            Assert.NotNull(item.HrefFiles);
            Assert.NotNull(item.Source);
            Assert.NotNull(item.Version);

            // make sure we can list files
            var files = Client.ListFiles(new ListFileSetFilesRequest(item));
            Assert.NotNull(files);
            Assert.NotNull(files.Response);
            Assert.NotEmpty(files.Response.Items);
            Assert.NotEmpty(files.Response.Items[0].Name);
        }
        public void CanListGenomeFileSets()
        {
            var genomesListRequest = new ListGenomeRequest() { Limit = 1000 };
            var genomesListResponse = Client.ListGenomes(genomesListRequest, null);
            var oneWithFileSets = genomesListResponse.Response.Items.Where(x => x.HrefFileSets != null).FirstOrDefault();

            Assert.NotNull(oneWithFileSets);

            var fileSets = Client.ListFileSets(new ListGenomeFileSetsRequest(oneWithFileSets), null);
            Assert.NotNull(fileSets);
            Assert.NotEmpty(fileSets.Response.Items);
            var item = fileSets.Response.Items[0];
            Assert.NotNull(item.Href);
            Assert.NotNull(item.OriginalPath);
            Assert.NotNull(item.HrefFiles);
            Assert.NotNull(item.Type);
            Assert.NotNull(item.Category);

            // make sure we can list files
            var files = Client.ListFiles(new ListFileSetFilesRequest(item));
            Assert.NotNull(files);
            Assert.NotNull(files.Response);
            Assert.NotEmpty(files.Response.Items);
            Assert.NotEmpty(files.Response.Items[0].Name);
        }
        public void CanSortGenomes()
        {
            const int someRidiculouslyHighNumberOfGenomes = 1000;
            var genomesListRequest = new ListGenomeRequest() { Limit = someRidiculouslyHighNumberOfGenomes, Offset = 0, SortBy = GenomeSortByParameters.SpeciesName, SortDir = SortDirection.Asc };
            var genomesListResponse = Client.ListGenomes(genomesListRequest, null);
            Assert.NotNull(genomesListResponse);
            var genomeList = genomesListResponse.Response;

            string[] genomeSpeciesList =
                {
                    "Arabidopsis thaliana",
                    "Bacillus Cereus",
                    "Bos Taurus",
                    "Escherichia coli",
                    "H**o sapiens",
                    "Mus musculus",
                    "Phix",
                    "Rattus norvegicus",
                    "Rhodobacter sphaeroides",
                    "Saccharomyces cerevisiae",
                    "Staphylococcus aureus"
                };

            // this set will only work if we continue to test against the contents of the test db and if that does not change.
            Assert.True(genomeList.Items.Length == genomeSpeciesList.Length);
            for (int i=0; i<genomeSpeciesList.Length; i++)
                Assert.True(genomeList.Items[i].SpeciesName == genomeSpeciesList[i]);
        }
        public static string BuildUrl(this ListGenomeRequest req, string version)
        {
            var urlWithParameters = AddDefaultQueryParameters(string.Format("{0}/genomes", version), req.Offset,
                                                              req.Limit, req.SortDir);

            if (req.SortBy.HasValue)
            {
                urlWithParameters = string.Format("{0}&{1}={2}", urlWithParameters, QueryParameters.SortBy, req.SortBy);
            }

            return(urlWithParameters);
        }
Пример #7
0
        public void CanListGenomeAnnotationFileSets()
        {
            var genomesListRequest = new ListGenomeRequest()
            {
                Limit = 1000
            };
            var genomesListResponse = Client.ListGenomes(genomesListRequest, null);
            var oneWithFileSets     = genomesListResponse.Response.Items.Where(x => x.HrefFileSets != null).FirstOrDefault();

            // we know these have annotqations with file sets too

            Assert.NotNull(oneWithFileSets);

            // this verifies I can list annotations too
            var annotations = Client.ListGenomeAnnotations(new ListGenomeAnnotationsRequest(oneWithFileSets));

            Assert.NotNull(annotations);
            Assert.NotEmpty(annotations.Response.Items);

            var annotationWithFileSets = annotations.Response.Items.Where(x => x.HrefFileSets != null).FirstOrDefault();

            Assert.NotNull(annotationWithFileSets);

            var fileSets = Client.ListFileSets(new ListGenomeAnnotationFileSetsRequest(annotationWithFileSets), null);

            Assert.NotNull(fileSets);
            Assert.NotEmpty(fileSets.Response.Items);
            var item = fileSets.Response.Items[0];

            Assert.NotNull(item.Href);
            Assert.NotNull(item.OriginalPath);
            Assert.NotNull(item.HrefFiles);
            Assert.NotNull(item.Source);
            Assert.NotNull(item.Version);

            // make sure we can list files
            var files = Client.ListFiles(new ListFileSetFilesRequest(item));

            Assert.NotNull(files);
            Assert.NotNull(files.Response);
            Assert.NotEmpty(files.Response.Items);
            Assert.NotEmpty(files.Response.Items[0].Name);
        }
 public Task<ListGenomeResponse> ListGenomesAsync(ListGenomeRequest request, IRequestOptions options)
 {
     return WebClient.SendAsync<ListGenomeResponse>(HttpMethods.GET, request.BuildUrl(ClientSettings.Version), null, options);
 }
 public ListGenomeResponse ListGenomes(ListGenomeRequest request, IRequestOptions options = null)
 {
     return WebClient.Send(request, options);
 }
Пример #10
0
 public ListGenomeResponse ListGenomes(ListGenomeRequest request, IRequestOptions options = null)
 {
     return(WebClient.Send(request, options));
 }
 public ListGenomeResponse ListGenomes(ListGenomeRequest request, IRequestOptions options = null)
 {
     return WebClient.Send<ListGenomeResponse>(HttpMethods.GET, request.BuildUrl(ClientSettings.Version), null, options);
 }
Пример #12
0
 public ListGenomeResponse ListGenomes(ListGenomeRequest request, IRequestOptions options)
 {
     return(WebClient.Send <ListGenomeResponse>(HttpMethods.GET, request.BuildUrl(ClientSettings.Version), null, options));
 }