https://github.com/JoaoRodrigues/sc-teaching/tree/master/intermediate-python-2020
This file contains hidden or 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 | |
""" | |
Queries Uniprot database and retrieves (canonical) sequences. | |
""" | |
import argparse | |
import sys | |
import urllib.request |
This file contains hidden or 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 | |
from __future__ import absolute_import, print_function | |
import collections | |
import re | |
import numpy as np | |
import warnings |
This file contains hidden or 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
# Copyright 2019 João Pedro Rodrigues | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software |
This file contains hidden or 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 | |
""" | |
Python script to reimage/unwrap an MD simulation trajectory | |
ran on the Anton2 supercomputer. | |
Expects a topology file in .dms format and the trajectory | |
folder '.dtr'. | |
Requires: |
This file contains hidden or 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 | |
""" | |
Script to benchmark Bio.PDB PDBParser on a collection | |
of PDB files. | |
""" | |
import argparse | |
import gzip | |
import pathlib |
This file contains hidden or 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 decimal | |
def frange(start, stop, step, include_stop=True): | |
"""Range-like function that accepts decimal step values.""" | |
# To avoid rounding issues | |
# We cast the floats to string and then to decimals | |
# see: docs on Decimal(0.1) != Decimal('0.1') | |
dstep = decimal.Decimal(str(step)) |
This file contains hidden or 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
"""Retrieve RCSB entry release dates using the API. | |
Example of combining Search and Data APIs | |
""" | |
import csv | |
import itertools | |
import json | |
import urllib3 | |
from datetime import datetime |
OlderNewer