コード例 #1
0
        public static void CanGetProject(IBaseSpaceClient client, string[] includeStrings = null)
        {
            var project = CreateRandomTestProject(client);

            ListProjectsResponse listProjectResponse = client.ListProjects(new ListProjectsRequest() { Limit = 1, Offset = 0, Name = project.Name });
            Assert.True(listProjectResponse.Response.Items.Length == 1);
            var compactProject = listProjectResponse.Response.Items[0];
            Assert.True(project.Id == compactProject.Id);
            Assert.True(project.Name == compactProject.Name);

            var getProjRequest = new GetProjectRequest(compactProject.Id);

            if (includeStrings != null && includeStrings.Length > 0)
                getProjRequest.Include = includeStrings;

            var getProjectResponse = client.GetProject(new GetProjectRequest(compactProject.Id) { Include = new[] { ProjectIncludes.PERMISSIONS } });

            var retrievedProject = getProjectResponse.Response;
            Assert.True(project.Id == retrievedProject.Id);
            Assert.True(project.Name == retrievedProject.Name);
            Assert.True(project.HrefAppResults == retrievedProject.HrefAppResults);
            Assert.True(project.HrefBaseSpaceUI == retrievedProject.HrefBaseSpaceUI);
            Assert.True(project.HrefSamples == retrievedProject.HrefSamples);

            if (includeStrings != null && includeStrings.Length > 0)
                Assert.NotNull(retrievedProject.Permissions);
        }
コード例 #2
0
        public static AppResult CreateRandomTestAppResult(IBaseSpaceClient client, Project project)
        {
            var appResultName = CreateRandomTestAppResultName();
            var response = client.CreateAppResult(new CreateAppResultRequest(project.Id, appResultName));
            Assert.NotNull(response);

            Assert.NotNull(response.Response);
            var appResult = response.Response;
            Assert.NotNull(appResult);
            Assert.True(appResult.Name.Contains(appResultName));
            return appResult;
        }
コード例 #3
0
        internal static AppSession CreateTestAppSession(IBaseSpaceClient client)
        {
            var project = TestHelpers.CreateRandomTestProject(client);
            var appResult = TestHelpers.CreateRandomTestAppResult(client, project);
            var appSessionCompact = appResult.AppSession;
            Assert.NotNull(appSessionCompact);
            var appSessionResponse = client.GetAppSession(new GetAppSessionRequest(appSessionCompact.Id));
            Assert.NotNull(appSessionResponse);
            var appSession = appSessionResponse.Response;
            Assert.NotNull(appSession);

            return appSession;
        }
コード例 #4
0
        public static Project CreateRandomTestProject(IBaseSpaceClient client, string projectName = null)
        {
            projectName = projectName ?? CreateRandomTestProjectName();
            var response = client.CreateProject(new CreateProjectRequest(projectName));
            Assert.NotNull(response);
            Assert.NotNull(response.ResponseStatus);
            Assert.Null(response.ResponseStatus.ErrorCode);

            Assert.NotNull(response.Response);
            var project = response.Response;
            Assert.NotNull(project);
            Assert.True(project.Name.Contains(projectName));
            return project;
        }
コード例 #5
0
        internal static AppResult CreateRandomTestAppResult(IBaseSpaceClient client, Project project)
        {
            var appResultName = CreateRandomTestAppResultName();
            var response      = client.CreateAppResult(new PostAppResultRequest(project.Id, appResultName));

            Assert.NotNull(response);
            Assert.NotNull(response.ResponseStatus);
            Assert.Null(response.ResponseStatus.ErrorCode);

            Assert.NotNull(response.Response);
            var appResult = response.Response;

            Assert.NotNull(appResult);
            Assert.True(appResult.Name.Contains(appResultName));
            return(appResult);
        }
コード例 #6
0
        public static Project CreateRandomTestProject(IBaseSpaceClient client, string projectName = null)
        {
            projectName = projectName ?? CreateRandomTestProjectName();
            var response = client.CreateProject(new PostProjectRequest(projectName));

            Assert.NotNull(response);
            Assert.NotNull(response.ResponseStatus);
            Assert.Null(response.ResponseStatus.ErrorCode);

            Assert.NotNull(response.Response);
            var project = response.Response;

            Assert.NotNull(project);
            Assert.True(project.Name.Contains(projectName));
            return(project);
        }
コード例 #7
0
        internal static Sample CreateRandomTestSample(IBaseSpaceClient client, Project project)
        {
            /*
            var sampleName = TestHelpers.CreateRandomTestSampleName();
            var response = client.CreateSample(new PostSampleRequest(sampleName));
            Assert.NotNull(response);
            Assert.NotNull(response.ResponseStatus);
            Assert.Null(response.ResponseStatus.ErrorCode);

            Assert.NotNull(response.Response);
            var project = response.Response;
            Assert.NotNull(project);
            Assert.True(project.Name.Contains(sampleName));
            return project;
             */
            return null;
        }
コード例 #8
0
 internal static Sample CreateRandomTestSample(IBaseSpaceClient client, Project project)
 {
     /*
      *  var sampleName = TestHelpers.CreateRandomTestSampleName();
      *  var response = client.CreateSample(new PostSampleRequest(sampleName));
      *  Assert.NotNull(response);
      *  Assert.NotNull(response.ResponseStatus);
      *  Assert.Null(response.ResponseStatus.ErrorCode);
      *
      *  Assert.NotNull(response.Response);
      *  var project = response.Response;
      *  Assert.NotNull(project);
      *  Assert.True(project.Name.Contains(sampleName));
      *  return project;
      */
     return(null);
 }
コード例 #9
0
        public static void CanGetProject(IBaseSpaceClient client, string[] includeStrings = null)
        {
            var project = CreateRandomTestProject(client);

            ListProjectsResponse listProjectResponse = client.ListProjects(new ListProjectsRequest()
            {
                Limit = 1, Offset = 0, Name = project.Name
            });

            Assert.True(listProjectResponse.Response.Items.Length == 1);
            var compactProject = listProjectResponse.Response.Items[0];

            Assert.True(project.Id == compactProject.Id);
            Assert.True(project.Name == compactProject.Name);

            var getProjRequest = new GetProjectRequest(compactProject.Id);

            if (includeStrings != null && includeStrings.Length > 0)
            {
                getProjRequest.Include = includeStrings;
            }

            var getProjectResponse = client.GetProject(new GetProjectRequest(compactProject.Id)
            {
                Include = new[] { ProjectIncludes.PERMISSIONS }
            });

            var retrievedProject = getProjectResponse.Response;

            Assert.True(project.Id == retrievedProject.Id);
            Assert.True(project.Name == retrievedProject.Name);
            Assert.True(project.HrefAppResults == retrievedProject.HrefAppResults);
            Assert.True(project.HrefBaseSpaceUI == retrievedProject.HrefBaseSpaceUI);
            Assert.True(project.HrefSamples == retrievedProject.HrefSamples);

            if (includeStrings != null && includeStrings.Length > 0)
            {
                Assert.NotNull(retrievedProject.Permissions);
            }
        }
コード例 #10
0
        public static void CanGetUserProjectsFirstPage(IBaseSpaceClient client, string[] includeStrings = null)
        {
            var getListProjsRequest = new ListProjectsRequest();

            if (includeStrings != null && includeStrings.Length > 0)
                getListProjsRequest.Include = includeStrings;

            ListProjectsResponse response = client.ListProjects(getListProjsRequest);

            Assert.NotNull(response);
            Assert.True(response.Response.TotalCount > 0); //make sure account has at least 1 for access token
            ProjectCompact projectResult = response.Response.Items[0];

            Assert.NotNull(projectResult);
            Assert.NotEmpty(projectResult.Id);
            Assert.NotEmpty(projectResult.Name);
            Assert.NotSame(projectResult.Id, projectResult.Name);
            Assert.True(projectResult.DateCreated > new DateTime(2009, 1, 1));

            if (includeStrings != null && includeStrings.Length > 0)
                Assert.NotNull(projectResult.Permissions);
        }
コード例 #11
0
 internal static RunCompact[] ListReadyRuns(IBaseSpaceClient client)
 {
     var plannedRuns = client.ListRuns(new ListRunsRequest() {Statuses="Ready"});
     return plannedRuns.Response.Items;
 }
コード例 #12
0
 internal static void MarkRunAsReadyToSequence(IBaseSpaceClient client, string plannedRunId)
 {
     client.PlannedRunReadyRequest(new PlannedRunReadyRequest(plannedRunId, true));
     Assert.Equal(ListReadyRuns(client).Where(r => r.Id == plannedRunId).Count(), 1);
 }
コード例 #13
0
 internal static BiologicalSample CreateBiologicalSample(IBaseSpaceClient client, string sampleId=null, string sampleName=null, string nucleicAcid=null)
 {
     var sample = string.Format("sample_SDK_Test_{0}", StringHelpers.RandomAlphanumericString(5));
     var biologicalSample = client.CreateBiologicalSample(new CreateBiologicalSampleRequest(sampleId ?? sample, sampleName ?? sample, nucleicAcid ?? "DNA"));
     Assert.NotNull(biologicalSample.Response);
     return biologicalSample.Response;
 }
コード例 #14
0
        internal static LibraryContainer CreateContainerLibraries(IBaseSpaceClient client, int libraryCount)
        {
            var prepKitIndex = "1";
            var originalLibraryCount = libraryCount;
            var container = CreateLibraryContainer(client);
            var libraryRequests = new List<SampleLibraryRequest>();
            var containerPositions = CreateContainerPositions();
            int containerPositionIndex = 0;
            var project = CreateRandomTestProject(client);
            var libraryPrep = GetLibraryPrepKit(client, prepKitIndex);

            while (libraryCount > 0)
            {
                var libraryRequest = new SampleLibraryRequest()
                {
                    BiologicalSampleId = CreateBiologicalSample(client).Id,
                    Index1SequenceId = libraryPrep.Index1Sequences.ElementAt(containerPositionIndex).Id,
                    Position = containerPositions[containerPositionIndex],
                    ProjectId = project.Id
                };

                libraryRequests.Add(libraryRequest);
                libraryCount--;
                containerPositionIndex++;
            }

            client.CreateOrUpdateContainerLibraries(new CreateOrUpdateContainerLibrariesRequest(libraryRequests, container.Id));
            var sampleLibraries = GetSampleLibrariesInContainer(client, container.Id);
            Assert.Equal(sampleLibraries.Count(), originalLibraryCount);
            Assert.Equal(sampleLibraries.FirstOrDefault().BiologicalSample.Id, libraryRequests.FirstOrDefault().BiologicalSampleId);
            return container;
        }
コード例 #15
0
        internal static LibraryContainer CreateLibraryContainer(IBaseSpaceClient client, string libraryPrepId=null, string userContainerId=null, string containerType=null, bool indexByWell=true)
        {
            libraryPrepId = libraryPrepId ?? "1";
            userContainerId = userContainerId ?? string.Format("container-sdk-{0}", StringHelpers.RandomAlphanumericString(5));
            containerType = containerType ?? "Plate96";
            indexByWell = indexByWell ? indexByWell : false;

            var libraryContainer = client.CreateLibraryContainer(new CreateLibraryContainerRequest(libraryPrepId, userContainerId, containerType, indexByWell));
            var response = libraryContainer.Response ;
            Assert.NotNull(response);
            Assert.Equal(response.UserContainerId, userContainerId);
            return response;
        }
コード例 #16
0
 internal static LibraryPool CreateLibraryPoolWithMapping(IBaseSpaceClient client, IEnumerable<string>libraryIds, string userPoolId = null)
 {
     userPoolId = string.Format("pool-sdk-{0}", StringHelpers.RandomAlphanumericString(5)) ?? userPoolId;
     var libraryPool = client.CreateLibraryPool(new CreateLibraryPoolRequest(userPoolId, libraryIds)).Response;
     Assert.NotNull(libraryPool);
     //client.UpdatePoolToLibraryMapping(new UpdatePoolToLibraryMappingRequest(libraryPool.Id, libraryIds));
     return libraryPool;
 }
コード例 #17
0
        internal static PlannedRun CreatePlannedRun(IBaseSpaceClient client, IEnumerable<PlannedRunPoolMapping> poolMappings, int numCyclesRead1, string name=null, 
            string platformName=null, string analysisWorkFlowType=null)
        {
            var plannedRun = client.CreatePlannedRun(new CreatePlannedRunRequest(
                                poolMappings,
                                numCyclesRead1,
                                name ?? string.Format("Run-SDK-{0}", StringHelpers.RandomAlphanumericString(5)),
                                platformName ?? "NextSeq",
                                analysisWorkFlowType ?? "HiSeqFastQ",
                                "None"
                                )).Response;

            Assert.NotNull(plannedRun);
            return plannedRun;
        }
コード例 #18
0
 internal static void MarkRunAsReadyToSequence(IBaseSpaceClient client, string plannedRunId)
 {
     client.PlannedRunReadyRequest(new PlannedRunReadyRequest(plannedRunId, true));
     Assert.Equal(ListReadyRuns(client).Where(r => r.Id == plannedRunId).Count(), 1);
 }
コード例 #19
0
 internal static LibraryPrepKit GetLibraryPrepKit(IBaseSpaceClient client, string libraryPrepKitId)
 {
     var libraryPrepKit = client.GetLibraryPrepKit(new GetLibraryPrepKitIdRequest(libraryPrepKitId));
     Assert.NotNull(libraryPrepKit.Response);
     return libraryPrepKit.Response;
 }
コード例 #20
0
 internal static SampleLibrary[] GetSampleLibrariesInContainer(IBaseSpaceClient client, string containerId)
 {
     var sampleLibraries = client.GetContainerToLibraryMapping(new GetContainerToLibraryMappingRequest(containerId));
     var response = sampleLibraries.Response;
     Assert.NotNull(response);
     Assert.Equal(response.Items.FirstOrDefault().Container.Id, containerId);
     return response.Items;
 }