Ejemplo n.º 1
0
    public static DataBundle New(string id)
    {
        DataBundle newDataBundle = New();

        newDataBundle.id = id;
        return(newDataBundle);
    }
Ejemplo n.º 2
0
    public void OpenGamePanel(bool pvpModel)
    {
        var datas = new DataBundle();

        datas.PutData("pvpModel", pvpModel);
        StartPanel("GamePanel", null, datas);
    }
Ejemplo n.º 3
0
        private static ExitCodes ProgramExecution()
        {
            var logger     = new ConsoleLogger();
            var bundle     = DataBundle.GetDataBundle(_inputReferencePath, _inputPrefix);
            int numRefSeqs = bundle.SequenceReader.NumRefSeqs;
            var chromosome = ReferenceNameUtilities.GetChromosome(bundle.SequenceReader.RefNameToChromosome, _referenceName);

            bundle.Load(chromosome);

            string outputStub  = GetOutputStub(chromosome, bundle.Source);
            var    interval    = new ChromosomeInterval(chromosome, _referencePosition, _referenceEndPosition);
            var    transcripts = GetTranscripts(logger, bundle, interval);

            var    sift           = GetPredictionStaging(logger, "SIFT", transcripts, chromosome, bundle.SiftPredictions, bundle.SiftReader, x => x.SiftIndex, numRefSeqs);
            var    polyphen       = GetPredictionStaging(logger, "PolyPhen", transcripts, chromosome, bundle.PolyPhenPredictions, bundle.PolyPhenReader, x => x.PolyPhenIndex, numRefSeqs);
            string referenceBases = GetReferenceBases(logger, bundle.SequenceReader, interval);

            var regulatoryRegionIntervalArrays = GetRegulatoryRegionIntervalArrays(logger, bundle.TranscriptCache, interval, numRefSeqs);
            var transcriptIntervalArrays       = PredictionUtilities.UpdateTranscripts(transcripts, bundle.SiftPredictions,
                                                                                       sift.Predictions, bundle.PolyPhenPredictions, polyphen.Predictions, numRefSeqs);

            var transcriptStaging = GetTranscriptStaging(bundle.TranscriptCacheData.Header, transcriptIntervalArrays, regulatoryRegionIntervalArrays);

            WriteCache(logger, FileUtilities.GetCreateStream(CacheConstants.TranscriptPath(outputStub)), transcriptStaging, "transcript");
            WriteCache(logger, FileUtilities.GetCreateStream(CacheConstants.SiftPath(outputStub)), sift.Staging, "SIFT");
            WriteCache(logger, FileUtilities.GetCreateStream(CacheConstants.PolyPhenPath(outputStub)), polyphen.Staging, "PolyPhen");
            WriteReference(logger, CacheConstants.BasesPath(outputStub), bundle.SequenceReader, chromosome,
                           referenceBases, interval.Start);

            return(ExitCodes.Success);
        }
Ejemplo n.º 4
0
 public static List <ITranscript> GetTranscripts(DataBundle bundle, IChromosomeInterval interval)
 {
     ITranscript[] overlappingTranscripts =
         bundle.TranscriptCache.TranscriptIntervalForest.GetAllOverlappingValues(interval.Chromosome.Index,
                                                                                 interval.Start, interval.End);
     return(overlappingTranscripts?.ToList() ?? new List <ITranscript>());
 }
Ejemplo n.º 5
0
    private void CloseMessageDialog(bool confirm)
    {
        var datas = new DataBundle();

        datas.PutData("confirm", confirm);
        Close(datas);
    }
Ejemplo n.º 6
0
    /// <summary>
    /// Updates the DataBundleCollection, wherever possible updating only values and not changing the bound variables, to avoid reinjecting the collection.
    /// </summary>
    public void CopyValuesFrom(DataBundleCollection dataBundleCollection)
    {
        if (dataBundleCollection == this)
        {
            return;
        }

        List <DataBundle> remainingDataBundles = dataBundles.Where(db => dataBundleCollection.dataBundles.Contains(db)).ToList();

        dataBundles.Clear();

        foreach (DataBundle dataBundle in dataBundleCollection.dataBundles)
        {
            DataBundle existingDataBundle = remainingDataBundles.Find(db => db.id == dataBundle.id);

            if (existingDataBundle)
            {
                existingDataBundle.CopyValuesFrom(dataBundle);
                Add(existingDataBundle);
            }
            else
            {
                Add(dataBundle);
            }
        }
    }
Ejemplo n.º 7
0
        /// <summary>
        /// updates a regulatory region
        /// mini-cache filename example: ENSR00000079256_chr1_Ensembl72_reg.ndb
        /// </summary>
        public UpdateStatus Update(DataBundle bundle, string outputCacheDir, ushort desiredVepVersion, List <string> outputFiles)
        {
            var regulatoryElement = MiniCacheUtilities.GetDesiredRegulatoryElement(bundle, _regulatoryId);

            if (regulatoryElement == null)
            {
                return(UpdateStatus.IdNotFound);
            }

            bundle.Load(regulatoryElement.ReferenceIndex);

            var outputCache = CreateCache(bundle.Cache.Header, new[] { regulatoryElement });

            var outputStub = GetOutputStub(outputCacheDir, _regulatoryId,
                                           bundle.Sequence.Renamer.UcscReferenceNames[regulatoryElement.ReferenceIndex], TranscriptDataSource,
                                           desiredVepVersion);

            var refIndices = new HashSet <ushort> {
                regulatoryElement.ReferenceIndex
            };

            MiniCacheUtilities.WriteTranscriptCache(outputCache, outputStub, outputFiles);
            MiniCacheUtilities.WriteEmptyBases(bundle, refIndices, outputStub, outputFiles);

            return(UpdateStatus.Current);
        }
Ejemplo n.º 8
0
        public static void WriteBases(DataBundle bundle, List <TranscriptPacket> packets, string outputStub,
                                      List <string> outputFiles)
        {
            var refPath = outputStub + ".bases" + TempCacheExt;

            outputFiles.Add(refPath);

            const int flankingLength = 500;

            using (var writer = new CompressedSequenceWriter(refPath, bundle.SequenceReader.Metadata,
                                                             bundle.Sequence.CytogeneticBands, bundle.Cache.Header.GenomeAssembly))
            {
                for (ushort refIndex = 0; refIndex < bundle.Sequence.Renamer.NumRefSeqs; refIndex++)
                {
                    var interval = GetBoundingInterval(packets, refIndex, flankingLength);
                    if (interval == null)
                    {
                        continue;
                    }

                    LoadSequence(bundle, refIndex);
                    var bases = bundle.Sequence.Substring(interval.Start, interval.End - interval.Start + 1);

                    var ensemblRefName = bundle.Sequence.Renamer.EnsemblReferenceNames[refIndex];
                    writer.Write(ensemblRefName, bases, interval.Start);
                }
            }
        }
Ejemplo n.º 9
0
    public void OnCancelClicked()
    {
        var datas = new DataBundle();

        datas.PutData("confirm", false);
        Close(datas);
    }
Ejemplo n.º 10
0
    public override void OnEscapeDown()
    {
        var datas = new DataBundle();

        datas.PutData("confirm", false);
        Close(datas);
    }
Ejemplo n.º 11
0
 public override void InitDialog(DataBundle datas = null)
 {
     if (datas != null)
     {
         var message = datas.ContainsKey("message") ? (string)datas.GetData("message") : "";
         messageText.SetText(message);
     }
 }
Ejemplo n.º 12
0
    protected virtual void Output(DataBundle dataBundle, bool copyValues = true)
    {
        DataBundleCollection dataBundleCollection = new DataBundleCollection();

        dataBundleCollection.Add(dataBundle);

        Output(dataBundleCollection, copyValues);
    }
Ejemplo n.º 13
0
 public DialogBase(string name, int?resultCode = null, DataBundle datas = null, bool blockFlag = true, bool modelFlag = true)
 {
     Name       = name;
     ResultCode = resultCode;
     Datas      = datas;
     BlockFlag  = blockFlag;
     ModelFlag  = modelFlag;
 }
Ejemplo n.º 14
0
    public void OnConfirmClicked()
    {
        var datas = new DataBundle();

        datas.PutData("confirm", true);
        datas.PutData("animeFlag", animeFlag);
        datas.PutData("selectFlag", selectFlag);
        Close(datas);
    }
Ejemplo n.º 15
0
 private static void LoadSequence(DataBundle bundle, ushort refIndex)
 {
     if (refIndex == bundle.CurrentRefIndex)
     {
         return;
     }
     bundle.SequenceReader.GetCompressedSequence(bundle.Sequence.Renamer.EnsemblReferenceNames[refIndex]);
     bundle.CurrentRefIndex = refIndex;
 }
Ejemplo n.º 16
0
        private static Transcript[] GetDesiredTranscripts(DataBundle bundle, Tuple <ushort, int, int> variantInterval)
        {
            var overlappingTranscripts = new List <Transcript>();

            bundle.TranscriptForest.GetAllOverlappingValues(variantInterval.Item1, variantInterval.Item2,
                                                            variantInterval.Item3, overlappingTranscripts);

            return(overlappingTranscripts.ToArray());
        }
Ejemplo n.º 17
0
        public VerfiyScreen(DataBundle dataBundle)
        {
            InitializeComponent();

            DataBundle = dataBundle;
            ValidDataConetet.Content = _ValidDataList;
            _selected = RefereeButton;
            ChangeList(dataBundle.Referees);
        }
Ejemplo n.º 18
0
    public void Remove(string id)
    {
        DataBundle dataBundle = GetDataBundle(id);

        if (dataBundle != null)
        {
            dataBundles.Remove(dataBundle);
        }
    }
Ejemplo n.º 19
0
 private void FinishWithDataIfConnected(bool isHost)
 {
     if (Bluetooth.Instance.IsConnected())
     {
         var datas = new DataBundle();
         datas.PutData("isHost", isHost);
         Finish(datas);
     }
 }
Ejemplo n.º 20
0
    public void Inject(DataBundle dataBundle)
    {
        this.dataBundle.Value = dataBundle;

        // If SetOnValueChanged is true, this will be called automatically
        if (SetOnValueChanged == false)
        {
            Set();
        }
    }
Ejemplo n.º 21
0
    public void OnConfirmClicked()
    {
        var datas = new DataBundle();

        datas.PutData("confirm", true);
        datas.PutData("initiative", initiative);
        datas.PutData("fusionModel", fusionFlag);
        datas.PutData("hiddenModel", hiddenFlag);
        Close(datas);
    }
Ejemplo n.º 22
0
        public static PredictionCacheStaging GetStaging(DataBundle bundle, bool useSift, List <TranscriptPacket> packets,
                                                        int numRefSeqs)
        {
            var cache = useSift ? bundle.SiftCache : bundle.PolyPhenCache;

            if (cache == null || packets.Count == 0)
            {
                return(null);
            }
            return(GetStagingWithPredictionIndices(cache, useSift, packets, numRefSeqs));
        }
Ejemplo n.º 23
0
    public override void InitDialog(DataBundle datas = null)
    {
        Bluetooth.SetBluetoothVisible();
        var listener = Bluetooth.GetBluetoothListener();

        listener.OnGetSocketConnectDelegate = delegate
        {
            closeFlag = true;
        };
        Bluetooth.StartAcceptThread();
    }
    protected SpawnedInjector GetSpawnedInjector(DataBundle dataBundle)
    {
        foreach (SpawnedInjector spawnedInjector in spawnedChildren)
        {
            if (spawnedInjector.dataBundle.id == dataBundle.id)
            {
                return(spawnedInjector);
            }
        }

        return(null);
    }
        private async void VerfiyClick(object sender, RoutedEventArgs e)
        {
            if (_workHistoryBundlePath != null)
            {
                DataBundle dataBundle = await Utils.ReadFromJson <DataBundle>(_workHistoryBundlePath);

                VerfiyScreen verfiyScreen = new VerfiyScreen(dataBundle);

                Main main = (Main)Window.GetWindow(this);
                main.Content = verfiyScreen;
            }
        }
Ejemplo n.º 26
0
    /// <summary>
    /// Copies the values from all variables in the provided DataBundle, without overriding the variables themselves.
    /// </summary>
    public void CopyValuesFrom(DataBundle dataBundle)
    {
        foreach (var dataKeyPair in dataBundle.data)
        {
            SetOrUpdateValue(dataKeyPair.key, dataKeyPair.data);
        }

        foreach (var eventKeyPair in dataBundle.events)
        {
            Set(eventKeyPair.key, eventKeyPair.gameEvent);
        }
    }
Ejemplo n.º 27
0
 public override void InitPanel(DataBundle datas = null)
 {
     LoadConfig();
     PVPModel = (bool)datas.GetData("pvpModel");
     if (PVPModel)
     {
         OpenBluetoothPanel();
     }
     else
     {
         OpenNewOkDialog();
     }
 }
Ejemplo n.º 28
0
    public override void OnPanelResult(int?resultCode, DataBundle datas)
    {
        switch (resultCode)
        {
        case (int)ResultCode.HostDialog:
            FinishWithDataIfConnected(true);
            break;

        case (int)ResultCode.JoinDialog:
            FinishWithDataIfConnected(false);
            break;
        }
    }
    protected void UpdateChildDataBundle(SpawnedInjector spawnedInjector, DataBundle newDataBundle)
    {
        if (newDataBundle != spawnedInjector.dataBundle)
        {
            if (logUpdates)
            {
                Debug.Log("DataInjectorCollection: Updating child DataBundle: " + spawnedInjector.dataBundle.id, this);
            }

            spawnedInjector.dataBundle = newDataBundle;
            spawnedInjector.injector?.Inject(spawnedInjector.dataBundle);
        }
    }
Ejemplo n.º 30
0
 public override void OnPanelResult(int?resultCode, DataBundle datas)
 {
     switch (resultCode)
     {
     case (int)ResultCode.ExitDialog:
         bool confirm = (bool)datas.GetData("confirm");
         if (confirm)
         {
             Application.Quit();
         }
         break;
     }
 }