{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/vnd.plotly.v1+html": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "import scipy\n", "import numpy as np\n", "import pandas as pd\n", "import itertools as it\n", "\n", "from math import sin\n", "import collections\n", "\n", "def recursively_default_dict():\n", " return collections.defaultdict(recursively_default_dict)\n", "\n", "from sklearn.neighbors import KernelDensity\n", "from sklearn.decomposition import PCA\n", "from sklearn.model_selection import GridSearchCV\n", "from sklearn.cluster import MeanShift, estimate_bandwidth\n", "from sklearn.metrics.pairwise import pairwise_distances\n", "from sklearn.metrics.pairwise import euclidean_distances\n", "from sklearn.preprocessing import scale\n", "\n", "from scipy.stats.stats import pearsonr \n", "\n", "from scipy.stats import invgamma \n", "from scipy.stats import beta\n", "import matplotlib.pyplot as plt\n", "\n", "import plotly\n", "import plotly.plotly as py\n", "import plotly.graph_objs as go\n", "from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot\n", "from plotly.graph_objs import *\n", "import plotly.figure_factory as ff\n", "\n", "from sklearn.metrics import silhouette_samples, silhouette_score\n", "\n", "\n", "from ipywidgets import interact, interactive, fixed, interact_manual\n", "import ipywidgets as widgets\n", "init_notebook_mode(connected=True)\n", "\n", "import Lab_modules.StructE_tools as Ste\n", "from Lab_modules.Generate_freq_vectors import generate_vectors_Beta" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "(2000, 100)\n", "(2000, 150)\n" ] } ], "source": [ "Nbranches= 4\n", "L= 150\n", "n= 100\n", "rangeA= [1,2.5]\n", "rangeB = [.1,.6]\n", "steps= 20\n", "n_comp = 100\n", "density= 50\n", "\n", "\n", "vector_lib= generate_vectors_Beta(L,n,rangeA,rangeB,steps,n_comp)\n", "\n", "pca = PCA(n_components=n_comp, whiten=False,svd_solver='randomized').fit(vector_lib)\n", "features = pca.transform(vector_lib)\n", "\n", "\n", "#features, vector_lib= generate_Branches_Beta(4,50,L,n,rangeA,rangeB,steps,n_comp)\n", "print(features.shape)\n", "print(vector_lib.shape)" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "### Functions to manipulate genetic structure.\n", "\n", "def sin_prior(coords,target,vector2,angle,fst_max= 0.2,passport= False):\n", " ID= 'sinusoid'\n", " \n", " coords[target[0]] = coords[target[0]] - [(fst_max * 10 - 1) * sin(angle) * x for x in vector2]\n", " \n", " if passport:\n", " return coords,ID\n", " else:\n", " return coords\n", "\n", "\n", "def linear_prior(coords,target,vector2,angle,region= [-5,5],slope= 1,passport= False):\n", " ID= 'linear'\n", " \n", " if angle >= region[0] and angle <= region[1]:\n", " progression= abs(angle - region[0]) / (region[1] - region[0])\n", " coords[target[0]] = coords[target[0]] + [progression * x * slope for x in vector2]\n", " \n", " if passport:\n", " return coords,ID\n", " else:\n", " return coords\n", "\n", "\n", "def introgression_prior(coords,target,vector2,angle, region,passport= False):\n", " ID= 'introgression'\n", " \n", " if angle >= region[0] and angle <= region[1]:\n", " coords[target[0]] = coords[1]\n", " \n", " if passport:\n", " return coords,ID\n", " else:\n", " return coords\n", " \n", "\n", "def alien_prior_I(coords,target,vector2,angle,fst= .2,region= [-5,5],passport= False):\n", " ID= 'alien I'\n", " \n", " if angle >= region[0] and angle <= region[1]:\n", " coords[target[0]] = coords[target[0]] + [(10 * fst - 1) * x for x in vector2]\n", " #coords[target[0]] = coords[target[0]] + [sin(angle) * x for x in vector2] remember to try this though\n", " #coords[target[0]] = coords[len(coords) - 1]\n", " else:\n", " coords[target[0]] = coords[target[1]]\n", " \n", " if passport:\n", " return coords,ID\n", " else:\n", " return coords\n", "\n", "\n", "def alien_prior_II(coords,target,vector2,angle,fst= .2,region= [-5,5],passport= False):\n", " ID= 'alien II'\n", " \n", " if angle >= region[0] and angle <= region[1]:\n", " coords[target[0]] = coords[target[0]] + [(10 * fst - 1) * x for x in vector2]\n", " #coords[target[0]] = coords[target[0]] + [sin(angle) * x for x in vector2] remember to try this though\n", " #coords[target[0]] = coords[len(coords) - 1]\n", " \n", " if passport:\n", " return coords,ID\n", " else:\n", " return coords\n", "\n", "\n", "def alien_prior_III(coords,target,vector2,angle,fst_a= 0.2,fst_b= .2,region= [-5,5],passport= False):\n", " ID= 'alien III'\n", " \n", " if angle >= region[0] and angle <= region[1]:\n", " coords[target[0]] = coords[target[0]] + [(10 * fst_b-1) * x for x in vector2]\n", " #coords[target[0]] = coords[target[0]] + [sin(angle) * x for x in vector2] remember to try this though\n", " #coords[target[0]] = coords[len(coords) - 1]\n", " else:\n", " coords[target[0]] = coords[target[0]] + [(10 * fst_a-1) * x for x in vector2]\n", " \n", " if passport:\n", " return coords,ID\n", " else:\n", " return coords\n", "\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "C:\\Users\\jgarcia\\Desktop\\Jupyter_stuff\\Genetic-data-analysis\\StructE_tools.py:398: RuntimeWarning:\n", "\n", "invalid value encountered in double_scalars\n", "\n" ] }, { "data": { "application/vnd.plotly.v1+json": { "config": { "linkText": "Export to plot.ly", "plotlyServerURL": "https://plot.ly", "showLink": true }, "data": [ { "mode": "markers", "name": "(0, 1)", "type": "scatter", "uid": "5c08c48b-2e25-40dc-a81a-55ad1f6391b8", "x": [ -10000, -9797, -9595, -9393, -9191, -8989, -8787, -8585, -8383, -8181, -7979, -7777, -7575, -7373, -7171, -6969, -6767, -6565, -6363, -6161, -5959, -5757, -5555, -5353, -5151, -4949, -4747, -4545, -4343, -4141, -3939, -3737, -3535, -3333, -3131, -2929, -2727, -2525, -2323, -2121, -1919, -1717, -1515, -1313, -1111, -909, -707, -505, -303, -101, 101, 303, 505, 707, 909, 1111, 1313, 1515, 1717, 1919, 2121, 2323, 2525, 2727, 2929, 3131, 3333, 3535, 3737, 3939, 4141, 4343, 4545, 4747, 4949, 5151, 5353, 5555, 5757, 5959, 6161, 6363, 6565, 6767, 6969, 7171, 7373, 7575, 7777, 7979, 8181, 8383, 8585, 8787, 8989, 9191, 9393, 9595, 9797, 10000 ], "y": [ -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, 0.27065714465332924, 0.27065714465332924, 0.27065714465332924, 0.27065714465332924, 0.27065714465332924, 0.27065714465332924, 0.27065714465332924, 0.27065714465332924, 0.27065714465332924, 0.27065714465332924, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17, -1.84857820227674e-17 ] }, { "mode": "markers", "name": "(0, 2)", "type": "scatter", "uid": "d4f2a47e-2a2f-4fec-98e8-6409cf0aa272", "x": [ -10000, -9797, -9595, -9393, -9191, -8989, -8787, -8585, -8383, -8181, -7979, -7777, -7575, -7373, -7171, -6969, -6767, -6565, -6363, -6161, -5959, -5757, -5555, -5353, -5151, -4949, -4747, -4545, -4343, -4141, -3939, -3737, -3535, -3333, -3131, -2929, -2727, -2525, -2323, -2121, -1919, -1717, -1515, -1313, -1111, -909, -707, -505, -303, -101, 101, 303, 505, 707, 909, 1111, 1313, 1515, 1717, 1919, 2121, 2323, 2525, 2727, 2929, 3131, 3333, 3535, 3737, 3939, 4141, 4343, 4545, 4747, 4949, 5151, 5353, 5555, 5757, 5959, 6161, 6363, 6565, 6767, 6969, 7171, 7373, 7575, 7777, 7979, 8181, 8383, 8585, 8787, 8989, 9191, 9393, 9595, 9797, 10000 ], "y": [ 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.204208618275184, 0.204208618275184, 0.204208618275184, 0.204208618275184, 0.204208618275184, 0.204208618275184, 0.204208618275184, 0.204208618275184, 0.204208618275184, 0.204208618275184, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352, 0.08617340880985352 ] }, { "mode": "markers", "name": "(0, 3)", "type": "scatter", "uid": "3436bf95-9d8a-4348-90a4-9960fc872a86", "x": [ -10000, -9797, -9595, -9393, -9191, -8989, -8787, -8585, -8383, -8181, -7979, -7777, -7575, -7373, -7171, -6969, -6767, -6565, -6363, -6161, -5959, -5757, -5555, -5353, -5151, -4949, -4747, -4545, -4343, -4141, -3939, -3737, -3535, -3333, -3131, -2929, -2727, -2525, -2323, -2121, -1919, -1717, -1515, -1313, -1111, -909, -707, -505, -303, -101, 101, 303, 505, 707, 909, 1111, 1313, 1515, 1717, 1919, 2121, 2323, 2525, 2727, 2929, 3131, 3333, 3535, 3737, 3939, 4141, 4343, 4545, 4747, 4949, 5151, 5353, 5555, 5757, 5959, 6161, 6363, 6565, 6767, 6969, 7171, 7373, 7575, 7777, 7979, 8181, 8383, 8585, 8787, 8989, 9191, 9393, 9595, 9797, 10000 ], "y": [ 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.1939710774484019, 0.1939710774484019, 0.1939710774484019, 0.1939710774484019, 0.1939710774484019, 0.1939710774484019, 0.1939710774484019, 0.1939710774484019, 0.1939710774484019, 0.1939710774484019, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908 ] }, { "mode": "markers", "name": "(1, 2)", "type": "scatter", "uid": "c02378af-0716-45de-8801-7410fa7626eb", "x": [ -10000, -9797, -9595, -9393, -9191, -8989, -8787, -8585, -8383, -8181, -7979, -7777, -7575, -7373, -7171, -6969, -6767, -6565, -6363, -6161, -5959, -5757, -5555, -5353, -5151, -4949, -4747, -4545, -4343, -4141, -3939, -3737, -3535, -3333, -3131, -2929, -2727, -2525, -2323, -2121, -1919, -1717, -1515, -1313, -1111, -909, -707, -505, -303, -101, 101, 303, 505, 707, 909, 1111, 1313, 1515, 1717, 1919, 2121, 2323, 2525, 2727, 2929, 3131, 3333, 3535, 3737, 3939, 4141, 4343, 4545, 4747, 4949, 5151, 5353, 5555, 5757, 5959, 6161, 6363, 6565, 6767, 6969, 7171, 7373, 7575, 7777, 7979, 8181, 8383, 8585, 8787, 8989, 9191, 9393, 9595, 9797, 10000 ], "y": [ 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535, 0.0861734088098535 ] }, { "mode": "markers", "name": "(1, 3)", "type": "scatter", "uid": "1f5a8a1d-430d-42ca-bd3b-10089648a140", "x": [ -10000, -9797, -9595, -9393, -9191, -8989, -8787, -8585, -8383, -8181, -7979, -7777, -7575, -7373, -7171, -6969, -6767, -6565, -6363, -6161, -5959, -5757, -5555, -5353, -5151, -4949, -4747, -4545, -4343, -4141, -3939, -3737, -3535, -3333, -3131, -2929, -2727, -2525, -2323, -2121, -1919, -1717, -1515, -1313, -1111, -909, -707, -505, -303, -101, 101, 303, 505, 707, 909, 1111, 1313, 1515, 1717, 1919, 2121, 2323, 2525, 2727, 2929, 3131, 3333, 3535, 3737, 3939, 4141, 4343, 4545, 4747, 4949, 5151, 5353, 5555, 5757, 5959, 6161, 6363, 6565, 6767, 6969, 7171, 7373, 7575, 7777, 7979, 8181, 8383, 8585, 8787, 8989, 9191, 9393, 9595, 9797, 10000 ], "y": [ 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908, 0.09504173357133908 ] }, { "mode": "markers", "name": "(2, 3)", "type": "scatter", "uid": "5bf481d4-4b4b-4843-9817-41daca9aa2a0", "x": [ -10000, -9797, -9595, -9393, -9191, -8989, -8787, -8585, -8383, -8181, -7979, -7777, -7575, -7373, -7171, -6969, -6767, -6565, -6363, -6161, -5959, -5757, -5555, -5353, -5151, -4949, -4747, -4545, -4343, -4141, -3939, -3737, -3535, -3333, -3131, -2929, -2727, -2525, -2323, -2121, -1919, -1717, -1515, -1313, -1111, -909, -707, -505, -303, -101, 101, 303, 505, 707, 909, 1111, 1313, 1515, 1717, 1919, 2121, 2323, 2525, 2727, 2929, 3131, 3333, 3535, 3737, 3939, 4141, 4343, 4545, 4747, 4949, 5151, 5353, 5555, 5757, 5959, 6161, 6363, 6565, 6767, 6969, 7171, 7373, 7575, 7777, 7979, 8181, 8383, 8585, 8787, 8989, 9191, 9393, 9595, 9797, 10000 ], "y": [ 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354, 0.09530394327317354 ] } ], "layout": { "title": "Fst across sets. prior: alien III", "xaxis": { "title": "eucledian distance in feature space" }, "yaxis": { "range": [ 0, 0.5 ], "title": "fsts" } } }, "text/html": [ "
" ], "text/vnd.plotly.v1+html": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "from Generate_samples import Gen_samples, Check_Path, plot_GenFst\n", "\n", "\n", "Sizes= [100,100,100,100]\n", "\n", "Npops= len(Sizes)\n", "\n", "range_diff= [-10,10]\n", "\n", "\n", "prior_kwargs= {\n", " 'fst_a': .0,\n", " 'fst_b': 0.3,\n", " 'region': [-3,-1]\n", "}\n", "\n", "prior_func= alien_prior_III\n", "\n", "fig, Pops, prior= Check_Path(Npops,vector_lib,prior_func,prior_kwargs,Pops= [],random= True,n_comp= L,range_diff= range_diff,steps= 100)\n", "\n", "iplot(fig)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "...\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "C:\\Users\\jgarcia\\Desktop\\Jupyter_stuff\\Genetic-data-analysis\\StructE_tools.py:398: RuntimeWarning:\n", "\n", "invalid value encountered in double_scalars\n", "\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Done.\n" ] } ], "source": [ "# (Pops,Sizes,vector_lib,return_pca= False,n_comp= 100,prior= 'sinusoid',range_diff= [-10,10],steps= 100)\n", "\n", "SequenceStore, Fst_windows= Gen_samples(Pops,Sizes,vector_lib,prior_func,prior_kwargs,range_diff= range_diff,steps= 100)" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "ename": "NameError", "evalue": "name 'Fst_windows' is not defined", "output_type": "error", "traceback": [ "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)", "\u001b[1;32mFailed to display Jupyter Widget of type interactive
.
\n", " If you're reading this message in the Jupyter Notebook or JupyterLab Notebook, it may mean\n", " that the widgets JavaScript is still loading. If this message persists, it\n", " likely means that the widgets JavaScript library is either not installed or\n", " not enabled. See the Jupyter\n", " Widgets Documentation for setup instructions.\n", "
\n", "\n", " If you're reading this message in another frontend (for example, a static\n", " rendering on GitHub or NBViewer),\n", " it may mean that your frontend doesn't currently support widgets.\n", "
\n" ], "text/plain": [ "interactive(children=(Dropdown(description='selected_group', options=(0, 1, 2), value=0), Output()), _dom_classes=('widget-interact',))" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/plain": [ "Failed to display Jupyter Widget of type interactive
.
\n", " If you're reading this message in the Jupyter Notebook or JupyterLab Notebook, it may mean\n", " that the widgets JavaScript is still loading. If this message persists, it\n", " likely means that the widgets JavaScript library is either not installed or\n", " not enabled. See the Jupyter\n", " Widgets Documentation for setup instructions.\n", "
\n", "\n", " If you're reading this message in another frontend (for example, a static\n", " rendering on GitHub or NBViewer),\n", " it may mean that your frontend doesn't currently support widgets.\n", "
\n" ], "text/plain": [ "interactive(children=(Dropdown(description='gp', options=(-1, 0, 1, 2), value=-1), Output()), _dom_classes=('widget-interact',))" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/plain": [ "Failed to display Jupyter Widget of type interactive
.
\n", " If you're reading this message in the Jupyter Notebook or JupyterLab Notebook, it may mean\n", " that the widgets JavaScript is still loading. If this message persists, it\n", " likely means that the widgets JavaScript library is either not installed or\n", " not enabled. See the Jupyter\n", " Widgets Documentation for setup instructions.\n", "
\n", "\n", " If you're reading this message in another frontend (for example, a static\n", " rendering on GitHub or NBViewer),\n", " it may mean that your frontend doesn't currently support widgets.\n", "
\n" ], "text/plain": [ "interactive(children=(Dropdown(description='selected_group', options=(0, 1, 2, 3), value=0), Output()), _dom_classes=('widget-interact',))" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/plain": [ "