SCiMS 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- scims-1.0.0/LICENSE +21 -0
- scims-1.0.0/MANIFEST.in +2 -0
- scims-1.0.0/PKG-INFO +222 -0
- scims-1.0.0/README.md +196 -0
- scims-1.0.0/SCiMS.egg-info/PKG-INFO +222 -0
- scims-1.0.0/SCiMS.egg-info/SOURCES.txt +30 -0
- scims-1.0.0/SCiMS.egg-info/dependency_links.txt +1 -0
- scims-1.0.0/SCiMS.egg-info/entry_points.txt +2 -0
- scims-1.0.0/SCiMS.egg-info/requires.txt +4 -0
- scims-1.0.0/SCiMS.egg-info/top_level.txt +2 -0
- scims-1.0.0/scims/__init__.py +35 -0
- scims-1.0.0/scims/__main__.py +196 -0
- scims-1.0.0/scims/classification.py +135 -0
- scims-1.0.0/scims/data/training_data_hmp_1000x_normalizedXY.txt +23637 -0
- scims-1.0.0/scims/helpers.py +98 -0
- scims-1.0.0/scims/process_idxstats.py +67 -0
- scims-1.0.0/scims/utils.py +87 -0
- scims-1.0.0/setup.cfg +4 -0
- scims-1.0.0/setup.py +39 -0
- scims-1.0.0/tests/.DS_Store +0 -0
- scims-1.0.0/tests/__init__.py +2 -0
- scims-1.0.0/tests/__pycache__/__init__.cpython-39.pyc +0 -0
- scims-1.0.0/tests/__pycache__/test_classification.cpython-39-pytest-8.4.2.pyc +0 -0
- scims-1.0.0/tests/__pycache__/test_helpers.cpython-39-pytest-8.4.2.pyc +0 -0
- scims-1.0.0/tests/__pycache__/test_process_idxstats.cpython-39-pytest-8.4.2.pyc +0 -0
- scims-1.0.0/tests/__pycache__/test_run.cpython-39-pytest-8.4.2.pyc +0 -0
- scims-1.0.0/tests/__pycache__/test_utils.cpython-39-pytest-8.4.2.pyc +0 -0
- scims-1.0.0/tests/test_classification.py +145 -0
- scims-1.0.0/tests/test_helpers.py +33 -0
- scims-1.0.0/tests/test_process_idxstats.py +100 -0
- scims-1.0.0/tests/test_run.py +57 -0
- scims-1.0.0/tests/test_utils.py +100 -0
scims-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Hanh Tran
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
scims-1.0.0/MANIFEST.in
ADDED
scims-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: SCiMS
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: SCiMS: Sex Calling in Metagenomic Sequencing
|
|
5
|
+
Home-page: https://github.com/hanhntran/SCiMS
|
|
6
|
+
Author: Hanh Tran
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: Operating System :: OS Independent
|
|
9
|
+
Classifier: Development Status :: 4 - Beta
|
|
10
|
+
Requires-Python: >=3.9
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Requires-Dist: numpy
|
|
14
|
+
Requires-Dist: pandas
|
|
15
|
+
Requires-Dist: scipy
|
|
16
|
+
Requires-Dist: setuptools
|
|
17
|
+
Dynamic: author
|
|
18
|
+
Dynamic: classifier
|
|
19
|
+
Dynamic: description
|
|
20
|
+
Dynamic: description-content-type
|
|
21
|
+
Dynamic: home-page
|
|
22
|
+
Dynamic: license-file
|
|
23
|
+
Dynamic: requires-dist
|
|
24
|
+
Dynamic: requires-python
|
|
25
|
+
Dynamic: summary
|
|
26
|
+
|
|
27
|
+
<!-- PROJECT LOGO -->
|
|
28
|
+
<br />
|
|
29
|
+
<div align="center">
|
|
30
|
+
<a href="https://github.com/othneildrew/Best-README-Template">
|
|
31
|
+
<img src="static/scims_logo.png" alt="Logo" width="450" height="200">
|
|
32
|
+
</a>
|
|
33
|
+
|
|
34
|
+
<h1 align="center">Sex Calling in Metagenomic Sequences</h1>
|
|
35
|
+
|
|
36
|
+
<p align="center">
|
|
37
|
+
An tool for identifying the sex of a host organism based on the alignment of metagenomic sequences.
|
|
38
|
+
<br />
|
|
39
|
+
<br />
|
|
40
|
+
<a href="https://github.com/hanhntran/SCiMS-v1.1/issues/new?labels=bug&template=bug-report---.md">Report Bug</a>
|
|
41
|
+
·
|
|
42
|
+
<a href="https://github.com/hanhntran/SCiMS-v1.1/issues/new?labels=enhancement&template=feature-request---.md">Request Feature</a>
|
|
43
|
+
</p>
|
|
44
|
+
</div>
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
<!-- ABOUT THE PROJECT -->
|
|
49
|
+
## About The Project
|
|
50
|
+
|
|
51
|
+
Metagenomic sequencing data often contains a mix of host and non-host sequences. SCiMS salvages the reads mapping statistics that align to the host genome and uses them to identify the sex of the host organism. SCiMS leverages robust statistical methods to accurately determine the sex of the host, providing host sex information for downstream analyses.
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
## Requirements
|
|
57
|
+
|
|
58
|
+
- Python 3.9+
|
|
59
|
+
- numpy, pandas, scipy, setuptools
|
|
60
|
+
- (Optional) samtools for generating `.idxstats` files
|
|
61
|
+
|
|
62
|
+
## Installation instructions
|
|
63
|
+
|
|
64
|
+
The simpliest installation works through the [conda](https://docs.conda.io/en/latest/miniconda.html) installer that can maintain different versions of Python on the same machine.
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
# Create a new conda environment with Python 3.9
|
|
68
|
+
conda create -n scims python=3.9
|
|
69
|
+
|
|
70
|
+
# Activate the environment
|
|
71
|
+
conda activate scims
|
|
72
|
+
|
|
73
|
+
# Install SCiMS
|
|
74
|
+
pip install git+https://github.com/hanhntran/SCiMS-v1.1
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
To confirm that the instillation was successful, run:
|
|
78
|
+
```
|
|
79
|
+
scims -h
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Usage
|
|
83
|
+
`SCiMS` can be used on any alignment data, regardless of the platform used for sequencing or the aligner that generated the alignment file.
|
|
84
|
+
|
|
85
|
+
```
|
|
86
|
+
scims --idxstats_file <sample.idxstats> \
|
|
87
|
+
--scaffolds <scaffolds.txt> \
|
|
88
|
+
--metadata <metadata_file.txt> \
|
|
89
|
+
--system <XY or ZW> \
|
|
90
|
+
--homogametic_id <chrom_id> \
|
|
91
|
+
--heterogametic_id <chrom_id> \
|
|
92
|
+
--id_column <sample-id> \
|
|
93
|
+
--output <output_file.txt>
|
|
94
|
+
```
|
|
95
|
+
| Option | Description |
|
|
96
|
+
|--------------------|----------------------------------------------------------------------------------|
|
|
97
|
+
| -h, --help | Show this help message and exit |
|
|
98
|
+
| --idxstats_file | Path to the .idxstats file for the sample |
|
|
99
|
+
| --scaffolds | Path to the scaffolds.txt file containing the scaffolds of interest |
|
|
100
|
+
| --heterogametic_id | The ID of the heterogametic sex chromosome |
|
|
101
|
+
| --homogametic_id | The ID of the homogametic sex chromosome |
|
|
102
|
+
| --system | The sex determination system (XY or ZW) |
|
|
103
|
+
| --output | Path to the output file |
|
|
104
|
+
| --threshold [OPTIONAL] | The threshold for the sex calling algorithm (default: 0.95) |
|
|
105
|
+
| --training_data [OPTIONAL] | If you have a training dataset, you can specify the path to the training data here |
|
|
106
|
+
| --multiple [OPTIONAL] | If you want to run SCiMS on multiple samples, you can specify this option [True or False, default: False] |
|
|
107
|
+
| --metadata_file [OPTIONAL] | If you have a metadata file and would like to add SCiMS predicted sex to the metadata file, you can specify the path to the metadata file here |
|
|
108
|
+
| --id_column [OPTIONAL] | The column name of the sample ID in the metadata file |
|
|
109
|
+
| --log [OPTIONAL] | Path to log file |
|
|
110
|
+
## Required input files
|
|
111
|
+
|
|
112
|
+
### `scaffolds.txt`
|
|
113
|
+
Since most assemblies include scaffolds representing other DNA than simply genomic (ex. mitochondrial), it is necessary to define what scaffolds we are interested in using for our analysis. This can be specified with a ```scaffolds.txt``` file. This is a single-column text file where each row is a scaffold ID. Here is an example,
|
|
114
|
+
```
|
|
115
|
+
NC_000001.11
|
|
116
|
+
NC_000002.12
|
|
117
|
+
NC_000003.12
|
|
118
|
+
NC_000004.12
|
|
119
|
+
NC_000005.10
|
|
120
|
+
NC_000006.12
|
|
121
|
+
NC_000007.14
|
|
122
|
+
NC_000008.11
|
|
123
|
+
...
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### `.idxstats files`
|
|
127
|
+
A .idxstats file can easily be created with samtools. If you have a .bam file of interest, fun the following commands to generate the .idxstats file:
|
|
128
|
+
|
|
129
|
+
```shell
|
|
130
|
+
samtools index <bam_file>
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
```shell
|
|
134
|
+
samtools idxstats <bam_file> > <prefix>.idxstats
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### `metadata_file.txt`
|
|
138
|
+
A metadata file is required to run SCiMS. This file should contain at least one columns, `sample-id`. The `sample-id` column should contain the sample IDs that are present in the .idxstats file.
|
|
139
|
+
|
|
140
|
+
Example:
|
|
141
|
+
```
|
|
142
|
+
sample-id feature
|
|
143
|
+
sample1 A
|
|
144
|
+
sample2 B
|
|
145
|
+
sample3 C
|
|
146
|
+
sample4 D
|
|
147
|
+
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## Example run
|
|
151
|
+
Example files can be found in the ```test_data``` folder.
|
|
152
|
+
|
|
153
|
+
### Running SCiMS on a single sample
|
|
154
|
+
Change path to the ```test_data``` folder and run the following command:
|
|
155
|
+
```
|
|
156
|
+
scims --idxstats_file ./idxstats_files/S79F300.idxstats \
|
|
157
|
+
--scaffolds GRCh38_scaffolds.txt \
|
|
158
|
+
--system XY \
|
|
159
|
+
--homogametic_id NC_000023.11 \
|
|
160
|
+
--heterogametic_id NC_000024.10 \
|
|
161
|
+
--output test_output.txt
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Output log:
|
|
165
|
+
```
|
|
166
|
+
2025-03-06 00:22:34,576 - INFO - Log file created at: out/scims.log
|
|
167
|
+
2025-03-06 00:22:34,576 - INFO -
|
|
168
|
+
=================================================
|
|
169
|
+
2025-03-06 00:22:34,576 - INFO -
|
|
170
|
+
_|_|_| _|_|_| _|_|_| _| _| _|_|_|
|
|
171
|
+
_| _| _| _|_| _|_| _|
|
|
172
|
+
_|_|_| _| _| _| _| _| _|_|_|
|
|
173
|
+
_| _| _| _| _| _|
|
|
174
|
+
_|_|_| _|_|_| _|_|_| _| _| _|_|_|
|
|
175
|
+
=================================================
|
|
176
|
+
2025-03-06 00:22:34,576 - INFO - SCiMS: Sex Calling in Metagenomic Sequencing
|
|
177
|
+
2025-03-06 00:22:34,576 - INFO - Version: 1.1.0
|
|
178
|
+
2025-03-06 00:22:34,576 - INFO - =================================================
|
|
179
|
+
2025-03-06 00:22:34,591 - INFO - Results written to out/S79F300_results.txt
|
|
180
|
+
```
|
|
181
|
+
Output file:
|
|
182
|
+
```
|
|
183
|
+
$ cat out/S79F300_results.txt
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### Running SCiMS on multiple samples
|
|
187
|
+
|
|
188
|
+
```
|
|
189
|
+
scims --idxstats_folder idxstats_files/ \
|
|
190
|
+
--scaffolds GRCh38_scaffolds.txt \
|
|
191
|
+
--homogametic_id NC_000023.11 \
|
|
192
|
+
--heterogametic_id NC_000024.10 \
|
|
193
|
+
--output_dir out \
|
|
194
|
+
--metadata metadata_file.txt \
|
|
195
|
+
--id_column sample-id \
|
|
196
|
+
--log log.txt
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
Output log:
|
|
200
|
+
```
|
|
201
|
+
2025-03-06 00:29:09,830 - INFO - Log file created at: out/scims.log
|
|
202
|
+
2025-03-06 00:29:09,830 - INFO -
|
|
203
|
+
=================================================
|
|
204
|
+
2025-03-06 00:29:09,830 - INFO -
|
|
205
|
+
_|_|_| _|_|_| _|_|_| _| _| _|_|_|
|
|
206
|
+
_| _| _| _|_| _|_| _|
|
|
207
|
+
_|_|_| _| _| _| _| _| _|_|_|
|
|
208
|
+
_| _| _| _| _| _|
|
|
209
|
+
_|_|_| _|_|_| _|_|_| _| _| _|_|_|
|
|
210
|
+
=================================================
|
|
211
|
+
2025-03-06 00:29:09,830 - INFO - SCiMS: Sex Calling in Metagenomic Sequencing
|
|
212
|
+
2025-03-06 00:29:09,830 - INFO - Version: 1.1.0
|
|
213
|
+
2025-03-06 00:29:09,830 - INFO - =================================================
|
|
214
|
+
2025-03-06 00:29:09,845 - INFO - Results written to out/S28M1000000_results.txt
|
|
215
|
+
2025-03-06 00:29:09,846 - INFO - Updated metadata with classification results written to out/metadata_with_classification.txt
|
|
216
|
+
2025-03-06 00:29:09,848 - INFO - Results written to out/S56F150_results.txt
|
|
217
|
+
2025-03-06 00:29:09,849 - INFO - Updated metadata with classification results written to out/metadata_with_classification.txt
|
|
218
|
+
2025-03-06 00:29:09,851 - INFO - Results written to out/S79F300_results.txt
|
|
219
|
+
2025-03-06 00:29:09,852 - INFO - Updated metadata with classification results written to out/metadata_with_classification.txt
|
|
220
|
+
2025-03-06 00:29:09,854 - INFO - Results written to out/S90M250_results.txt
|
|
221
|
+
2025-03-06 00:29:09,855 - INFO - Updated metadata with classification results written to out/metadata_with_classification.txt
|
|
222
|
+
```
|
scims-1.0.0/README.md
ADDED
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
<!-- PROJECT LOGO -->
|
|
2
|
+
<br />
|
|
3
|
+
<div align="center">
|
|
4
|
+
<a href="https://github.com/othneildrew/Best-README-Template">
|
|
5
|
+
<img src="static/scims_logo.png" alt="Logo" width="450" height="200">
|
|
6
|
+
</a>
|
|
7
|
+
|
|
8
|
+
<h1 align="center">Sex Calling in Metagenomic Sequences</h1>
|
|
9
|
+
|
|
10
|
+
<p align="center">
|
|
11
|
+
An tool for identifying the sex of a host organism based on the alignment of metagenomic sequences.
|
|
12
|
+
<br />
|
|
13
|
+
<br />
|
|
14
|
+
<a href="https://github.com/hanhntran/SCiMS-v1.1/issues/new?labels=bug&template=bug-report---.md">Report Bug</a>
|
|
15
|
+
·
|
|
16
|
+
<a href="https://github.com/hanhntran/SCiMS-v1.1/issues/new?labels=enhancement&template=feature-request---.md">Request Feature</a>
|
|
17
|
+
</p>
|
|
18
|
+
</div>
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
<!-- ABOUT THE PROJECT -->
|
|
23
|
+
## About The Project
|
|
24
|
+
|
|
25
|
+
Metagenomic sequencing data often contains a mix of host and non-host sequences. SCiMS salvages the reads mapping statistics that align to the host genome and uses them to identify the sex of the host organism. SCiMS leverages robust statistical methods to accurately determine the sex of the host, providing host sex information for downstream analyses.
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
## Requirements
|
|
31
|
+
|
|
32
|
+
- Python 3.9+
|
|
33
|
+
- numpy, pandas, scipy, setuptools
|
|
34
|
+
- (Optional) samtools for generating `.idxstats` files
|
|
35
|
+
|
|
36
|
+
## Installation instructions
|
|
37
|
+
|
|
38
|
+
The simpliest installation works through the [conda](https://docs.conda.io/en/latest/miniconda.html) installer that can maintain different versions of Python on the same machine.
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
# Create a new conda environment with Python 3.9
|
|
42
|
+
conda create -n scims python=3.9
|
|
43
|
+
|
|
44
|
+
# Activate the environment
|
|
45
|
+
conda activate scims
|
|
46
|
+
|
|
47
|
+
# Install SCiMS
|
|
48
|
+
pip install git+https://github.com/hanhntran/SCiMS-v1.1
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
To confirm that the instillation was successful, run:
|
|
52
|
+
```
|
|
53
|
+
scims -h
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Usage
|
|
57
|
+
`SCiMS` can be used on any alignment data, regardless of the platform used for sequencing or the aligner that generated the alignment file.
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
scims --idxstats_file <sample.idxstats> \
|
|
61
|
+
--scaffolds <scaffolds.txt> \
|
|
62
|
+
--metadata <metadata_file.txt> \
|
|
63
|
+
--system <XY or ZW> \
|
|
64
|
+
--homogametic_id <chrom_id> \
|
|
65
|
+
--heterogametic_id <chrom_id> \
|
|
66
|
+
--id_column <sample-id> \
|
|
67
|
+
--output <output_file.txt>
|
|
68
|
+
```
|
|
69
|
+
| Option | Description |
|
|
70
|
+
|--------------------|----------------------------------------------------------------------------------|
|
|
71
|
+
| -h, --help | Show this help message and exit |
|
|
72
|
+
| --idxstats_file | Path to the .idxstats file for the sample |
|
|
73
|
+
| --scaffolds | Path to the scaffolds.txt file containing the scaffolds of interest |
|
|
74
|
+
| --heterogametic_id | The ID of the heterogametic sex chromosome |
|
|
75
|
+
| --homogametic_id | The ID of the homogametic sex chromosome |
|
|
76
|
+
| --system | The sex determination system (XY or ZW) |
|
|
77
|
+
| --output | Path to the output file |
|
|
78
|
+
| --threshold [OPTIONAL] | The threshold for the sex calling algorithm (default: 0.95) |
|
|
79
|
+
| --training_data [OPTIONAL] | If you have a training dataset, you can specify the path to the training data here |
|
|
80
|
+
| --multiple [OPTIONAL] | If you want to run SCiMS on multiple samples, you can specify this option [True or False, default: False] |
|
|
81
|
+
| --metadata_file [OPTIONAL] | If you have a metadata file and would like to add SCiMS predicted sex to the metadata file, you can specify the path to the metadata file here |
|
|
82
|
+
| --id_column [OPTIONAL] | The column name of the sample ID in the metadata file |
|
|
83
|
+
| --log [OPTIONAL] | Path to log file |
|
|
84
|
+
## Required input files
|
|
85
|
+
|
|
86
|
+
### `scaffolds.txt`
|
|
87
|
+
Since most assemblies include scaffolds representing other DNA than simply genomic (ex. mitochondrial), it is necessary to define what scaffolds we are interested in using for our analysis. This can be specified with a ```scaffolds.txt``` file. This is a single-column text file where each row is a scaffold ID. Here is an example,
|
|
88
|
+
```
|
|
89
|
+
NC_000001.11
|
|
90
|
+
NC_000002.12
|
|
91
|
+
NC_000003.12
|
|
92
|
+
NC_000004.12
|
|
93
|
+
NC_000005.10
|
|
94
|
+
NC_000006.12
|
|
95
|
+
NC_000007.14
|
|
96
|
+
NC_000008.11
|
|
97
|
+
...
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### `.idxstats files`
|
|
101
|
+
A .idxstats file can easily be created with samtools. If you have a .bam file of interest, fun the following commands to generate the .idxstats file:
|
|
102
|
+
|
|
103
|
+
```shell
|
|
104
|
+
samtools index <bam_file>
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
```shell
|
|
108
|
+
samtools idxstats <bam_file> > <prefix>.idxstats
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### `metadata_file.txt`
|
|
112
|
+
A metadata file is required to run SCiMS. This file should contain at least one columns, `sample-id`. The `sample-id` column should contain the sample IDs that are present in the .idxstats file.
|
|
113
|
+
|
|
114
|
+
Example:
|
|
115
|
+
```
|
|
116
|
+
sample-id feature
|
|
117
|
+
sample1 A
|
|
118
|
+
sample2 B
|
|
119
|
+
sample3 C
|
|
120
|
+
sample4 D
|
|
121
|
+
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Example run
|
|
125
|
+
Example files can be found in the ```test_data``` folder.
|
|
126
|
+
|
|
127
|
+
### Running SCiMS on a single sample
|
|
128
|
+
Change path to the ```test_data``` folder and run the following command:
|
|
129
|
+
```
|
|
130
|
+
scims --idxstats_file ./idxstats_files/S79F300.idxstats \
|
|
131
|
+
--scaffolds GRCh38_scaffolds.txt \
|
|
132
|
+
--system XY \
|
|
133
|
+
--homogametic_id NC_000023.11 \
|
|
134
|
+
--heterogametic_id NC_000024.10 \
|
|
135
|
+
--output test_output.txt
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Output log:
|
|
139
|
+
```
|
|
140
|
+
2025-03-06 00:22:34,576 - INFO - Log file created at: out/scims.log
|
|
141
|
+
2025-03-06 00:22:34,576 - INFO -
|
|
142
|
+
=================================================
|
|
143
|
+
2025-03-06 00:22:34,576 - INFO -
|
|
144
|
+
_|_|_| _|_|_| _|_|_| _| _| _|_|_|
|
|
145
|
+
_| _| _| _|_| _|_| _|
|
|
146
|
+
_|_|_| _| _| _| _| _| _|_|_|
|
|
147
|
+
_| _| _| _| _| _|
|
|
148
|
+
_|_|_| _|_|_| _|_|_| _| _| _|_|_|
|
|
149
|
+
=================================================
|
|
150
|
+
2025-03-06 00:22:34,576 - INFO - SCiMS: Sex Calling in Metagenomic Sequencing
|
|
151
|
+
2025-03-06 00:22:34,576 - INFO - Version: 1.1.0
|
|
152
|
+
2025-03-06 00:22:34,576 - INFO - =================================================
|
|
153
|
+
2025-03-06 00:22:34,591 - INFO - Results written to out/S79F300_results.txt
|
|
154
|
+
```
|
|
155
|
+
Output file:
|
|
156
|
+
```
|
|
157
|
+
$ cat out/S79F300_results.txt
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### Running SCiMS on multiple samples
|
|
161
|
+
|
|
162
|
+
```
|
|
163
|
+
scims --idxstats_folder idxstats_files/ \
|
|
164
|
+
--scaffolds GRCh38_scaffolds.txt \
|
|
165
|
+
--homogametic_id NC_000023.11 \
|
|
166
|
+
--heterogametic_id NC_000024.10 \
|
|
167
|
+
--output_dir out \
|
|
168
|
+
--metadata metadata_file.txt \
|
|
169
|
+
--id_column sample-id \
|
|
170
|
+
--log log.txt
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
Output log:
|
|
174
|
+
```
|
|
175
|
+
2025-03-06 00:29:09,830 - INFO - Log file created at: out/scims.log
|
|
176
|
+
2025-03-06 00:29:09,830 - INFO -
|
|
177
|
+
=================================================
|
|
178
|
+
2025-03-06 00:29:09,830 - INFO -
|
|
179
|
+
_|_|_| _|_|_| _|_|_| _| _| _|_|_|
|
|
180
|
+
_| _| _| _|_| _|_| _|
|
|
181
|
+
_|_|_| _| _| _| _| _| _|_|_|
|
|
182
|
+
_| _| _| _| _| _|
|
|
183
|
+
_|_|_| _|_|_| _|_|_| _| _| _|_|_|
|
|
184
|
+
=================================================
|
|
185
|
+
2025-03-06 00:29:09,830 - INFO - SCiMS: Sex Calling in Metagenomic Sequencing
|
|
186
|
+
2025-03-06 00:29:09,830 - INFO - Version: 1.1.0
|
|
187
|
+
2025-03-06 00:29:09,830 - INFO - =================================================
|
|
188
|
+
2025-03-06 00:29:09,845 - INFO - Results written to out/S28M1000000_results.txt
|
|
189
|
+
2025-03-06 00:29:09,846 - INFO - Updated metadata with classification results written to out/metadata_with_classification.txt
|
|
190
|
+
2025-03-06 00:29:09,848 - INFO - Results written to out/S56F150_results.txt
|
|
191
|
+
2025-03-06 00:29:09,849 - INFO - Updated metadata with classification results written to out/metadata_with_classification.txt
|
|
192
|
+
2025-03-06 00:29:09,851 - INFO - Results written to out/S79F300_results.txt
|
|
193
|
+
2025-03-06 00:29:09,852 - INFO - Updated metadata with classification results written to out/metadata_with_classification.txt
|
|
194
|
+
2025-03-06 00:29:09,854 - INFO - Results written to out/S90M250_results.txt
|
|
195
|
+
2025-03-06 00:29:09,855 - INFO - Updated metadata with classification results written to out/metadata_with_classification.txt
|
|
196
|
+
```
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: SCiMS
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: SCiMS: Sex Calling in Metagenomic Sequencing
|
|
5
|
+
Home-page: https://github.com/hanhntran/SCiMS
|
|
6
|
+
Author: Hanh Tran
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: Operating System :: OS Independent
|
|
9
|
+
Classifier: Development Status :: 4 - Beta
|
|
10
|
+
Requires-Python: >=3.9
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Requires-Dist: numpy
|
|
14
|
+
Requires-Dist: pandas
|
|
15
|
+
Requires-Dist: scipy
|
|
16
|
+
Requires-Dist: setuptools
|
|
17
|
+
Dynamic: author
|
|
18
|
+
Dynamic: classifier
|
|
19
|
+
Dynamic: description
|
|
20
|
+
Dynamic: description-content-type
|
|
21
|
+
Dynamic: home-page
|
|
22
|
+
Dynamic: license-file
|
|
23
|
+
Dynamic: requires-dist
|
|
24
|
+
Dynamic: requires-python
|
|
25
|
+
Dynamic: summary
|
|
26
|
+
|
|
27
|
+
<!-- PROJECT LOGO -->
|
|
28
|
+
<br />
|
|
29
|
+
<div align="center">
|
|
30
|
+
<a href="https://github.com/othneildrew/Best-README-Template">
|
|
31
|
+
<img src="static/scims_logo.png" alt="Logo" width="450" height="200">
|
|
32
|
+
</a>
|
|
33
|
+
|
|
34
|
+
<h1 align="center">Sex Calling in Metagenomic Sequences</h1>
|
|
35
|
+
|
|
36
|
+
<p align="center">
|
|
37
|
+
An tool for identifying the sex of a host organism based on the alignment of metagenomic sequences.
|
|
38
|
+
<br />
|
|
39
|
+
<br />
|
|
40
|
+
<a href="https://github.com/hanhntran/SCiMS-v1.1/issues/new?labels=bug&template=bug-report---.md">Report Bug</a>
|
|
41
|
+
·
|
|
42
|
+
<a href="https://github.com/hanhntran/SCiMS-v1.1/issues/new?labels=enhancement&template=feature-request---.md">Request Feature</a>
|
|
43
|
+
</p>
|
|
44
|
+
</div>
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
<!-- ABOUT THE PROJECT -->
|
|
49
|
+
## About The Project
|
|
50
|
+
|
|
51
|
+
Metagenomic sequencing data often contains a mix of host and non-host sequences. SCiMS salvages the reads mapping statistics that align to the host genome and uses them to identify the sex of the host organism. SCiMS leverages robust statistical methods to accurately determine the sex of the host, providing host sex information for downstream analyses.
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
## Requirements
|
|
57
|
+
|
|
58
|
+
- Python 3.9+
|
|
59
|
+
- numpy, pandas, scipy, setuptools
|
|
60
|
+
- (Optional) samtools for generating `.idxstats` files
|
|
61
|
+
|
|
62
|
+
## Installation instructions
|
|
63
|
+
|
|
64
|
+
The simpliest installation works through the [conda](https://docs.conda.io/en/latest/miniconda.html) installer that can maintain different versions of Python on the same machine.
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
# Create a new conda environment with Python 3.9
|
|
68
|
+
conda create -n scims python=3.9
|
|
69
|
+
|
|
70
|
+
# Activate the environment
|
|
71
|
+
conda activate scims
|
|
72
|
+
|
|
73
|
+
# Install SCiMS
|
|
74
|
+
pip install git+https://github.com/hanhntran/SCiMS-v1.1
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
To confirm that the instillation was successful, run:
|
|
78
|
+
```
|
|
79
|
+
scims -h
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Usage
|
|
83
|
+
`SCiMS` can be used on any alignment data, regardless of the platform used for sequencing or the aligner that generated the alignment file.
|
|
84
|
+
|
|
85
|
+
```
|
|
86
|
+
scims --idxstats_file <sample.idxstats> \
|
|
87
|
+
--scaffolds <scaffolds.txt> \
|
|
88
|
+
--metadata <metadata_file.txt> \
|
|
89
|
+
--system <XY or ZW> \
|
|
90
|
+
--homogametic_id <chrom_id> \
|
|
91
|
+
--heterogametic_id <chrom_id> \
|
|
92
|
+
--id_column <sample-id> \
|
|
93
|
+
--output <output_file.txt>
|
|
94
|
+
```
|
|
95
|
+
| Option | Description |
|
|
96
|
+
|--------------------|----------------------------------------------------------------------------------|
|
|
97
|
+
| -h, --help | Show this help message and exit |
|
|
98
|
+
| --idxstats_file | Path to the .idxstats file for the sample |
|
|
99
|
+
| --scaffolds | Path to the scaffolds.txt file containing the scaffolds of interest |
|
|
100
|
+
| --heterogametic_id | The ID of the heterogametic sex chromosome |
|
|
101
|
+
| --homogametic_id | The ID of the homogametic sex chromosome |
|
|
102
|
+
| --system | The sex determination system (XY or ZW) |
|
|
103
|
+
| --output | Path to the output file |
|
|
104
|
+
| --threshold [OPTIONAL] | The threshold for the sex calling algorithm (default: 0.95) |
|
|
105
|
+
| --training_data [OPTIONAL] | If you have a training dataset, you can specify the path to the training data here |
|
|
106
|
+
| --multiple [OPTIONAL] | If you want to run SCiMS on multiple samples, you can specify this option [True or False, default: False] |
|
|
107
|
+
| --metadata_file [OPTIONAL] | If you have a metadata file and would like to add SCiMS predicted sex to the metadata file, you can specify the path to the metadata file here |
|
|
108
|
+
| --id_column [OPTIONAL] | The column name of the sample ID in the metadata file |
|
|
109
|
+
| --log [OPTIONAL] | Path to log file |
|
|
110
|
+
## Required input files
|
|
111
|
+
|
|
112
|
+
### `scaffolds.txt`
|
|
113
|
+
Since most assemblies include scaffolds representing other DNA than simply genomic (ex. mitochondrial), it is necessary to define what scaffolds we are interested in using for our analysis. This can be specified with a ```scaffolds.txt``` file. This is a single-column text file where each row is a scaffold ID. Here is an example,
|
|
114
|
+
```
|
|
115
|
+
NC_000001.11
|
|
116
|
+
NC_000002.12
|
|
117
|
+
NC_000003.12
|
|
118
|
+
NC_000004.12
|
|
119
|
+
NC_000005.10
|
|
120
|
+
NC_000006.12
|
|
121
|
+
NC_000007.14
|
|
122
|
+
NC_000008.11
|
|
123
|
+
...
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### `.idxstats files`
|
|
127
|
+
A .idxstats file can easily be created with samtools. If you have a .bam file of interest, fun the following commands to generate the .idxstats file:
|
|
128
|
+
|
|
129
|
+
```shell
|
|
130
|
+
samtools index <bam_file>
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
```shell
|
|
134
|
+
samtools idxstats <bam_file> > <prefix>.idxstats
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### `metadata_file.txt`
|
|
138
|
+
A metadata file is required to run SCiMS. This file should contain at least one columns, `sample-id`. The `sample-id` column should contain the sample IDs that are present in the .idxstats file.
|
|
139
|
+
|
|
140
|
+
Example:
|
|
141
|
+
```
|
|
142
|
+
sample-id feature
|
|
143
|
+
sample1 A
|
|
144
|
+
sample2 B
|
|
145
|
+
sample3 C
|
|
146
|
+
sample4 D
|
|
147
|
+
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## Example run
|
|
151
|
+
Example files can be found in the ```test_data``` folder.
|
|
152
|
+
|
|
153
|
+
### Running SCiMS on a single sample
|
|
154
|
+
Change path to the ```test_data``` folder and run the following command:
|
|
155
|
+
```
|
|
156
|
+
scims --idxstats_file ./idxstats_files/S79F300.idxstats \
|
|
157
|
+
--scaffolds GRCh38_scaffolds.txt \
|
|
158
|
+
--system XY \
|
|
159
|
+
--homogametic_id NC_000023.11 \
|
|
160
|
+
--heterogametic_id NC_000024.10 \
|
|
161
|
+
--output test_output.txt
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Output log:
|
|
165
|
+
```
|
|
166
|
+
2025-03-06 00:22:34,576 - INFO - Log file created at: out/scims.log
|
|
167
|
+
2025-03-06 00:22:34,576 - INFO -
|
|
168
|
+
=================================================
|
|
169
|
+
2025-03-06 00:22:34,576 - INFO -
|
|
170
|
+
_|_|_| _|_|_| _|_|_| _| _| _|_|_|
|
|
171
|
+
_| _| _| _|_| _|_| _|
|
|
172
|
+
_|_|_| _| _| _| _| _| _|_|_|
|
|
173
|
+
_| _| _| _| _| _|
|
|
174
|
+
_|_|_| _|_|_| _|_|_| _| _| _|_|_|
|
|
175
|
+
=================================================
|
|
176
|
+
2025-03-06 00:22:34,576 - INFO - SCiMS: Sex Calling in Metagenomic Sequencing
|
|
177
|
+
2025-03-06 00:22:34,576 - INFO - Version: 1.1.0
|
|
178
|
+
2025-03-06 00:22:34,576 - INFO - =================================================
|
|
179
|
+
2025-03-06 00:22:34,591 - INFO - Results written to out/S79F300_results.txt
|
|
180
|
+
```
|
|
181
|
+
Output file:
|
|
182
|
+
```
|
|
183
|
+
$ cat out/S79F300_results.txt
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### Running SCiMS on multiple samples
|
|
187
|
+
|
|
188
|
+
```
|
|
189
|
+
scims --idxstats_folder idxstats_files/ \
|
|
190
|
+
--scaffolds GRCh38_scaffolds.txt \
|
|
191
|
+
--homogametic_id NC_000023.11 \
|
|
192
|
+
--heterogametic_id NC_000024.10 \
|
|
193
|
+
--output_dir out \
|
|
194
|
+
--metadata metadata_file.txt \
|
|
195
|
+
--id_column sample-id \
|
|
196
|
+
--log log.txt
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
Output log:
|
|
200
|
+
```
|
|
201
|
+
2025-03-06 00:29:09,830 - INFO - Log file created at: out/scims.log
|
|
202
|
+
2025-03-06 00:29:09,830 - INFO -
|
|
203
|
+
=================================================
|
|
204
|
+
2025-03-06 00:29:09,830 - INFO -
|
|
205
|
+
_|_|_| _|_|_| _|_|_| _| _| _|_|_|
|
|
206
|
+
_| _| _| _|_| _|_| _|
|
|
207
|
+
_|_|_| _| _| _| _| _| _|_|_|
|
|
208
|
+
_| _| _| _| _| _|
|
|
209
|
+
_|_|_| _|_|_| _|_|_| _| _| _|_|_|
|
|
210
|
+
=================================================
|
|
211
|
+
2025-03-06 00:29:09,830 - INFO - SCiMS: Sex Calling in Metagenomic Sequencing
|
|
212
|
+
2025-03-06 00:29:09,830 - INFO - Version: 1.1.0
|
|
213
|
+
2025-03-06 00:29:09,830 - INFO - =================================================
|
|
214
|
+
2025-03-06 00:29:09,845 - INFO - Results written to out/S28M1000000_results.txt
|
|
215
|
+
2025-03-06 00:29:09,846 - INFO - Updated metadata with classification results written to out/metadata_with_classification.txt
|
|
216
|
+
2025-03-06 00:29:09,848 - INFO - Results written to out/S56F150_results.txt
|
|
217
|
+
2025-03-06 00:29:09,849 - INFO - Updated metadata with classification results written to out/metadata_with_classification.txt
|
|
218
|
+
2025-03-06 00:29:09,851 - INFO - Results written to out/S79F300_results.txt
|
|
219
|
+
2025-03-06 00:29:09,852 - INFO - Updated metadata with classification results written to out/metadata_with_classification.txt
|
|
220
|
+
2025-03-06 00:29:09,854 - INFO - Results written to out/S90M250_results.txt
|
|
221
|
+
2025-03-06 00:29:09,855 - INFO - Updated metadata with classification results written to out/metadata_with_classification.txt
|
|
222
|
+
```
|