예제 #1
0
        /// <summary>
        /// loads all the genes in the specified file
        /// </summary>
        private List <MutableGene> LoadGenes(string genesPath, string description)
        {
            var genes = new List <MutableGene>();

            using (var reader = new VepGeneReader(genesPath))
            {
                if (_header == null)
                {
                    _header = reader.Header;
                }

                while (true)
                {
                    var gene = reader.Next();
                    if (gene == null)
                    {
                        break;
                    }

                    genes.Add(gene);
                }
            }

            var transcriptDataSource  = genes.First().TranscriptDataSource;
            int numGenesWithoutSymbol = GetNumGenesWithoutSymbol(description, genes);

            if (numGenesWithoutSymbol > 0 && transcriptDataSource == TranscriptDataSource.RefSeq)
            {
                ResolveMissingRefSeqGeneSymbols(description, genes);
            }

            return(genes);
        }
예제 #2
0
        /// <summary>
        /// constructor
        /// </summary>
        public TempPredictionReader(string filePath, string description, GlobalImportCommon.FileType fileType)
        {
            // sanity check
            if (!File.Exists(filePath))
            {
                throw new FileNotFoundException($"The specified protein function prediction file ({filePath}) does not exist.");
            }

            // open the vcf file and parse the header
            _reader = GZipUtilities.GetAppropriateBinaryReader(filePath);
            Header  = GetHeader(description, filePath, fileType, _reader);
        }
예제 #3
0
        /// <summary>
        /// constructor
        /// </summary>
        public VepGeneReader(string filePath)
        {
            // sanity check
            if (!File.Exists(filePath))
            {
                throw new FileNotFoundException($"The specified gene file ({filePath}) does not exist.");
            }

            // open the vcf file and parse the header
            _reader = GZipUtilities.GetAppropriateStreamReader(filePath);
            Header  = VepReaderCommon.GetHeader("gene", filePath, GlobalImportCommon.FileType.Gene, _reader);
        }
예제 #4
0
        /// <summary>
        /// constructor
        /// </summary>
        public VepTranscriptReader(string filePath)
        {
            // sanity check
            if (!File.Exists(filePath))
            {
                throw new FileNotFoundException($"The specified transcripts file ({filePath}) does not exist.");
            }

            // open the vcf file and parse the header
            _filePath = filePath;
            _reader   = GZipUtilities.GetAppropriateStreamReader(filePath);
            Header    = GetHeader();
        }
예제 #5
0
 /// <summary>
 /// writes the header to our output file
 /// </summary>
 private static void WriteHeader(StreamWriter writer, GlobalImportHeader header)
 {
     writer.WriteLine("{0}\t{1}", GlobalImportCommon.Header, (byte)GlobalImportCommon.FileType.Gene);
     writer.WriteLine("{0}\t{1}\t{2}\t{3}", header.VepVersion, header.VepReleaseTicks,
                      (byte)TranscriptDataSource.BothRefSeqAndEnsembl, (byte)header.GenomeAssembly);
 }