Пример #1
0
        /// <summary>
        /// returns a ClinVar object given the vcf line
        /// </summary>
        public static DgvItem ExtractDgvItem(string line, ChromosomeRenamer renamer)
        {
            var cols = line.Split('\t');

            if (cols.Length < 8)
            {
                return(null);
            }

            var id         = cols[0];
            var chromosome = cols[1];

            if (!InputFileParserUtilities.IsDesiredChromosome(chromosome, renamer))
            {
                return(null);
            }

            var start          = int.Parse(cols[2]);
            var end            = int.Parse(cols[3]);
            var variantType    = cols[4];
            var variantSubType = cols[5];
            var sampleSize     = int.Parse(cols[14]);
            var observedGains  = cols[15] == "" ? 0:int.Parse(cols[15]);
            var observedLosses = cols[16] == "" ? 0 : int.Parse(cols[16]);

            var seqAltType = SequenceAlterationUtilities.GetSequenceAlteration(variantType, variantSubType);

            return(new DgvItem(id, chromosome, start, end, sampleSize, observedGains, observedLosses, seqAltType));
        }
Пример #2
0
        public override SupplementaryInterval GetSupplementaryInterval(ChromosomeRenamer renamer)
        {
            if (!IsInterval)
            {
                return(null);
            }

            var seqAltType = SequenceAlterationUtilities.GetSequenceAlteration(SvType, ObservedGains, ObservedLosses);

            var intValues    = new Dictionary <string, int>();
            var doubleValues = new Dictionary <string, double>();
            var freqValues   = new Dictionary <string, double>();
            var stringValues = new Dictionary <string, string>();
            var boolValues   = new List <string>();

            var suppInterval = new SupplementaryInterval(Start, SvEnd, Chromosome, AlternateAllele, seqAltType,
                                                         "1000 Genomes Project", renamer, intValues, doubleValues, freqValues, stringValues, boolValues);

            if (Id != null)
            {
                suppInterval.AddStringValue("id", Id);
            }
            if (AfrFreq != null)
            {
                suppInterval.AddFrequencyValue("variantFreqAfr", Convert.ToDouble(AfrFreq));
            }
            if (AllFreq != null)
            {
                suppInterval.AddFrequencyValue("variantFreqAll", Convert.ToDouble(AllFreq));
            }
            if (AmrFreq != null)
            {
                suppInterval.AddFrequencyValue("variantFreqAmr", Convert.ToDouble(AmrFreq));
            }
            if (EasFreq != null)
            {
                suppInterval.AddFrequencyValue("variantFreqEas", Convert.ToDouble(EasFreq));
            }
            if (EurFreq != null)
            {
                suppInterval.AddFrequencyValue("variantFreqEur", Convert.ToDouble(EurFreq));
            }
            if (SasFreq != null)
            {
                suppInterval.AddFrequencyValue("variantFreqSas", Convert.ToDouble(SasFreq));
            }

            if (AllAlleleNumber != null && AllAlleleNumber.Value > 0)
            {
                suppInterval.AddIntValue("sampleSize", AllAlleleNumber.Value);
            }
            if (AfrAlleleNumber != null && AfrAlleleNumber.Value > 0)
            {
                suppInterval.AddIntValue("sampleSizeAfr", AfrAlleleNumber.Value);
            }
            if (AmrAlleleNumber != null && AmrAlleleNumber.Value > 0)
            {
                suppInterval.AddIntValue("sampleSizeAmr", AmrAlleleNumber.Value);
            }
            if (EasAlleleNumber != null && EasAlleleNumber.Value > 0)
            {
                suppInterval.AddIntValue("sampleSizeEas", EasAlleleNumber.Value);
            }
            if (EurAlleleNumber != null && EurAlleleNumber.Value > 0)
            {
                suppInterval.AddIntValue("sampleSizeEur", EurAlleleNumber.Value);
            }
            if (SasAlleleNumber != null && SasAlleleNumber.Value > 0)
            {
                suppInterval.AddIntValue("sampleSizeSas", SasAlleleNumber.Value);
            }

            if (ObservedGains != 0)
            {
                suppInterval.AddIntValue("observedGains", ObservedGains);
            }
            if (ObservedLosses != 0)
            {
                suppInterval.AddIntValue("observedLosses", ObservedLosses);
            }

            return(suppInterval);
        }