Exemplo n.º 1
0
        private EBIApplicationResult GenerateSequencesFromXml(XmlReader reader)
        {
            XmlSerializer        serializer = new XmlSerializer(typeof(EBIApplicationResult));
            EBIApplicationResult result     = (EBIApplicationResult)serializer.Deserialize(reader);

            return(result);
        }
Exemplo n.º 2
0
 public bool GetBlastSearchResult(SequenceProject project, string path, UserProject userProject)
 {
     if (project != null)
     {
         //XmlResult
         string result = path + project.BlastSearchGuid + ".xml.xml";
         if (!File.Exists(result))
         {
             result = blastService.GetResults(project.BlastSearchGuid, result);
             if (String.IsNullOrEmpty(result))
             {
                 return(false);
             }
         }
         if (!String.IsNullOrEmpty(result))
         {
             using (StreamReader sr = new StreamReader(result))
             {
                 StringBuilder        sb        = new StringBuilder();
                 XmlReader            reader    = XmlReader.Create(sr);
                 EBIApplicationResult ebiResult = GenerateSequencesFromXml(reader);
                 if (ebiResult != null && ebiResult.SequenceSimilaritySearchResult != null)
                 {
                     IList <Sequence> sequencies = CreateBlastSequencies(ebiResult.SequenceSimilaritySearchResult.hits, project, userProject);
                     if (project.Alligments == null)
                     {
                         project.Alligments = new List <AlignmentSequence>();
                     }
                     if (sequencies != null && sequencies.Any())
                     {
                         AlignmentSequence allign = new AlignmentSequence()
                         {
                             Created           = DateTime.Now,
                             CreatorId         = project.CreatorId,
                             Description       = "BlastAlignment",
                             IsFinished        = false,
                             _id               = ObjectId.GenerateNewId(),
                             Source            = "Blast",
                             AllignedSequences = new List <AlignRecord>()
                         };
                         foreach (Sequence seq in sequencies)
                         {
                             allign.AllignedSequences.Add(new AlignRecord()
                             {
                                 AlignedSequence = seq.BlastAlignedSequence,
                                 Organism        = seq.Organism,
                                 SequenceId      = seq._id,
                                 SequenceName    = seq.Name,
                                 SequenceHeader  = seq.Description
                             });
                         }
                         project.Alligments.Add(allign);
                         db.UpdateItem(project);
                         return(true);
                     }
                 }
             }
         }
     }
     return(false);
 }