Пример #1
0
        public void AddEntry(string chromosome, int position, string refAllele, string altAllele, string vcfString, List <string> jsonStrings)
        {
            if ((jsonStrings == null || jsonStrings.Count == 0) && string.IsNullOrEmpty(vcfString))
            {
                return;
            }

            //validate the vcf reference
            if (!ValidateReference(chromosome, position, refAllele))
            {
                return;
            }

            if (!chromosome.Equals(_currentChromosome))
            {
                _tsvIndex.AddTagPosition(chromosome, _bgzipTextWriter.Position);
                // Console.WriteLine($"chr {chromosome}, filePos: {_bgzipTextWriter.Position}");
                _currentChromosome = chromosome;
            }

            refAllele = string.IsNullOrEmpty(refAllele) ? "-" : refAllele;
            altAllele = string.IsNullOrEmpty(altAllele) ? "-" : altAllele;

            _bgzipTextWriter.Write($"{chromosome}\t{position}\t{refAllele}\t{altAllele}\t{vcfString}");

            if (jsonStrings != null)
            {
                foreach (var jsonString in jsonStrings)
                {
                    _bgzipTextWriter.Write($"\t{jsonString}");
                }
            }

            _bgzipTextWriter.Write("\n");
        }
Пример #2
0
        public void AddEntry(string chromosome, int start, int end, string jsonString)
        {
            if (string.IsNullOrEmpty(jsonString))
            {
                return;
            }

            if (chromosome != _currentChromosome)
            {
                _tsvIndex.AddTagPosition(chromosome, _bgzipTextWriter.Position);
                _currentChromosome = chromosome;
            }

            _bgzipTextWriter.Write($"{chromosome}\t{start}\t{end}\t{jsonString}\n");
        }
Пример #3
0
        public void AddEntry(string chromosome, int position, string globalMajorAllele, string refAllele)
        {
            if (globalMajorAllele == null)
            {
                throw new Exception($"no global major allele for {chromosome}:{position}");
            }

            //validate the vcf reference
            if (!ValidateReference(chromosome, position, refAllele))
            {
                return;
            }

            if (!chromosome.Equals(_currentChromosome))
            {
                _tsvIndex.AddTagPosition(chromosome, _bgzipTextWriter.Position);
                //Console.WriteLine($"chr {chromosome}, filePos: {_bgzipTextWriter.Position}");
                _currentChromosome = chromosome;
            }

            _bgzipTextWriter.Write($"{chromosome}\t{position}\t{globalMajorAllele}\n");
        }