Skip to content

Commit

Permalink
stabilize python versions
Browse files Browse the repository at this point in the history
  • Loading branch information
Rafael Barrero Rodríguez committed Oct 31, 2023
1 parent 3b528b9 commit 820ebd5
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 9 deletions.
11 changes: 8 additions & 3 deletions 2_ReportLimma_wo_GUI/limma_params.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@

# Path to report file
report_infile: D:\ReportAnalysis\2_ReportLimma_wo_GUI\test\test1\NM_qfq_table_pgmfreq.tsv

# Path to .tsv table with sample groups
sample_table: D:\ReportAnalysis\2_ReportLimma_wo_GUI\limma_sample_table.tsv

# Path to output file
outfile: D:\ReportAnalysis\2_ReportLimma_wo_GUI\test\test1\LIMMA_NM_qfq_table_pgmfreq.tsv

# Possible types
# Statistical tests applied. Possible types:
# - limma
# - limma_with_duplicates
# - t-test
Expand All @@ -14,13 +17,15 @@ test_type:
- limma_with_duplicates
- t-test

# Integrations used to apply Limma
integrations:
- Z_pgm2p
- Z_pgm2p_dNM
- Z_p2qf
- Z_qf2qfq
- Z_qfq2qfqall

# Groups to be compared (use the group names of sample table)
# If the value is [Group1, Group2],the mean difference will be calculated as Group1 - Group2
hypothesis_testing:
- [ H, C ]
- [ Control, Heteroplasmy ]
- [ Heteroplasmy, Control ]
9 changes: 5 additions & 4 deletions 4_qTableReport/qReportMaker.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ def generateFreqTable(config, sign_i, fdr_i, rep, contrast):
if rep_i.shape[0] == 0:
return []


bi, biPivot = BSLM({
'infile': rep_i,
'outfile': None,
Expand Down Expand Up @@ -135,7 +136,7 @@ def qReportPivot(config, fdr_i, sign_i, rep, ptmCol, contrast):

qTableD = {
'PSMs': qTableD,
'Peptides': qTableD.applymap(lambda x: 0 if x==0 else 1)
'Peptides': qTableD.map(lambda x: 0 if x==0 else 1)
}

return qTableD
Expand All @@ -162,7 +163,7 @@ def qReportAddData(config, fdr_i, sign_i, quan, qTableD, repNM, rep, contrast):
pdmCol, qCol, qdCol, pdmFreq, qFreq, sign, signNM, FDRdNM, FDRNM = getColumnNames(config, contrast)

# Collapse PTMs of the same protein
qTableD = qTableD.reset_index().drop(pdmCol, axis=1).groupby([qCol]).agg(sum)
qTableD = qTableD.reset_index().drop(pdmCol, axis=1).groupby([qCol]).agg("sum")

# Get all PTMs inside each protein
qTableD[(quan, 'PTMs')] = qTableD.sum(axis=1)
Expand All @@ -176,7 +177,7 @@ def qReportAddData(config, fdr_i, sign_i, quan, qTableD, repNM, rep, contrast):

# Add NM freq considering all pdm
qTableD = qTableD.join(
repNM[[qCol, pdmFreq]].groupby(qCol).agg(sum).fillna(0)\
repNM[[qCol, pdmFreq]].groupby(qCol).agg("sum").fillna(0)\
.rename(columns={pdmFreq[0]: quan, 'REL': 'NM'}),
how='left'
)
Expand All @@ -189,7 +190,7 @@ def qReportAddData(config, fdr_i, sign_i, quan, qTableD, repNM, rep, contrast):
repNM[FDRNM]<fdr_i
]),
[qCol, pdmFreq]
].groupby(qCol).agg(sum)\
].groupby(qCol).agg("sum")\
.rename(columns={pdmFreq[0]: quan, 'REL': 'NMsig'}),
how='left'
).fillna(0)
Expand Down
6 changes: 4 additions & 2 deletions 4_qTableReport/utils/BinomialSiteListMaker.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def getBinom(wdf, col):
'''
'''
p, d, a, m, x = col


# Get aa freq
afreq = pd.Series(list(zip(*[
Expand Down Expand Up @@ -76,8 +77,8 @@ def getBinom(wdf, col):
# P2 --> p = p(a) & ni = Total pdm with i mod
fdf['p2'] = [afreq[i] for i in fdf[a]]

d_size = wdf[d].value_counts().to_frame().reset_index().rename(
columns={'index': 'd', 'd': 'n2'})
d_size = wdf[d].value_counts().to_frame().reset_index()#.rename(columns={'index': 'd', 'd': 'n2'})
d_size.columns = ['d', 'n2']

fdf = pd.merge(
fdf,
Expand Down Expand Up @@ -160,6 +161,7 @@ def main(args):

wdf = pd.DataFrame(wdf, columns=[pdm, p, d, a, m])


logging.info("Calculating binomial pvalues at PSM level")
biS = getBinom(wdf, [p, d, a, m, x])

Expand Down
45 changes: 45 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# This file may be used to create an environment using:
# $ conda create --name <env> --file <this file>
# platform: win-64
blas=1.0=mkl
bottleneck=1.3.5=py311h5bb9823_0
bzip2=1.0.8=he774522_0
ca-certificates=2023.08.22=haa95532_0
et_xmlfile=1.1.0=py311haa95532_0
icc_rt=2022.1.0=h6049295_2
intel-openmp=2023.1.0=h59b6b97_46319
libffi=3.4.4=hd77b12b_0
mkl=2023.1.0=h6b88ed4_46357
mkl-service=2.4.0=py311h2bbff1b_1
mkl_fft=1.3.8=py311h2bbff1b_0
mkl_random=1.2.4=py311h59b6b97_0
numexpr=2.8.7=py311h1fcbade_0
numpy=1.26.0=py311hdab7c0b_0
numpy-base=1.26.0=py311hd01c5d8_0
openpyxl=3.0.10=py311h2bbff1b_0
openssl=3.0.11=h2bbff1b_2
packaging=23.1=py311haa95532_0
pandas=2.1.1=py311hf62ec03_0
patsy=0.5.3=py311haa95532_0
pip=23.3=py311haa95532_0
plotly=5.18.0=py_0
python=3.11.5=he1021f5_0
python-dateutil=2.8.2=pyhd3eb1b0_0
python-tzdata=2023.3=pyhd3eb1b0_0
pytz=2023.3.post1=py311haa95532_0
pyyaml=6.0.1=py311h2bbff1b_0
scipy=1.11.3=py311hc1ccb85_0
setuptools=68.0.0=py311haa95532_0
six=1.16.0=pyhd3eb1b0_1
sqlite=3.41.2=h2bbff1b_0
statsmodels=0.14.0=py311hd7041d2_0
tbb=2021.8.0=h59b6b97_0
tenacity=8.2.2=py311haa95532_0
tk=8.6.12=h2bbff1b_0
tzdata=2023c=h04d1e81_0
vc=14.2=h21ff451_1
vs2015_runtime=14.27.29016=h5e58377_2
wheel=0.41.2=py311haa95532_0
xz=5.4.2=h8cc25b3_0
yaml=0.2.5=he774522_0
zlib=1.2.13=h8cc25b3_0

0 comments on commit 820ebd5

Please sign in to comment.