Skip to content

Instantly share code, notes, and snippets.

@bkamapantula
Created April 28, 2016 00:38
Show Gist options
  • Save bkamapantula/3b45dcdc38c5a4a98b9998e95c96f1a7 to your computer and use it in GitHub Desktop.
Save bkamapantula/3b45dcdc38c5a4a98b9998e95c96f1a7 to your computer and use it in GitHub Desktop.
Gets metadata of GSM accession using GEOmetadb.sqlite
Display the source blob
Display the rendered blob
Raw
import sqlite3
# from https://gbnci-abcc.ncifcrf.gov/geo/
geo_db = "GEOmetadb.sqlite"
# connects to the database
sra_con = sqlite3.connect(geo_db)
cursor = sra_con.cursor()
gsms = ['GSM409307', 'GSM1220601', 'GSM1120314', 'GSM1120315', 'GSM1112815', 'GSM1112816', 'GSM1112817', 'GSM1112818', 'GSM410808']
#cursor.execute("PRAGMA table_info(gsm);")
for gsm in gsms:
cursor.execute("SELECT source_name_ch1 FROM gsm WHERE gsm='%s';" % gsm)
print cursor.fetchall()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment