Metadata-Version: 2.1
Name: xi-mzidentml-converter
Version: 0.2.0
Summary: xi-mzidentml-converter uses pyteomics (https://pyteomics.readthedocs.io/en/latest/index.html) to parse mzIdentML files (v1.2.0) and extract crosslink information. Results are written to a relational database (PostgreSQL or SQLite) using sqlalchemy.
Home-page: https://github.com/PRIDE-Archive/xi-mzidentml-converter
License: 'Apache 2.0
Keywords: crosslinking python proteomics
Platform: any
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: OS Independent
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE.md
Requires-Dist: lxml>=4.9.1
Requires-Dist: numpy>=1.14.3
Requires-Dist: pandas>=0.21.0
Requires-Dist: pymzml>=0.7.8
Requires-Dist: pyteomics>=4.7.2
Requires-Dist: requests>=2.31.0
Requires-Dist: urllib3>=1.24.2
Requires-Dist: pytest
Requires-Dist: psycopg2-binary
Requires-Dist: sqlalchemy==2.0.21
Requires-Dist: sqlalchemy-utils
Requires-Dist: obonet
Requires-Dist: python-multipart
Requires-Dist: python-jose
Requires-Dist: passlib
Requires-Dist: jose

# xi-mzidentml-converter
![python-app](https://github.com/Rappsilber-Laboratory/xi-mzidentml-converter/actions/workflows/python-app.yml/badge.svg)
[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)

xi-mzidentml-converter uses pyteomics (https://pyteomics.readthedocs.io/en/latest/index.html) to parse mzIdentML files (v1.2.0) and extract crosslink information. Results are written to a relational database (PostgreSQL or SQLite) using sqlalchemy.

### Requirements:
python3.10

pipenv

sqlite3 or postgresql (these instruction use posrgresql)

## 1. Installation

Clone git repository :

```git clone https://github.com/Rappsilber-Laboratory/xi-mzidentml-converter.git```

## 2. create a postgresql role and database to use

```
sudo su postgres
psql
create database xiview;
create user xiadmin with login password 'your_password_here';
grant all privileges on database xiview to xiadmin;
```

find the hba.conf file in the postgresql installation directory and add a line to allow  the xiadmin role to access the database:
e.g.
```
sudo nano /etc/postgresql/13/main/pg_hba.conf
```
then add the line:
`local   xiview   xiadmin   md5`

then restart postgresql:
```
sudo service postgresql restart
```

## 3. Configure the python environment for the file parser

edit the file xi-mzidentml-converter/config/database.ini to point to your postgressql database.
e.g. so its content is:
```
[postgresql]
host=localhost
database=xitest
user=xiadmin
password=your_password_here
port=5432
```

Set up the python environment:

```
cd x-mzidentml-converter
pipenv install --python 3.10
```

run create_db_schema.py to create the database tables:
```
python database/create_db_schema.py
```

parse a test dataset:
```
python process_dataset.py -d ~/PXD038060 -i PXD038060
```

The argument ```-d``` is the directory to read files from and ```-i``` is the project identifier to use in the database.

### To run tests

Make sure we have the right db user available
```
psql -p 5432 -c "create role ximzid_unittests with password 'ximzid_unittests';"
psql -p 5432 -c 'alter role ximzid_unittests with login;'
psql -p 5432 -c 'alter role ximzid_unittests with createdb;'
psql -p 5432 -c 'GRANT pg_signal_backend TO ximzid_unittests;'
```
run the tests

```pipenv run pytest```
