Metadata-Version: 2.1
Name: pubmed-mapper
Version: 0.0.2
Summary: PubMed Mapper: A Python library that map PubMed XML to Python object
Home-page: https://github.com/soultoolman/pubmed-mapper
Author: soultoolman
Author-email: soultooman@gmail.com
License: MIT
Platform: UNKNOWN
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
Requires-Python: >=3.6.0
Description-Content-Type: text/markdown
Requires-Dist: lxml
Requires-Dist: click
Requires-Dist: rich

# pubmed-mapper: A Python Library that map PubMed XML to Python object

## UML

![UML](pubmed-mapper.png)

## installation

```shell
pip install pubmed-mapper
```

## usage

### use as API

```python
from lxml import etree
from pubmed_mapper import Article


infile = 'xxx.xml'
with open(infile) as fp:
    root = etree.parse(fp)


articles = []
for pubmed_article_element in root.xpath('/PubmedArticleSet/PubmedArticle'):
    article =  Article.parse_element(pubmed_article_element)
    articles.append(article)
```

### use as command line software

#### parse single PubMed XML file

```
pubmed-mapper file -i data/pubmed21n0001.xml -o output/pubmed21n0001.jl
```

#### parse a directory who contains multiple PubMed XML files

```
pubmed-mapper directory -i data/ -o output/pubmed-mapper.jl
```

#### FAQs

##### 1. What is pubmed-mapper.log generated by pubmed-mapper?

pubmed-mapper.log is the default log file generate by pubmed-mapper,
you can change the file by using *--log-file* options:

```
pubmed-mapper --log-file my-custom.log file -i data/pubmed21n0001.xml -o output/pubmed21n0001.jl
```

You can go to this log file to find out more parsing details.

##### 2. I want log detail message in my log file?

Using *--log-level* can log more detail message:

```
pubmed-mapper --log-file my-custom.log --log-level DEBUG file -i data/pubmed21n0001.xml -o output/pubmed21n0001.jl
```


