Exemple #1
0
        public override void LoadData(string filePath)
        {
            string[] data = File.ReadAllLines(filePath);
            foreach (var dataLine in data.Skip(1))
            {
                var patientRepo = new PatientRepository();
                var sourceRepo = new SourceRepository();
                var entityRepo = new EntityRepository();

                var fields = dataLine.Split(Delimiter);
                var patient = patientRepo.AddPatient(fields[0], fields[1], fields[2], fields[3], DateTime.Parse(fields[4]));
                var resultedOn = DateTime.Parse(fields[5]);
                var lab = fields[6];
                var snps = new List<SnpResult>();
                for (int fieldIndex = 7; fieldIndex < 135; fieldIndex += 4)
                {
                    var snp = new SnpResult()
                    {
                        RSID = fields[fieldIndex],
                        Chromosome = fields[fieldIndex + 1],
                        Position = int.Parse(fields[fieldIndex + 2]),
                        Genotype = fields[fieldIndex + 3],
                        ReferenceBase = referenceBases[fields[fieldIndex]]
                    };
                    snps.Add(snp);
                }

                var source = sourceRepo.AddSource(lab, string.Empty);
                var file = AddResultFile(filePath, source);
                entityRepo.AddSnps(file, patient, resultedOn, snps);
            }
        }
Exemple #2
0
 public override void LoadData(string filePath)
 {
     string[] data = File.ReadAllLines(filePath);
     foreach (var dataLine in data.Skip(1))
     {
         var sourceRepo = new SourceRepository();
         var patientRepo = new PatientRepository();
         var entityRepo = new EntityRepository();
         var fields = dataLine.Split(Delimiter);
         var source = sourceRepo.AddSource(fields[5], string.Empty);
         var file = AddResultFile(filePath, source);
         var patient = patientRepo.AddPatient(fields[0], fields[1], fields[2], fields[3], DateTime.Parse(fields[4]));
         var attribute = EntityRepository.GetAttribute(fields[8], fields[9], fields[6], fields[7]);
         entityRepo.AddPhenotype(file, patient, attribute, DateTime.Parse(fields[10]));
     }
 }
Exemple #3
0
        public override void LoadData(string filePath)
        {
            string[] data = File.ReadAllLines(filePath);
            foreach (var dataLine in data.Skip(1))
            {
                var patientRepo = new PatientRepository();
                var entityRepo = new EntityRepository();
                var sourceRepo = new SourceRepository();

                var fields = dataLine.Split(Delimiter);
                var patient = patientRepo.AddPatient(fields[0], fields[1], fields[2], fields[3], DateTime.Parse(fields[4]));
                var resultedOn = DateTime.Parse(fields[5]);
                var lab = fields[6];
                List<StarVariantResult> stars = new List<StarVariantResult>();
                stars.Add(new StarVariantResult() { Gene = "CYP2C19", Result = fields[7] });
                stars.Add(new StarVariantResult() { Gene = "CYP2C9", Result = fields[8] });
                stars.Add(new StarVariantResult() { Gene = "VKORC1", Result = fields[9] });

                var source = sourceRepo.AddSource(lab, string.Empty);
                var file = AddResultFile(filePath, source);
                entityRepo.AddStarVariants(patient, file, resultedOn, stars);
            }
        }