Skip to content

Instantly share code, notes, and snippets.

Avatar

Juan Manuel Berros jmberros

View GitHub Profile
@jmberros
jmberros / read_args_from_command_line.py
Last active Nov 23, 2016
Read arguments from command line
View read_args_from_command_line.py
from sys import argv
def main(arg1, arg2):
# Your logic here
pass
if __name__ == '__main__':
main(argv[1], argv[2])
@jmberros
jmberros / tax_ids_to_name_and_lineage.py
Last active Nov 23, 2016
Get Taxa scientific name and lineage from Entrez
View tax_ids_to_name_and_lineage.py
from Bio import Entrez
taxids_filename = '/tmp/taxids.list' # Replace with the path to your Tax IDs file!
with open(taxids_filename) as f:
tax_ids = f.read().split('\n')
Entrez.email = 'user@example.org' # Put your email here
handle = Entrez.efetch('taxonomy', id=tax_ids, rettype='xml')
response = Entrez.read(handle)
@jmberros
jmberros / country_from_nuccore_accessions.py
Last active Nov 24, 2020
Get the country field for the given nuccore accession numbers.
View country_from_nuccore_accessions.py
from Bio import Entrez
# Read the accessions from a file
accessions_file = 'accessions.txt'
with open(accessions_file) as f:
ids = f.read().split('\n')
# Fetch the entries from Entrez
Entrez.email = 'name@example.org' # Insert your email here
handle = Entrez.efetch('nuccore', id=ids, retmode='xml')
View testing
<iframe src='/widget/#{current_client.slug}' style='height: #{height}px; width: 300px;' scrolling='no'></iframe>" %>