Example #1
0
        public static bool ProcessGDCUploadReport(string fileName)
        {
            if (!File.Exists(fileName))
            {
                Console.WriteLine("File not found, Upload Report file from GDC: " + fileName);
                return(false);
            }

            int    counter = 0;
            string line;

            try
            {
                using (StreamReader file = new StreamReader(fileName))
                {
                    while ((line = file.ReadLine()) != null)
                    {
                        string[] parts = line.Split('\t');
                        if (parts.Length > 1)
                        {
                            if (parts[2] == "submitted_unaligned_reads")
                            {
                                counter++;
                                SeqFileInfo newDataFile = new SeqFileInfo
                                {
                                    Id             = parts[0],
                                    Related_case   = parts[1],
                                    EType          = parts[2],
                                    Submitter_id   = parts[4],
                                    ReadyForUpload = false
                                };

                                var tempSUR = new SUR();
                                if (GDCmetadata.SURdictionary.TryGetValue(parts[4], out tempSUR))
                                {
                                    newDataFile.DataFileName = tempSUR.file_name;
                                    newDataFile.DataFileSize = tempSUR.file_size;
                                }

                                Program.SeqDataFiles.Add(counter, newDataFile);
                            }
                        }
                    }
                    file.Close();
                }
            }
            catch
            {
                Console.WriteLine("Exception while processing upload report from the gdc: " + fileName);
                Console.WriteLine("Counter = " + counter.ToString());
                return(false);
            }
            return(true);
        }
Example #2
0
        public static Dictionary <string, SUR> SURdictionary = new Dictionary <string, SUR>();  // container for submitted unaligned reads entities
        // public static List<ReadGroup> ReadGroupList = new List<ReadGroup>();                 // list for read_group objects - do not need at this time

        public static bool LoadGDCJsonObjects(string inputString)
        {
            try
            {
                gdc_jsonObjects = JsonConvert.DeserializeObject <List <GDCjson> >(inputString, new GDCConverter());
            }
            catch
            {
                return(false);
            }

            SURdictionary.Clear();
            foreach (GDCjson gdcJsonOject in gdc_jsonObjects)
            {
                if (gdcJsonOject.type == "submitted_unaligned_reads")
                {
                    SubmittedUnalignedReads temp1 = new SubmittedUnalignedReads();
                    temp1 = gdcJsonOject as SubmittedUnalignedReads;

                    SUR temp2 = new SUR()
                    {
                        submitter_id = temp1.submitter_id,
                        file_name    = temp1.file_name,
                        file_size    = temp1.file_size,
                        md5sum       = temp1.md5sum,
                        project_id   = temp1.project_id
                    };

                    SURdictionary.Add(temp1.submitter_id, temp2);
                }
                // *** at this time we have no use for read_group objects, so do not load them
                //else if (gdcJsonOject.type == "read_group")
                //{
                //    ReadGroup temp1 = new ReadGroup();
                //    temp1 = gdcJsonOject as ReadGroup;
                //    ReadGroupList.Add(temp1);
                //}
            }

            gdc_jsonObjects.Clear();
            return(true);
        }