static void Main(string[] args) { var id = new SeqId("XR_242110", 1); var fac = new EntrezSequenceFactory(); var seq = fac.Get(id); Console.WriteLine($"{id.ToString()} at 0 = {seq[0]}"); }
public override string ToString() { var sb = new StringBuilder("FriendRequest("); bool __first = true; if (EMid != null && __isset.eMid) { if (!__first) { sb.Append(", "); } __first = false; sb.Append("EMid: "); EMid.ToString(sb); } if (Mid != null && __isset.mid) { if (!__first) { sb.Append(", "); } __first = false; sb.Append("Mid: "); Mid.ToString(sb); } if (__isset.direction) { if (!__first) { sb.Append(", "); } __first = false; sb.Append("Direction: "); Direction.ToString(sb); } if (__isset.method) { if (!__first) { sb.Append(", "); } __first = false; sb.Append("Method: "); Method.ToString(sb); } if (Param != null && __isset.param) { if (!__first) { sb.Append(", "); } __first = false; sb.Append("Param: "); Param.ToString(sb); } if (__isset.timestamp) { if (!__first) { sb.Append(", "); } __first = false; sb.Append("Timestamp: "); Timestamp.ToString(sb); } if (__isset.seqId) { if (!__first) { sb.Append(", "); } __first = false; sb.Append("SeqId: "); SeqId.ToString(sb); } if (DisplayName != null && __isset.displayName) { if (!__first) { sb.Append(", "); } __first = false; sb.Append("DisplayName: "); DisplayName.ToString(sb); } if (PicturePath != null && __isset.picturePath) { if (!__first) { sb.Append(", "); } __first = false; sb.Append("PicturePath: "); PicturePath.ToString(sb); } if (PictureStatus != null && __isset.pictureStatus) { if (!__first) { sb.Append(", "); } __first = false; sb.Append("PictureStatus: "); PictureStatus.ToString(sb); } sb.Append(")"); return(sb.ToString()); }
public ISequence Get(SeqId id) { if (id == null) { throw new ArgumentNullException("id"); } ServicePointManager.ServerCertificateValidationCallback = delegate { return(true); }; WebClient web = new WebClient(); string address = $"https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=nuccore&id={id.ToString()}&rettype=fasta&retmode=text"; var fasta = web.DownloadString(address); var result = fasta.Split('\n'); var sb = new StringBuilder(); for (int i = 1; i < result.Length; ++i) { sb.Append(result[i]); } return(SequenceUtils.SequenceFromString(id, sb.ToString())); }