Skip to content

Commit

Permalink
🧐 update smarter summary
Browse files Browse the repository at this point in the history
removed shadows from pie charts. Add sample by chip type for goats
  • Loading branch information
bunop committed Aug 31, 2024
1 parent 157b222 commit 0884c0c
Showing 1 changed file with 45 additions and 6 deletions.
51 changes: 45 additions & 6 deletions notebooks/results/0.2.0-bunop-smarter_summary.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"id": "3cc84f47-db82-43eb-99fd-78768ecd2a99",
"metadata": {},
"source": [
"# SMARTER SUMMARY (2024/05/23)\n",
"# SMARTER SUMMARY (2024/08/31)\n",
"* [Dataset composition](#datasets-composition)\n",
" * [Foreground / background datasets](#foreground-vs-background-datasets)\n",
" * [Datasets by chip type](#datasets-by-chip-type)\n",
Expand All @@ -16,6 +16,7 @@
" * [Foreground / background samples for goat](#foreground-background-samples-goat)\n",
" * [Greece foreground goat data](#greece-foreground-goat-data)\n",
" * [Sweden foreground goat data](#sweden-foreground-goat-data)\n",
" * [Goat samples by chip type](#goat-sample-by-chip-type)\n",
"* [Draw samples by country](#samples-by-country)\n",
" * [Sheep samples by country](#sheep-samples-by-country)\n",
" * [Goat samples by country](#goat-samples-by-country)\n",
Expand Down Expand Up @@ -106,7 +107,7 @@
"metadata": {},
"outputs": [],
"source": [
"plot = datasets.value_counts(\"type\").plot.pie(y=\"type\", figsize=(8,8), shadow=True, startangle=45, rotatelabels=45, autopct='%1.1f%%')\n",
"plot = datasets.value_counts(\"type\").plot.pie(y=\"type\", figsize=(8,8), startangle=45, rotatelabels=45, autopct='%1.1f%%')\n",
"_ = plt.title(\"Foreground vs Background genotype datasets\")\n",
"plt.ylabel(None)\n",
"plt.savefig('smarter-fgVsbg-datasets.png', dpi=300, bbox_inches='tight')\n",
Expand All @@ -130,7 +131,7 @@
"metadata": {},
"outputs": [],
"source": [
"plot = datasets['chip_name'].value_counts().plot.pie(y=\"chip\", figsize=(8,8), shadow=True, startangle=45, rotatelabels=45, autopct='%1.1f%%')\n",
"plot = datasets['chip_name'].value_counts().plot.pie(y=\"chip\", figsize=(8,8), startangle=45, rotatelabels=45, autopct='%1.1f%%')\n",
"_ = plt.title(\"Datasets by chip type\")\n",
"plt.ylabel(None)\n",
"plt.savefig('smarter-datasets-by-chips.png', dpi=300, bbox_inches='tight')\n",
Expand Down Expand Up @@ -159,7 +160,7 @@
"foreground_sheep = SampleSheep.objects.filter(type_=\"foreground\").fields(country=True, breed=True, chip_name=True, locations=True)\n",
"background_sheep = SampleSheep.objects.filter(type_=\"background\").fields(country=True, breed=True, chip_name=True, locations=True)\n",
"samples_sheep = pd.Series({\"foreground\": foreground_sheep.count(), \"background\": background_sheep.count()}, name=\"Sheep\")\n",
"plot = samples_sheep.plot.pie(y=\"Sheep\", figsize=(8,8), shadow=True, startangle=90, rotatelabels=45, autopct='%1.1f%%')\n",
"plot = samples_sheep.plot.pie(y=\"Sheep\", figsize=(8,8), startangle=90, rotatelabels=45, autopct='%1.1f%%')\n",
"_ = plt.title(\"Background VS Foreground sheep\")\n",
"plt.ylabel(None)\n",
"plt.savefig('sheep-foreground-vs-background-pie.png', dpi=300, bbox_inches='tight')\n",
Expand Down Expand Up @@ -205,7 +206,7 @@
"metadata": {},
"outputs": [],
"source": [
"sheep_by_chip.plot.pie(y=\"count\", figsize=(8,8), shadow=True, startangle=-45, rotatelabels=45, autopct='%1.1f%%', legend=False)\n",
"sheep_by_chip.plot.pie(y=\"count\", figsize=(8,8), startangle=-45, rotatelabels=45, autopct='%1.1f%%', legend=False)\n",
"_ = plt.title(\"Sheep samples by chip type\")\n",
"plt.ylabel(None)\n",
"plt.savefig('sheep-samples-by-chip-type.png', dpi=300, bbox_inches='tight')\n",
Expand Down Expand Up @@ -345,7 +346,7 @@
"foreground_goats = SampleGoat.objects.filter(dataset__in=Dataset.objects.filter(type_=\"foreground\")).fields(country=True, breed=True, chip_name=True, locations=True, metadata=True)\n",
"background_goats = SampleGoat.objects.filter(dataset__in=Dataset.objects.filter(type_=\"background\")).fields(country=True, breed=True, chip_name=True, locations=True, metadata=True)\n",
"samples_goat = pd.Series({\"foreground\": foreground_goats.count(), \"background\": background_goats.count()}, name=\"Goats\")\n",
"plot = samples_goat.plot.pie(y=\"Goat\", figsize=(8,8), shadow=True, rotatelabels=45, autopct='%1.1f%%')\n",
"plot = samples_goat.plot.pie(y=\"Goat\", figsize=(8,8), rotatelabels=45, autopct='%1.1f%%')\n",
"_ = plt.title(\"Background VS Foreground goats\")\n",
"plt.ylabel(None)\n",
"plt.savefig('goat-foreground-vs-background-pie.png', dpi=300, bbox_inches='tight')\n",
Expand Down Expand Up @@ -479,6 +480,44 @@
"foreground_goats.value_counts('region')"
]
},
{
"cell_type": "markdown",
"id": "c59376dd",
"metadata": {},
"source": [
"<a id='goat-sample-by-chip-type'></a>\n",
"### Goat samples by chip type\n",
"Try to determine the sample composition by chip type:"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "33dd743b",
"metadata": {},
"outputs": [],
"source": [
"goat_by_chip = defaultdict(list)\n",
"for chip_name in SampleGoat.objects.distinct(\"chip_name\"):\n",
" goat_by_chip['chip_name'].append(chip_name)\n",
" goat_by_chip['count'].append(SampleGoat.objects.filter(chip_name=chip_name).count())\n",
"goat_by_chip = pd.DataFrame.from_dict(goat_by_chip).set_index(\"chip_name\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "b78717e7",
"metadata": {},
"outputs": [],
"source": [
"goat_by_chip.plot.pie(y=\"count\", figsize=(8,8), startangle=-45, rotatelabels=45, autopct='%1.1f%%', legend=False)\n",
"_ = plt.title(\"Goat samples by chip type\")\n",
"plt.ylabel(None)\n",
"plt.savefig('goat-samples-by-chip-type.png', dpi=300, bbox_inches='tight')\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"id": "8c3c128e-f8a7-47fd-812b-89266bcec1ca",
Expand Down

0 comments on commit 0884c0c

Please sign in to comment.