Skip to content

Instantly share code, notes, and snippets.

View lubianat's full-sized avatar
🐦
pluft plaft zum

Tiago Lubiana lubianat

🐦
pluft plaft zum
View GitHub Profile
chance_de_covid = 0.5
doentes_no_placebo = 1
doentes_na_vacina = 0
total_de_pessoas_por_grupo = 2
doentes_totais = doentes_na_vacina + doentes_no_placebo
doentes_no_placebo = 1
doentes_na_vacina = 0
total_de_pessoas_por_grupo = 2
chance_de_covid = doentes_no_placebo/total_de_pessoas_por_grupo
@lubianat
lubianat / p_valor_vacina.R
Created January 12, 2021 20:42
Simulação simples de P valor
doentes_no_placebo = 1
doentes_na_vacina = 0
total_de_pessoas_por_grupo = 2
chance_de_covid = doentes_no_placebo/total_de_pessoas_por_grupo
doentes_totais = doentes_na_vacina + doentes_no_placebo
import requests
import sys
import pandas as pd
url = sys.argv[1]
session = requests.Session() # so connections are recycled
resp = session.head(url, allow_redirects=True)
url_sparql = resp.url.replace("https://query.wikidata.org/#", "https://query.wikidata.org/sparql?query=")
r = requests.get(url_sparql, params = {'format':'json'})
@lubianat
lubianat / mini_cl.ttl
Created February 14, 2022 17:13
Minimal snipped of Cell Ontology
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix cl: <http://purl.obolibrary.org/obo/CL_> .
cl:0000451 rdfs:label "dendritic cell" .
cl:0000784 rdfs:label "plasmacytoid dendritic cell" .
cl:0000784 rdfs:subClassOf cl:0000451 .
@lubianat
lubianat / diseases_in_beta_cells.rq
Created February 15, 2022 17:23
Wikidata Query for diseases related to beta cells via genes in common
SELECT
?cellTypeLabel ?diseaseLabel
(COUNT(DISTINCT ?diseaseGene) AS ?count)
(GROUP_CONCAT(DISTINCT ?geneLabel; SEPARATOR=", ") AS ?genes)
WHERE
{
wd:Q101405087 wdt:P8872 ?diseaseGene .
?disease wdt:P2293 ?diseaseGene .
wd:Q101405087 rdfs:label ?cellTypeLabel .
?disease rdfs:label ?diseaseLabel .
@lubianat
lubianat / pubchem2wikidata.py
Created October 19, 2022 00:21
pubchem2wikidata
import pubchempy as pcp
cid = 44584134
name = "cannabisin D"
compound = pcp.Compound.from_cid(cid)
ref = "|S248|Q278487"
quickstatements = (
"CREATE\n"
@lubianat
lubianat / create_qr.py
Created March 22, 2023 20:07
Create a QR Code using Python
import qrcode
# the link that you want to convert into a QR code
link = "https://lubianat.github.io/natal_bioinformatics2wikidata/"
# create a QR code instance
qr = qrcode.QRCode(version=1, box_size=10, border=5)
# add data to the QR code instance
qr.add_data(link)
@lubianat
lubianat / gist:fb160b7b0b60455b1a926e651795b6e2
Last active July 18, 2023 16:02
Remove Wikibase statements with a deleted item as value
import requests
from login import WD_USER, WD_PASS
import json
from wikibaseintegrator import WikibaseIntegrator
from wikibaseintegrator.wbi_helpers import remove_claims
from wikibaseintegrator.wbi_login import Clientlogin
from helper import wbi_config
## Deleted items are manually selected at this point
deleted_items = ["Q334", "Q348", "Q349", "Q351"]