Skip to content

Instantly share code, notes, and snippets.

View uludag's full-sized avatar

Mahmut Uludag uludag

View GitHub Profile
@uludag
uludag / read-hg19-regions.py
Last active August 1, 2016 06:28
Example script that queries UCSC DAS servers to retrieve 50 bases of sequence regions specified in an input file
#!/usr/bin/python3
# Example script that queries UCSC DAS servers to retrieve 50 bases of sequence regions
# specified in an input file (format: chr5 + 12345)
import csv
from urllib.request import FancyURLopener
urlOpener = FancyURLopener()
@uludag
uludag / copy-interactions-from-csv-to-neo4j.py
Last active August 10, 2016 13:53
Example script to copy protein-lncRNA interactions from an input CSV file to a Neo4j Database
#!/usr/bin/python3
"""
Example script to copy protein-lncRNA interactions from an input CSV file to a Neo4j Database
Example input file (header line expected, first 2 columns are protein identifiers):
Source,UniprotName,Target,lncRNA_name
NM_006428,RM28_HUMAN,ENSG00000278995,Z69720.3
"""
@uludag
uludag / ebi-sss-nodejs-rest-client.js
Last active August 24, 2016 11:00
Example Node.js script to submit NCBI-BLAST sequence similarity searches to EMBL-EBI compute farms
/*
Example Node.js script to submit NCBI-BLAST sequence similarity searches
on EMBL-EBI compute farms, input files can include multiple sequences.
Before running this script install required node.js libraries:
> npm install node-rest-client fasta-parser minimist querystring fs
Example command line:
> node ebi-sss-nodejs-rest-client.js\
--qseqsfile=your/query/sequences.fasta\
@uludag
uludag / ncbi-sss-client.js
Last active August 24, 2016 11:02
Example Node.js script to submit NCBI-BLAST sequence similarity searches to NCBI compute farms
/*
Example Node.js script to submit NCBI-BLAST sequence similarity searches
to NCBI compute farms.
https://blast.ncbi.nlm.nih.gov/Blast.cgi?CMD=Web&PAGE_TYPE=BlastDocs&DOC_TYPE=DeveloperInfo
1.) Do not contact the server more often than once every three seconds.
2.) Do not poll for any single RID more often than once a minute.
3.) Use the URL parameter email, and tool, so that we can track your project
and contact you if there is a problem.
4.) Run scripts weekends or between 9 pm and 5 am Eastern Time weekday
@uludag
uludag / biomart_gene_names_symbols.py
Last active December 10, 2016 14:09
Call genenames.org Biomart REST service to get gene names, symbols and aliases for a given list of Ensembl gene ids
#!/usr/bin/python
"""
Call genenames.org Biomart REST service to get gene names
and symbols for a given list of Ensembl gene ids.
Since this script uses the fetch API for each individual ID it is not fast
for large number of ids.
Script biomartxmlquery_gene_names_symbols.py[1] uses XML bulk queries
and is much faster when the number of ids are large.
[1] https://bitbucket.org/hspsdb/biomart-sample-clients/src
"""
@uludag
uludag / biomartxmlquery_gene_names_symbols.py
Last active December 12, 2016 13:05
Call genenames.org Biomart xml query service to get gene names, symbols and aliases for a given list of Ensembl gene ids
#!/usr/bin/python
"""
Script to call genenames.org Biomart xml query service to get gene names
and symbols for a given list of Ensembl gene ids
Usage:
> ./biomartxmlquery_gene_names_symbols.py --inputFile ensgeneids.txt > results.tsv
Input file: one Ensembl gene id per line
"""
@uludag
uludag / uniprot-sequence-isoforms.py
Created August 30, 2017 06:12
Sample UniProt sequence isoforms query
#!/usr/bin/env python
# Sample UniProt sequence isoforms query
import requests
uniprotid = "P00750"
params = {"query": uniprotid, "format": "fasta", "include": "yes"}
response = requests.get("http://www.uniprot.org/uniprot/", params=params)