sjteresi / TE_Density

Python script calculating transposable element density for all genes in a genome. Publication: https://mobilednajournal.biomedcentral.com/articles/10.1186/s13100-022-00264-4
GNU General Public License v3.0
28 stars 4 forks source link

initial merge data / density data refactor #137

Closed teresi closed 11 months ago

teresi commented 11 months ago

DISCUSSION

as we've discussed this is a refactor of merge data

I've cut it off here b/c the _DensitySubset has the read/write on an existing file implemented and tested

notably this does not affect the current data pipeline

rather, it adds a new implementation to demonstrate the items above

(there is a small amount of housekeeping as well, in the files other than the density2 and the related test)


TESTING

do the tests pass?

(genes_311) [22:24 GOKU][f/refactor_merge]->(1b1e):/data/genes/TE_Density
[ins]▸$ pytest
======================================== test session starts =========================================
platform linux -- Python 3.11.3, pytest-7.2.0, pluggy-1.0.0
rootdir: /data/genes/TE_Density
collected 213 items

tests/unit/test_DensityData.py .                                                               [  0%]
tests/unit/test_GeneDatum.py ....                                                              [  2%]
tests/unit/test_MergeData.py ..................ss                                              [ 11%]
tests/unit/test_Overlap.py ................................................................... [ 43%]
.....                                                                                          [ 45%]
tests/unit/test_OverlapData.py ..............                                                  [ 52%]
tests/unit/test_ReviseAnno.py .........                                                        [ 56%]
tests/unit/test_WorkerProcess.py ...                                                           [ 57%]
tests/unit/test_data.py ....                                                                   [ 59%]
tests/unit/test_density.py .........................................................           [ 86%]
tests/unit/test_density2.py ................                                                   [ 93%]
tests/unit/test_gene_data.py ....                                                              [ 95%]
tests/unit/test_import_genes.py ...                                                            [ 97%]
tests/unit/test_preprocess.py ..                                                               [ 98%]
tests/unit/test_transposon_data.py ....                                                        [100%]

=================================== 211 passed, 2 skipped in 3.60s ===================================

do the linters / style etc pass?

(genes_311) [22:24 GOKU][f/refactor_merge]->(1b1e):/data/genes/TE_Density
[ins]▸$ pylint transposon/density2.py

--------------------------------------------------------------------
Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)

(genes_311) [22:26 GOKU][f/refactor_merge]->(1b1e):/data/genes/TE_Density
[ins]▸$ flake8 transposon/density2.py
(genes_311) [22:26 GOKU][f/refactor_merge]->(1b1e):/data/genes/TE_Density
[ins]▸$ black transposon/density2.py
All done! ✨ 🍰 ✨
1 file left unchanged.

are there mistakes in the density data shape or etc.?

vim transposon/density2.py  # see in particular `_init_densities`