Example #1
0
        // constructor
        public IntermediateSampleFields(string[] vcfColumns, FormatIndices formatIndices, string[] sampleCols, bool fixGatkGenomeVcf = false)
        {
            VcfRefAllele  = vcfColumns[VcfCommon.RefIndex];
            FormatIndices = formatIndices;
            SampleColumns = sampleCols;

            if (formatIndices.MCC != null)
            {
                MajorChromosomeCount = int.Parse(sampleCols[formatIndices.MCC.Value]);
            }

            if (formatIndices.CN != null)
            {
                CopyNumber = int.Parse(sampleCols[formatIndices.CN.Value]);
            }

            if (fixGatkGenomeVcf && formatIndices.AD != null)
            {
                sampleCols[formatIndices.AD.Value] = CorrectAdInGatkGenomeVcf(sampleCols[formatIndices.AD.Value]);
            }
            if (formatIndices.DQ != null)
            {
                DenovoQuality = GetDenovoQuality(sampleCols[formatIndices.DQ.Value]);
            }

            AltAlleles = vcfColumns[VcfCommon.AltIndex].Split(',');

            CalculateTirTar();
            CalculateRawAlleleCounts();
            GetPlatypusCounts();
        }
Example #2
0
        /// <summary>
        /// extracts the genotype fields from the VCF file and returns a list of JSON samples
        /// </summary>
        internal List <JsonSample> ExtractSamples(bool fixGatkGenomeVcf = false)
        {
            // sanity check: make sure we have enough columns
            if (_vcfColumns.Length < VcfCommon.MinNumColumnsSampleGenotypes)
            {
                return(null);
            }

            var samples = new List <JsonSample>();

            // extract the indices for each genotype field
            _formatIndices = FormatIndices.Extract(_vcfColumns[VcfCommon.FormatIndex]);

            // add each sample
            for (var index = VcfCommon.GenotypeIndex; index < _vcfColumns.Length; index++)
            {
                samples.Add(ExtractSample(_vcfColumns[index], fixGatkGenomeVcf));
            }

            return(samples);
        }