View reference_extraction.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
FROM: https://gist.github.com/sobolevnrm/412763ebae5424a92d3239898b615e2a | |
Process RIS format following the standard at", | |
http://referencemanager.com/sites/rm/files/m/direct_export_ris.pdf """ | |
import re | |
ALLOWED_TAGS = {"TY" : "Record start", | |
"ER" : "Record end", |
View get_photo_unsplash.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# get photo from unsplash | |
# depends on python-unsplash | |
# !pip install python-unsplash | |
from unsplash.api import Api | |
from unsplash.auth import Auth | |
import requests | |
from PIL import Image | |
from io import BytesIO |
View resnews_template_word.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# create style | |
from docx import Document | |
# create style | |
from docx.enum.style import WD_STYLE_TYPE | |
from docx.shared import Inches, Pt | |
## TO DO | |
## [1] add an image in a cell |
View resnews_templating.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from string import Template | |
xDocHead = '''<!DOCTYPE html> | |
<html><head> | |
<meta http-equiv="content-type" content="text/html; charset=windows-1252"> | |
<style> | |
.title_orange { | |
font-family: Verdana, Geneva, sans-serif; | |
font-size: 14px; |
View open_patent_services.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from base64 import b64encode | |
import requests | |
import json | |
UrlAuth = 'https://ops.epo.org/3.2/auth/accesstoken' | |
UrlServiceBase = 'https://ops.epo.org/3.2/rest-services/published-data' | |
UrlServiceBaseSearch = UrlServiceBase + '/search/biblio/?q=' | |
View HungarianMethod.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import numpy as np | |
from scipy.optimize import linear_sum_assignment | |
def make_assignments(xDF): | |
''' | |
a simple wrapper around the | |
scipy.optimize.linear_sum_assignment | |
which implements the Hungarian Algorithm |
View genMetaPaths.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# coding: utf-8 | |
# March 7th, 2019 (by mm) | |
## Generating paths (walks) | |
## inspired by the original py4genMetaPaths.py from | |
## but also : by stellargraph | |
## TO DO : create tests | |
import pandas as pd | |
import random |
View PythonExcelConditionalFormat.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# CONDITIONAL FORMATTING in Excel with python | |
# we could use OpenPyXL or xlsxwriter | |
# Here we use xlsxwriter | |
#https://xlsxwriter.readthedocs.io/working_with_conditional_formats.html | |
#https://xlsxwriter.readthedocs.io/example_conditional_format.html#ex-cond-format | |
import pandas as pd | |
import xlsxwriter | |
View misc.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# a collection of various functionlities | |
## export json records from pandas | |
xSQL = '''select * from studies_analysis.qa_oa_syg_joined_dataset limit 5''' | |
d1 = pd.read_sql(xSQL, xPGCon) | |
d1.to_json('qa_oa_syg_joined_dataset.json', orient= 'records') | |
View wikipathway_parse
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests, base64, xmltodict | |
xUrl = 'http://webservice.wikipathways.org/getPathway?pwId=WP901' | |
xq1 = requests.get(xUrl) | |
xgml_field = xmltodict.parse(xq1.content)['ns1:getPathwayResponse']['ns1:pathway']['ns2:gpml'] | |
base64.b64decode(xgml_field ) |
NewerOlder