Package: geo-alchemy
geo-alchemya Python library and command line tool to make GEO data into gold.why geo-alchemyinstallationuse as Python libraryparse metadata from GEOparse platformparse sampleparse seriesserialization and deserializationuse as command line softwareusing OCMpreprocessingwhy geo-alchemyGEO is like a gold mine that contains a huge many gold ore.
But processing these gold ore(GEO series) into gold(expression matrix, clinical data) is not very easy:how to map microarray probe to gene?how about multiple probes map to same gene?hot to get clinical data?...geo-alchemy was born to deal with it.installationIf you only want use as Python library:pip install geo-alchemyIf you also want use as command line software:pip install 'geo-alchemy[cmd]'use as Python libraryparse metadata from GEOparse platformfromgeo_alchemyimportPlatformParserparser=PlatformParser.from_accession('GPL570')platform1=parser.parse()# orplatform2=PlatformParser.from_accession('GPL570').parse()print(platform1==platform2)# get platform annotation dataplatform=PlatformParser.from_accession('GPL570',view='full').parse()print(platform.internal_data)parse samplefromgeo_alchemyimportSampleParserparser=SampleParser.from_accession('GSM1885279')sample1=parser.parse()# orsample2=SampleParser.from_accession('GSM1885279').parse()print(sample1==sample2)parse seriesfromgeo_alchemyimportSeriesParserparser=SeriesParser.from_accession('GSE73091')series1=parser.parse()# orseries2=SeriesParser.from_accession('GSE73091').parse()print(series1==series2)print(series1.platforms)print(series1.samples)print(series1.organisms)serialization and deserializationFor the convenience of saving, all objects in geo-alchemy can be converted to dict,
and this dict can be directly saved to a file in json form.Moreover, geo-alchemy also provides methods to convert these dicts into objects.fromgeo_alchemyimportSeriesParserseries1=SeriesParser.from_accession('GSE73091').parse()data=series1.to_dict()series2=SeriesParser.parse_dict(data)print(series1==series2)use as command line softwareusing OCMOCM(object command mapping) is a Python framework mapping Python object to command line software.
It can capture intermediate results of command, you can enable OCM output like this:geo-alchemy xxx --ocmirprobe reannotationPrerequisites:NCBI BLAST must be installed.BLAST Index must be generated.for more details, refer tothis page.geo-alchemy -d reanno -p GPL15303 -s 9 -d /Users/dev/Data/blast-indexes/GRCh38.p13/GRCh38.p13-p GPL15303probe reannotation for GPL15303-s 9the 9th column of platform annotation file is probe sequence-d xxxblast indexes locationif your reference sequences are download from GENCODE, enable--gencodecan extract gene symbol from gene ID:geo-alchemy -d reanno -p GPL15303 -s 9 -d /Users/dev/Data/blast-indexes/GRCh38.p13/GRCh38.p13 --gencodepreprocessing(microarray series only)download metadata using network:geo-alchemy pp -s GSE174772 -p GPL570 -g 11-s GSE174772preprocessing for GSE174772-p GPL570preprocessing samples who use GPL570 of GSE174772-g 11NO.11 column of GPL570 annotation file is genethis command generate 2 files under current directory:clinical fileGSE174772_clinical.txtgene expression fileGSE174772_expression.txtuse existed series metadata:importjsonfromgeo_alchemyimportSeriesParserseries=SeriesParser.from_accession('GSE174772').parse()data=series.to_dict()withopen('GSE174772.json','w')asfp:json.dump(data,fp)geo-alchemy pp -sf GSE174772.json -g 11using existing probe gene mapping file.
usually you usegeo-alchemy reannodo probe reannotation,
this make you get a probe gene mapping file, you can:geo-alchemy reanno -p GPL6480 -s 17 -d /Users/dev/Data/blast-indexes/GRCh38.p13/GRCh38.p13 --gencode
geo-alchemy pp -s GSE12435 -m GPL6480_reanno.txt