Skip to content

Instantly share code, notes, and snippets.

View ozagordi's full-sized avatar

Osvaldo Zagordi ozagordi

View GitHub Profile
@ozagordi
ozagordi / incidenza_fascia_anag.csv
Created May 11, 2021 16:48
Incidenza per fascia anagrafica Milano
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
settiman;fascia_anagrafica;incidenza
0;80+;434
1;80+;304
2;80+;255
3;80+;261
4;80+;148
5;80+;197
6;80+;194
7;80+;179
8;80+;149
@ozagordi
ozagordi / dataproc.py
Last active March 25, 2021 08:06
Give names and other options to clusters
#!/usr/bin/env python
"""
data.csv from https://gist.github.com/tezzutezzu/8f025345cadc5f92b9b311bf032b264d
"""
import argparse
import json
import re
import subprocess
from urllib.request import urlopen
@ozagordi
ozagordi / server.R
Last active February 21, 2021 22:26
Plot del numero di dosi a disposizione ogni giorno
library(shiny)
library(readr)
library(dplyr)
library(tidyr)
library(ggplot2)
options(shiny.trace=TRUE)
map_names <- c(
"Abruzzo", "Basilicata", "Calabria", "Campania", "Emilia Romagna", "Friuli Venezia Giulia",
"Lazio", "Liguria", "Lombardia", "Marche", "Molise", "Provincia Autonoma Bolzano",
"Provincia Autonoma Trento", "Piemonte", "Puglia", "Sardegna", "Sicilia", "Toscana",
@ozagordi
ozagordi / call118.R
Created January 28, 2021 10:34
Chiamate al 118 Lombardia motivi respiratori e infettivi
library(tidyverse)
min_date <- "2010-09-01"
ma <- function(x, n = 5){stats::filter(x, rep(1 / n, n), sides = 2)}
tmp <- jsonlite::fromJSON("https://lab24.ilsole24ore.com/_json/dati-lombardiChiamate-auto.json")
pop_1 <- 1255437 + 1108126 + 180425
pop_2 <- 597642 + 334961 + 884876
pop_3 <- 3265327 + 870193
pop_4 <- 355908 + 227412 + 406919 + 540376
@ozagordi
ozagordi / alitable.py
Last active June 20, 2018 14:25
Make a table from a multiple sequence alignment
#!/usr/bin/env python
"""Create a csv table with the counts of aminoacids into an aligned fasta file, add the most frequent aa
at the end of the table.
"""
import sys
import pandas as pd
from collections import Counter
from Bio import AlignIO
@ozagordi
ozagordi / plot_unempl.R
Created April 12, 2017 15:12
Plot unemployment by education level in OECD countries, 2015
library(tidyverse)
unempl <- read.csv("unempl_education_2015_oecd.csv") %>%
select(-c(INDICATOR, MEASURE, FREQUENCY, TIME, Flag.Codes)) %>%
rename(country = LOCATION) %>%
filter(country != 'JPN') %>%
spread(SUBJECT, Value) %>%
rename(tertiary = TRY, `upper secondary` = UPPSRY_NTRY) %>%
mutate(delta = tertiary - `upper secondary`) %>%
arrange(`upper secondary`) %>%
mutate(x=1:n())
@ozagordi
ozagordi / README.md
Last active April 12, 2016 14:07
Viral genomes deposited in NCBI per month

Run the NCBI database interrogation with edirect command line tools and then create the figure with the included R script.

esearch -db nuccore -query "txid10239 [orgn] AND \"complete genome\" [Title] NOT txid131567 [orgn]" | \
efetch -format docsum | \
xtract -pattern DocumentSummary -element CreateDate > viral_dates.txt
@ozagordi
ozagordi / README.md
Last active November 23, 2015 10:03
Visitors of EXPO Milano 2015 in the last three months

Visitors of EXPO Milano 2015 in the last three months, data from EXPO website. Contains theme_agile from Robert Wilson.

@ozagordi
ozagordi / problast.py
Last active August 29, 2015 14:24
Simple script to blast assembly of reads of unknown origin
#!/usr/local/bin/python3.4
import os
import sys
import glob
import subprocess
from Bio import SeqIO
try:
rundate, sample = sys.argv[1:3]
@ozagordi
ozagordi / BLAST2SAM.md
Last active July 28, 2019 05:22
Converts BLAST output to SAM format

Python script that parses BLAST output in XML (-outfmt 5 option) and converts to SAM. It uses Biopython module Bio.Blast.NCBIXML and has been tested on BLASTN 2.2.30+.

Caveat emptor

  • No check is done (yet?) on whether reads have degenerate mappings.