public HttpResponseMessage Get(string reaction) { try { if (!supportedReactions.Contains(reaction.ToUpper())) { StringBuilder message = new StringBuilder(); message.Append("Supported reactions: "); foreach (var str in supportedReactions) { message.Append(str.ToLower() + " , "); } return(Request.CreateResponse(HttpStatusCode.BadRequest, message.ToString().Substring(0, message.Length - 2))); } ReactionCount reactionResult = FDAConnector.GetReactionCount(reaction); reactionResult.results.Sort(); reactionResult.results = reactionResult.results.Take(10).ToList(); return(Request.CreateResponse(HttpStatusCode.OK, reactionResult)); } catch (Exception e) { Debug.WriteLine("\nException Caught!"); Debug.WriteLine("Message :{0} ", e.Message); return(Request.CreateResponse(HttpStatusCode.InternalServerError, String.Format("Server Error {0}", e.Message))); } }
// GET api/values public ReactionCount Get() { ReactionCount r = new ReactionCount { results = new List <Result>() { new Result { Term = "a", Count = 5 } } }; return(r); }
/// <summary> /// Simulate a Step and return data /// </summary> /// <param name="stepDuration">Step duration in seconds.</param> public SimulationStep Step(double stepDuration) { CTrajectoryTask trajectoryTask = copasi.TrajectoryTask; CTrajectoryProblem problem = (CTrajectoryProblem)trajectoryTask.getProblem(); problem.setDuration(stepDuration); currentTime += stepDuration; try { // now we run the actual trajectory trajectoryTask.processWithOutputFlags(true, (int)CCopasiTask.NO_OUTPUT); } catch { if (CCopasiMessage.size() > 0) { throw new System.Exception("Running the time course simulation failed: " + CCopasiMessage.getAllMessageText(true)); } throw new System.Exception("Running the time course simulation failed"); } // Update the species properties that have changed ReactionCount[] reactionCount = new ReactionCount[reactionList.Count]; for (int i = 0; i < reactionList.Count; i++) { CopasiReactionGroup r = reactionList[i]; reactionCount[i] = r.CalcParticleFlux(); } // clean up trajectoryTask.restore(); return(new SimulationStep(reactionCount)); }
public override string ToString() { StringBuilder __sb = new StringBuilder("AFUserReactions("); bool __first = true; if (__isset.commentCount) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("CommentCount: "); __sb.Append(CommentCount); } if (KnownCommenters != null && __isset.knownCommenters) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("KnownCommenters: "); __sb.Append(KnownCommenters.ToDebugString()); } if (ReactionCount != null && __isset.reactionCount) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("ReactionCount: "); __sb.Append(ReactionCount.ToDebugString()); } if (KnownReactors != null && __isset.knownReactors) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("KnownReactors: "); __sb.Append(KnownReactors.ToDebugString()); } if (MyReactions != null && __isset.myReactions) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("MyReactions: "); __sb.Append(MyReactions.ToDebugString()); } if (__isset.viewCount) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("ViewCount: "); __sb.Append(ViewCount); } __sb.Append(")"); return(__sb.ToString()); }