Staphylococcus epidermidis small basic protein(表皮葡萄球菌小分子碱性蛋白,简称 **Sbp**)

1. 基本定义

Sbp 是表皮葡萄球菌分泌的一种分子量约为 18 kDa 的胞外蛋白 [[5]]。由于其分子量较小且等电点(pI)较高(约为 9.8,呈碱性),因此被命名为“小分子碱性蛋白”(Small basic protein) [[7]]。其编码基因通常为 sbp(如在参考菌株中注释为 SERP0270)。

2. 核心功能:生物被膜的关键“支架蛋白”

表皮葡萄球菌致病的关键在于其能够形成生物被膜(biofilm),而 Sbp 是生物被膜细胞外基质中的关键支架蛋白(scaffolding protein) [[1]]。

  • 促进表面定植:Sbp 优先沉积在生物被膜与基底(如人工导管、植入物表面)的交界处,形成连续的薄膜状结构,帮助细菌在定植后期稳固、持久地附着在非生物表面上 [[12]]。
  • 辅助细胞聚集:Sbp 本身不直接引起细菌聚集,而是作为关键的辅助因子,显著促进另外两种已知机制——多糖细胞间黏附素(PIA)和积聚相关蛋白(Aap)介导的细胞间聚集和多层生物被膜的组装 [[5]]。特别是,它能与 Aap 的 Domain-B 区域发生相互作用,从而招募 Sbp 到细菌细胞表面 [[12]]。

3. 结构与物理化学特性

  • 部分折叠与富含 β-折叠:在生理条件下的溶液中,Sbp 以单体形式存在,呈部分折叠状态,且富含 β-折叠(β-sheet)结构 [[1]]。
  • 形成淀粉样纤维(Amyloid fibrils):近年来的结构生物学研究(如 SAXS、NMR 和电镜分析)发现,Sbp 具有在体外和体内自我组装形成“功能性淀粉样纤维”的特性 [[1]]。这种淀粉样纤维的形成,正是 Sbp 能够作为坚固的物理支架来支撑整个生物被膜三维架构的核心分子机制 [[1]]。

4. 临床与致病意义

表皮葡萄球菌是人体皮肤的常见共生菌,但也是医院内感染(尤其是导管、人工关节等植入物相关感染)的重要条件致病菌 [[5]]。生物被膜的形成使其能够抵抗宿主免疫系统和抗生素的杀伤。Sbp 作为生物被膜基质的关键结构成分,在细菌定植人工表面和引发慢性感染中扮演着重要角色 [[12]]。因此,Sbp 及其介导的淀粉样纤维形成机制,已成为潜在的新型抗生物被膜药物或涂层研发的靶点。


💡 针对本人研究的延伸建议: 如果本人正在对表皮葡萄球菌的 DNA-seq 数据进行变异分析(如本人之前关注的突变位点),在分析 sbp 基因时,可以重点关注:

  1. 基因缺失或移码突变:由于 Sbp 是生物被膜形成的辅助因子,sbp 基因的失活突变可能导致菌株在体外生物被膜形成能力显著下降(约降低 60%) [[12]]。
  2. 分泌信号肽区域:Sbp 的 N 端含有一个分泌信号肽(约前 28-29 个氨基酸),若该区域发生突变,可能会影响蛋白的正常胞外分泌和定位 [[7]]。

TODO: 需要提取特定菌株中 sbp 基因的序列、进行多序列比对或分析特定突变(如错义突变)对其淀粉样纤维形成能力的潜在影响。

Chess 候选人赛冠军击败卫冕王者的成功率

以下是国际象棋历史上公开组(Open) 所有公认的世界冠军完整名单。国际象棋界通常以 1886年 威廉·斯坦尼茨与约翰内斯·祖克托特的比赛作为第一位“正式”世界冠军的起点 [[3]]。

截至2024年底,历史上共产生了 18位 正式的国际象棋世界冠军 [[1]] [[107]]。名单按历史时期划分如下:


一、 无争议世界冠军时期(1886年 – 1993年)

这一时期,冠军通过在挑战者筹集奖金后进行的对抗赛中击败卫冕冠军来产生。

  1. 威廉·斯坦尼茨 (Wilhelm Steinitz) | 奥地利/美国 | 1886 – 1894
  2. 埃马纽埃尔·拉斯克 (Emanuel Lasker) | 德国 | 1894 – 1921(在位27年,史上最长)
  3. 何塞·劳尔·卡帕布兰卡 (José Raúl Capablanca) | 古巴 | 1921 – 1927
  4. 亚历山大·阿廖欣 (Alexander Alekhine) | 俄罗斯/法国 | 1927 – 1935,1937 – 1946(唯一一位在任期内去世的冠军)
  5. 马克斯·尤伟 (Max Euwe) | 荷兰 | 1935 – 1937
  6. 米哈伊尔·鲍特维尼克 (Mikhail Botvinnik) | 苏联 | 1948 – 1957,1958 – 1960,1961 – 1963(国际棋联接管后的首位冠军)
  7. 瓦西里·斯梅斯洛夫 (Vasily Smyslov) | 苏联 | 1957 – 1958
  8. 米哈伊尔·塔尔 (Mikhail Tal) | 苏联 | 1960 – 1961
  9. 提格兰·彼得罗辛 (Tigran Petrosian) | 苏联 | 1963 – 1969
  10. 鲍里斯·斯帕斯基 (Boris Spassky) | 苏联 | 1969 – 1972
  11. 鲍比·菲舍尔 (Bobby Fischer) | 美国 | 1972 – 1975
  12. 阿纳托利·卡尔波夫 (Anatoly Karpov) | 苏联/俄罗斯 | 1975 – 1985
  13. 加里·卡斯帕罗夫 (Garry Kasparov) | 苏联/俄罗斯 | 1985 – 1993

二、 头衔分裂时期(1993年 – 2006年)

1993年,卡斯帕罗夫与挑战者肖特脱离国际棋联(FIDE),成立了职业国际象棋协会(PCA),导致世界冠军头衔分裂为两个平行体系,直到2006年才重新统一。

【国际棋联 (FIDE) 体系冠军】

  • 阿纳托利·卡尔波夫 (Anatoly Karpov) | 1993 – 1999
  • 亚历山大·哈利夫曼 (Alexander Khalifman) | 1999 – 2000
  • 维斯瓦纳坦·阿南德 (Viswanathan Anand) | 2000 – 2002
  • 鲁斯兰·波诺马廖夫 (Ruslan Ponomariov) | 2002 – 2004
  • 鲁斯塔姆·卡西姆扎诺夫 (Rustam Kasimdzhanov) | 2004 – 2005
  • 维塞林·托帕洛夫 (Veselin Topalov) | 2005 – 2006

【职业棋协 (PCA) / 经典赛体系冠军】

  • 加里·卡斯帕罗夫 (Garry Kasparov) | 1993 – 2000
  • 弗拉基米尔·克拉姆尼克 (Vladimir Kramnik) | 2000 – 2006

三、 头衔统一后的无争议世界冠军(2006年 – 至今)

2006年,克拉姆尼克与托帕洛夫进行统一赛,此后所有世界冠军赛均由国际棋联(FIDE)统一管理,并通常定为每两年举办一次。

  1. 弗拉基米尔·克拉姆尼克 (Vladimir Kramnik) | 俄罗斯 | 2006 – 2007
  2. 维斯瓦纳坦·阿南德 (Viswanathan Anand) | 印度 | 2007 – 2013
  3. 马格努斯·卡尔森 (Magnus Carlsen) | 挪威 | 2013 – 2023
  4. 丁立人 (Ding Liren) | 中国 | 2023 – 2024(中国首位国际象棋男子世界冠军,也是历史上第17位世界冠军)[[104]]
  5. 多曼拉朱·古克什 (Gukesh Dommaraju) | 印度 | 2024 – 至今(在2024年底击败丁立人,成为历史上最年轻的世界冠军)[[107]]

补充说明:

  1. 早期非正式“世界冠军”:在1886年之前,如菲利多尔(Philidor)、拉布多内(La Bourdonnais)、霍华德·斯汤顿(Howard Staunton)、阿道夫·安德森(Adolf Anderssen)和保罗·摩菲(Paul Morphy)等人曾被同时代人公认为“世界最强棋手”,但现代国际象棋界通常不将他们计入正式的世界冠军序列。
  2. 女子世界冠军:国际象棋设有独立的女子世界冠军赛事(如谢军、诸宸、许昱华、侯逸凡、居文君等均曾夺冠),上述名单仅针对公开组(Open) 世界冠军。
  3. 其他项目:除传统慢棋外,国际棋联还单独举办世界快棋(Rapid)、超快棋(Blitz)、通讯棋(Correspondence)和菲舍尔任意制(Chess960)的世界冠军赛。


以下是国际象棋历史上女子世界冠军(Women’s World Chess Champion) 的完整名单。女子世界冠军的历史始于 1927年,由国际棋联(FIDE)认证和管理。

截至2024年底,历史上共有 17位 不同的女性曾加冕女子世界冠军。按历史时期划分如下:


一、 早期与苏联统治时期(1927年 – 1991年)

这一时期主要通过循环赛或对抗赛决出冠军,苏联(及后来的独联体/格鲁吉亚)棋手展现了绝对的统治力。

  1. 维拉·明契克 (Vera Menchik) | 俄罗斯/捷克斯洛伐克/英国 | 1927 – 1944
    (首位女子世界冠军,不幸在1944年二战伦敦空袭中遇难,头衔在其任内中断)
  2. 柳德米拉·鲁坚科 (Lyudmila Rudenko) | 苏联 | 1950 – 1953
  3. 叶丽萨维塔·贝科娃 (Elisaveta Bykova) | 苏联 | 1953 – 1956,1958 – 1962
  4. 奥尔加·鲁布佐娃 (Olga Rubtsova) | 苏联 | 1956 – 1958
  5. 诺娜·加普林达什维利 (Nona Gaprindashvili) | 苏联/格鲁吉亚 | 1962 – 1978
    (统治棋坛16年,后成为历史上首位获得国际象棋“特级大师”称号的女性)
  6. 玛雅·齐布尔达尼泽 (Maia Chiburdanidze) | 苏联/格鲁吉亚 | 1978 – 1991

二、 中国崛起与赛制变革时期(1991年 – 2017年)

1991年,中国棋手打破了苏联/东欧对该头衔长达41年的垄断。此期间,国际棋联曾一度将世锦赛改为淘汰赛制(Knockout),导致冠军更迭较为频繁。

  1. 谢军 (Xie Jun) | 中国 | 1991 – 1996,1999 – 2001
    (中国乃至亚洲首位女子世界冠军) [[4]]
  2. 苏珊·波尔加 (Susan Polgar) | 匈牙利 | 1996 – 1999
  3. 诸宸 (Zhu Chen) | 中国 | 2001 – 2004
  4. 安托阿内塔·斯坦芳诺娃 (Antoaneta Stefanova) | 保加利亚 | 2004 – 2006
  5. 许昱华 (Xu Yuhua) | 中国 | 2006 – 2008
  6. 亚历山德拉·科斯坚纽克 (Alexandra Kosteniuk) | 俄罗斯 | 2008 – 2010
  7. 侯逸凡 (Hou Yifan) | 中国 | 2010 – 2012,2013 – 2015,2016 – 2017
    (共4次夺冠,是历史上最年轻的女子世界冠军) [[32]]
  8. 安娜·乌什尼娜 (Anna Ushenina) | 乌克兰 | 2012 – 2013
  9. 玛丽亚·穆兹丘克 (Mariya Muzychuk) | 乌克兰 | 2015 – 2016
  10. 谭中怡 (Tan Zhongyi) | 中国 | 2017 – 2018

三、 传统对抗赛制回归与“居文君时代”(2018年 – 至今)

国际棋联重新确立了“大奖赛/候选人赛 + 冠军对抗赛”的传统模式,冠军头衔的含金量与稳定性大幅提升。

  1. 居文君 (Ju Wenjun) | 中国 | 2018 – 至今
    (已4次加冕:2018年击败谭中怡首夺冠军,2020年卫冕,2023年在对抗赛中击败雷挺婕成功卫冕 [[43]]。她将在2025年接受2024年女子候选人赛冠军谭中怡的挑战 [[47]])

💡 补充说明:

  1. 中国的辉煌成就:自1991年谢军首夺冠军以来,中国共产生了 6位 女子世界冠军(谢军、诸宸、许昱华、侯逸凡、谭中怡、居文君),是历史上产生女子世界冠军最多的国家,形成了著名的“国象女队集团优势”。
  2. 赛制区别:与公开组(男子)不同,女子世界冠军赛在2000年至2010年代中期曾采用64人单败淘汰赛制,这使得一些等级分并非最高的棋手也有机会爆冷夺冠(如乌什尼娜、穆兹丘克)。
  3. 其他项目:国际棋联同样设有独立的女子快棋(Rapid)和超快棋(Blitz)世界冠军赛。例如,印度名将科内鲁(Humpy Koneru)和中国的居文君都曾获得过女子快棋/超快棋世界冠军头衔 [[45]]。


在国际象棋历史上,通过候选人赛拿到挑战权,并最终在世界冠军对抗赛中击败卫冕冠军登顶的,共有10届(涉及8位棋手)。 需要注意的是,像丁立人(2023年夺冠,卡尔森退赛)、卡尔波夫(1975年因菲舍尔退赛直接继位)等,属于通过候选人赛获得资格,但未能在棋盘上直接击败卫冕冠军的情况,因此不计入内。 以下是直接在头衔战中“挑落”现任世界冠军的历届候选人赛冠军名单(按时间倒序排列):

1. 2024年候选人赛冠军:多马拉朱·古凯什 (Gukesh D) 🇮🇳

  • 结果:在2024年底的新加坡世界冠军对抗赛中,击败了中国卫冕冠军丁立人,成为第18位世界冠军。 [1]

2. 2013年候选人赛冠军:马格努斯·卡尔森 (Magnus Carlsen) 🇳🇴

  • 结果:在2013年世界冠军赛中,击辟了印度本土作战的卫冕冠军阿南德,开启了属于他的卡尔森时代。 [1]

3. 1993年PCA候选人赛冠军:加里·卡斯帕罗夫 (Garry Kasparov) 俄罗斯/苏联

  • 注:此处特指1983年候选人赛。
  • 结果:1983年卡斯帕罗夫赢得候选人赛,并在旷日持久的1984–1985年对抗赛中,最终击败了卫冕冠军阿纳托利·卡尔波夫,成为当时历史上最年轻的世界冠军。

4. 1977年 & 1980年候选人赛冠军:维克多·科尔奇诺伊 (Viktor Korchnoi) (未成功)

  • 特别提及:他连续两届杀出候选人赛,但均在世界冠军对抗赛中败给了卡尔波夫

5. 1971年候选人赛冠军:鲍比·菲舍尔 (Bobby Fischer) 🇺🇸

  • 结果:在1972年被称为“世纪大战”的雷克雅未克对抗赛中,大比分击败苏联卫冕冠军鲍里斯·斯帕斯基,打破了苏联对国象王座数十年的垄断。

6. 1968年候选人赛冠军:鲍里斯·斯帕斯基 (Boris Spassky) 苏联

  • 结果:在1969年世界冠军赛中,击败了铁防大师蒂格兰·彼得罗西扬(他在1965年夺得候选人赛挑战彼得罗西扬时曾失败过一次)。

7. 1962年候选人赛冠军:蒂格兰·彼得罗西扬 (Tigran Petrosian) 苏联

  • 结果:在1963年世界冠军对抗赛中,击败了苏联国象教父米哈伊尔·鲍特维尼克。

8. 1959年候选人赛冠军:米哈伊尔·塔尔 (Mikhail Tal) 苏联

  • 结果:在1960年对抗赛中,凭借狂暴的进攻风格击败了鲍特维尼克,成为当时最年轻的世界冠军(不过次年复赛被鲍特维尼克夺回)。 [2]

9. 1956年候选人赛冠军:瓦西里·斯梅斯洛夫 (Vasily Smyslov) 苏联

  • 结果:在1957年世界冠军赛中,击败了鲍特维尼克(他曾获得1953年候选人赛冠军,但在1954年挑战时与鲍特维尼克打平,未能夺冠)。 [2]

📊 总结:候选人赛冠军击败卫冕王者的成功率

历史上,能够从地狱级难度的候选人赛中杀出、并最终直接掀翻王座的只有: 斯梅斯洛夫 (1957) ➔ 塔尔 (1960) ➔ 彼得罗西扬 (1963) ➔ 斯帕斯基 (1969) ➔ 菲舍尔 (1972) ➔ 卡斯帕罗夫 (1985) ➔ 卡尔森 (2013) ➔ 古凯什 (2024)。 在最近一届的 2026年世界冠军对抗赛(预计于2026年11月至12月举行)中,新一届候选人赛冠军、乌兹别克斯坦的贾沃希尔·辛达罗夫 (Javokhir Sindarov) 将向现任世界冠军多马拉朱·古凯什发起挑战。 [3] 如果你感兴趣,我们可以继续聊聊:

  • 这几场史诗级对决中,哪一场的对局内容或历史背景(例如1972美苏世纪大战)让你最想了解?
  • 你是否想预测一下2026年底古凯什 vs 辛达罗夫的强强对话? [3, 4]

[1] https://baike.baidu.com [2] https://www.reddit.com [3] https://en.wikipedia.org [4] https://kheladesk.com



丁立人在2023年夺得世界冠军的历史进程,堪称国际象棋史上最具戏剧性、最跌宕起伏的“逆袭”神话。他从最初几乎无缘候选人赛,到最终加冕第17位世界冠军,中间经历了数次惊人的转折: [1, 2, 3]

1. 戏剧性的晋级之路(一波三折)

丁立人之所以能参加2023年的世界冠军赛,本身就是一系列小概率事件叠加的结果:

  • 递补进入候选人赛:2022年,原本获得候选人赛资格的俄罗斯棋手卡尔亚金因政治言论被国际棋联禁赛。当时丁立人是等级分最高的非参赛棋手,但因疫情缺少比赛对局数。为了帮他刷满法定的30盘棋,中国国象协会在1个月内赶办了三场比赛,丁立人凭借惊人的毅力打满对局,压哨夺回候选人赛资格。 [1]
  • 最后一轮惊险拿亚军:在2022年候选人赛中,俄罗斯棋手伊恩·涅波姆尼亚奇提前夺冠。当时大家都以为只有第一名有用,但在收官轮(第14轮)中,丁立人执白死磕并击败了积分暂列第二的美国名将中村光,硬生生抢下了候选人赛亚军。 [4]

2. 卡尔森退赛送来“天赐良机”

执掌国际象棋王座长达10年的挪威棋王马格努斯·卡尔森(Magnus Carlsen)在2022年7月正式宣布:由于缺乏动力,他将放弃卫冕古典棋世界冠军头衔。 [5, 6]

  • 根据国际棋联规则,现任冠军退赛后,世界冠军赛将由候选人赛的前两名直接对决。
  • 丁立人凭借此前最后一轮拼下的亚军,顺理成章地递补获得了与涅波姆尼亚奇争夺世界冠军王座的资格! [4, 5, 7]

3. 2023年阿斯塔纳对决:惊天逆转

2023年4月,哈萨克斯坦阿斯塔纳世界冠军对抗赛打响。整场比赛的心理战和跌宕程度历史罕见: [2, 8, 9]

  • 慢棋阶段(落后-追平的循环):在14盘古典慢棋中,由于巨大的心理压力,双方失误频频,比赛演变成惨烈的对攻战。涅波姆尼亚奇在比赛中先后三次取得比分领先,而丁立人展现了极强的韧性,顶住压力三次将比分顽强扳平。最终,双方在慢棋阶段打成 7:7 平。 [2, 3, 4, 10]
  • 快棋加赛:史诗般的第4局:比赛进入4盘25分钟的快棋加赛。前3局双方全部弈和。 [1, 3, 11]
  • 在第4局中,丁立人执黑,在局势看似无法避免和棋、全场都以为要进入超快棋加赛时,他展现了极其推崇的胜负师精神:在时间所剩无几的情况下,丁立人拒绝长将和棋,毅然选择“自捆(Self-pin)”国王进行绝地反击! 这一极其冒险却充满勇气的选择彻底震撼了涅波姆尼亚奇,导致后者在重压下连续犯错。 [2]

最终,涅波姆尼亚奇在第68步见大势已去,痛苦投子认输。丁立人以快棋加赛 2.5 : 1.5 的比分绝杀对手,成为了国际象棋历史上第17位世界冠军,也是中国棋王第一人。 [2, 3] 如果你对这段历史感兴趣,我们还可以聊聊:

  • 丁立人在那场比赛中的幕后助手(Seconds)拉波特对他的怪招帮助?
  • 丁立人夺冠后经历的心理低谷,以及他在2024年底对阵古凯什的卫冕战战况? [12, 13]

[1] https://en.wikipedia.org [2] https://www.theguardian.com [3] https://www.chess.com [4] https://en.wikipedia.org [5] https://en.wikipedia.org [6] https://www.firstpost.com [7] https://www.fide.com [8] https://www.fide.com [9] https://lichess.org [10] https://en.chessbase.com [11] https://www.chessgames.com [12] https://www.reddit.com [13] https://en.wikipedia.org

Streamlining TraDIS Analysis: Updating Circos Visualizations and Functional Clustering of Essential Genes in Yersinia (Data_Jiline_Transposon)

Main story: Motivation → Visualization Update → Annotation Strategy → Functional Clustering.

circos_4rings.conf

tn5_essential_cog_profiler.py

circos

  • COG_groups_barchart_absolute
  • COG_groups_barchart_percent

R、W、Z、Y、B、A 这些 COG 类别在所有条件下确实都显示为零或接近零。这与之前我解释的情况不同,让我为您解释为什么在您的实验数据中这些类别会是零:

可能的原因:

1. 技术/方法学原因

  • Tn5 转座子饱和度的限制:某些必需基因可能因为序列特征(如 GC 含量、二级结构)而难以被 Tn5 转座子插入,导致这些基因在筛选中未被识别
  • 基因注释的局限性:使用的 COG 数据库版本或注释工具可能没有将某些基因正确分类到这些类别

2. 生物学原因

Y (核结构) 和 B (染色质结构)

  • 细菌没有真正的细胞核,这些类别在细菌中本来就很少见
  • 细菌的染色体相关蛋白(如 HU、H-NS)可能被注释到了其他类别(如 L – 复制、重组和修复)

A (RNA 加工和修饰)

  • 细菌的 RNA 加工机制相对简单
  • 相关基因可能被归类到了其他类别(如 J – 翻译相关)

Z (细胞骨架)

  • 虽然细菌有 FtsZ 等细胞骨架蛋白,但在某些菌株中这些基因可能不是绝对必需的
  • 或者这些基因被注释到了其他类别(如 D – 细胞周期控制)

W (细胞外结构)

  • 在实验室培养条件下,某些细胞外结构基因可能不是必需的
  • 这些基因通常在特定环境(如感染、生物膜形成)中才变得重要

R (一般功能预测)

  • 这个类别通常是”未知功能”的暂存区
  • 如果您的基因组注释质量很高,大多数基因都有了明确的功能分类,R 类就会很少

3. 验证步骤

  1. 检查原始数据:查看是否真的有基因被注释到这些类别,但在筛选必需基因时被排除了
  2. 手动检查关键基因:例如 FtsZ(应该在 Z 类)、SMC 蛋白(可能在 Y 或 B 类)的实际注释情况
  3. 重新运行 COG 注释:使用最新的数据库(如 eggNOG-mapper)重新注释,看结果是否一致
  • COG_letters_barchart_absolute
  • COG_letters_barchart_percent

Pipeline Update: Refining TraDIS Visualizations and Functionally Clustering Essential Genes in Non-Model Organisms

Context & Motivation: Following a review of our TraDIS data visualization, we received feedback to make two key updates for our upcoming manuscript:

  1. Remove the extracellular bacteria sample (green outer ring) from the Circos plot to reduce visual clutter.
  2. Generate a comprehensive functional clustering table of all identified essential genes (e.g., ribosome-associated, DNA-associated) to replace vague references to “confirmed essential genes” in the methods section.

Below is the adapted pipeline to achieve both goals, specifically tailored for a non-model organism where standard R annotation packages (e.g., org.Hs.eg.db) do not apply. Instead, we derive functional annotations directly from protein sequences using EggNOG-mapper.


Part 1: Updating the Circos Visualization

To remove the extracellular sample, we must adjust the circos.conf file by removing its corresponding plot block and re-balancing the radii (r1 and r0) of the remaining rings. This ensures the 4 remaining conditions and the essential genes heatmap evenly distribute and fill the space left by the removed outer ring.

Action: Replace the plots section in your configuration file and run:

circos -conf circos_4rings.conf

Part 2: Functional Annotation Strategy (EggNOG-mapper)

Since standard organism-specific databases are unavailable, we use EggNOG-mapper to generate robust functional annotations (COG categories, KEGG pathways, GO terms) directly from the protein FASTA sequences.

2A) Environment Setup

mamba create -n eggnog_env python=3.8 eggnog-mapper -c conda-forge -c bioconda   # Installs eggnog-mapper 2.1.12
mamba activate eggnog_env

2B) Database Preparation

mkdir -p /home/jhuang/mambaforge/envs/eggnog_env/lib/python3.8/site-packages/data/
download_eggnog_data.py --dbname eggnog.db -y \
  --data_dir /home/jhuang/mambaforge/envs/eggnog_env/lib/python3.8/site-packages/data/

2C) Input Preparation & Execution

(Note: Step 2C.1 is optional and used primarily for RNA-seq integration baseline, but good practice for header standardization).

1. Clean Reference FASTA Headers (Optional):

mv ~/Downloads/sequence\(12\).txt CP009367_protein_.fasta
python ~/Scripts/update_fasta_header.py CP009367_protein_.fasta CP009367_protein.fasta
  • Input: Downloaded GenBank protein FASTA (CP009367_protein_.fasta)
  • Output: Cleaned FASTA headers (CP009367_protein.fasta)

2. Run EggNOG-mapper:

emapper.py -i CP009367_protein.fasta -o eggnog_out --cpu 60
# Add --resume if the process was interrupted
  • Output: eggnog_out.emapper.annotations (Contains all functional mappings for downstream clustering).

Part 3: Essential Gene Functional Clustering & Reporting

To answer the request for a table showing all essential genes and their involved pathways, we cross-reference the TraDIS essentiality calls with the EggNOG annotations using a custom Python profiler.

3A) Execute the Clustering Pipeline

Run the adapted profiling script, which strictly filters for genes marked as "Essential" in the final column of the Tn5Gaps.xls sheets, maps them to their COG categories, and generates both summary statistics and manuscript-ready tables.

cd /mnt/md1/DATA/Data_Jiline_Transposon/
./tn5_essential_cog_profiler.py

3B) Finalize the Manuscript Excel Output

The script generates Tn5_Essential_COG_Summary.xlsx. Before sharing with collaborators or inserting into the manuscript supplementary materials, perform these final cleanup steps in Excel:

  1. Rename the primary sheet: Change the name of the main detailed sheet to Essential_Genes_Functional_Groups.
  2. Clean up the Summary sheet: In the final summary tab, delete the Unassigned and R+S_Percent columns to keep the focus strictly on the assigned functional distributions.

Final Deliverables:

  • Updated Circos plots (.png / .svg) with 4 rings.
  • Tn5_Essential_COG_Summary.xlsx containing the complete, filtered table of essential genes mapped to their specific COG letters and broader functional groups (Information Storage, Cellular Processes, Metabolism, etc.).

Generating Pseudo-Replicates for ONT Methylation Analysis: Splitting POD5 Files vs. BAM Subsampling for nf-core/methylong (Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans)

To create pseudo-replicates for statistical analysis, splitting the POD5 files is the best approach. This ensures that each replicate is processed independently from basecalling to alignment, which better simulates technical variability and avoids biases introduced by splitting already-aligned BAM files (which might have mapping dependencies).

Here is the strategy:

  1. Split POD5s: For each sample, split the original pod5_pass directory into two subsets (Replicate 1 and Replicate 2).To create pseudo-replicates for statistical analysis, splitting the POD5 files is the best approach. This ensures that each replicate is processed independently from basecalling to alignment, which better simulates technical variability and avoids biases introduced by splitting already-aligned BAM files (which might have mapping dependencies).

Here is the strategy:

  1. Split POD5s: For each sample, split the original pod5_pass directory into two subsets (Replicate 1 and Replicate 2). We will use a simple script to randomly assign ~50% of reads to each replicate.
  2. Adapt generate_mapped_modbam.sh: Modify the script to process these split POD5 directories.
  3. Update Samplesheets: Create new samplesheets that list the pseudo-replicates.

Step 1: Script to Split POD5 Files

First, let’s create a helper script to split your POD5 files. Save this as split_pod5.sh.

#!/bin/bash
# split_pod5.sh - Splits POD5 files into two pseudo-replicates
set -euo pipefail

# Configuration
BASE_DIR="/home/jhuang/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans"
POD5_BASE="${BASE_DIR}/X101SC26036392-Z01-J004/Release-X101SC26036392-Z01-J004-20260625_01/Data-X101SC26036392-Z01-J004"

# List of sample folders relative to POD5_BASE
SAMPLES=("S2_Light" "S2_Dark" "T" "O" "WT_Trans" "O_Trans" "WT")

for SAMPLE in "${SAMPLES[@]}"; do
    echo "Processing ${SAMPLE}..."

    # Define source directory
    SRC_DIR="${POD5_BASE}/${SAMPLE}/1732_2B_PBK77125_17f5982a/${SAMPLE}_pod5_pass"

    # Define output directories for replicates
    REP1_DIR="${SRC_DIR}_rep1"
    REP2_DIR="${SRC_DIR}_rep2"

    # Create output dirs if they don't exist
    mkdir -p "${REP1_DIR}" "${REP2_DIR}"

    # Get all pod5 files
    FILES=("${SRC_DIR}"/*.pod5)
    TOTAL=${#FILES[@]}

    if [ "$TOTAL" -eq 0 ]; then
        echo "No POD5 files found for ${SAMPLE}. Skipping."
        continue
    fi

    echo "Found ${TOTAL} POD5 files. Splitting..."

    # Shuffle and split
    # Note: shuf is part of coreutils on Linux
    SHUFFLED=($(shuf -e "${FILES[@]}"))

    MID=$((TOTAL / 2))

    # Copy first half to rep1, second half to rep2
    for i in "${!SHUFFLED[@]}"; do
        FILE="${SHUFFLED[$i]}"
        BASENAME=$(basename "${FILE}")

        if [ "$i" -lt "$MID" ]; then
            cp "${FILE}" "${REP1_DIR}/${BASENAME}"
        else
            cp "${FILE}" "${REP2_DIR}/${BASENAME}"
        fi
    done

    echo "✅ ${SAMPLE} split complete: ${MID} files in rep1, $((TOTAL - MID)) files in rep2"
done

echo "🎉 All POD5 files split successfully!"

Run this script once:

chmod +x split_pod5.sh
./split_pod5.sh

Step 2: Adapted generate_mapped_modbam_rep.sh

This updated script now processes the _rep1 and _rep2 directories created above. It generates separate BAM files for each replicate.

#!/bin/bash
#===============================================================================
# generate_mapped_modbam_pseudo_reps_rep.sh - Local Dorado generation for pseudo-replicates
#===============================================================================
set -euo pipefail

# === Configuration ===
DORADO="/home/jhuang/Tools/dorado-2.0.0-linux-x64/bin/dorado"  # Your local Dorado path
BASE_DIR="/home/jhuang/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans"
OUTDIR="${BASE_DIR}"

# Reference genome paths
REF_S2_LIGHT="${BASE_DIR}/S2_Light-trycycler-medaka_polished_genome.fa"
REF_S2_DARK="${BASE_DIR}/S2_Dark-trycycler-medaka_polished_genome.fa"
REF_T="${BASE_DIR}/T-trycycler-medaka_polished_genome.fa"
REF_O="${BASE_DIR}/O-trycycler-medaka_polished_genome.fa"
REF_WT_TRANS="${BASE_DIR}/WT_Trans-trycycler-medaka_polished_genome.fa"
REF_O_TRANS="${BASE_DIR}/O_Trans-trycycler-medaka_polished_genome.fa"
REF_WT="${BASE_DIR}/WT-trycycler-medaka_polished_genome.fa"

# POD5 data paths (Updated to point to split replicas)
POD5_BASE="${BASE_DIR}/X101SC26036392-Z01-J004/Release-X101SC26036392-Z01-J004-20260625_01/Data-X101SC26036392-Z01-J004"

# Helper function to get pod5 path
get_pod5_path() {
    local SAMPLE=$1
    local REP=$2
    echo "${POD5_BASE}/${SAMPLE}/1732_2B_PBK77125_17f5982a/${SAMPLE}_pod5_pass_${REP}"
}

# Dorado model
MODEL="dna_r10.4.1_e8.2_400bps_sup@v5.0.0"

# Ensure all reference genomes are indexed
echo "📚 Indexing reference genomes..."
for REF in "${REF_S2_LIGHT}" "${REF_S2_DARK}" "${REF_T}" "${REF_O}" "${REF_WT_TRANS}" "${REF_O_TRANS}" "${REF_WT}"; do
    if [ ! -f "${REF}.fai" ]; then
        echo "   Indexing: $(basename ${REF})"
        samtools faidx "${REF}"
    fi
done

# === Function: Generate modBAM ===
generate_modbam() {
    local SAMPLE_NAME=$1
    local REF=$2
    local POD5_DIR=$3
    local MOD_BASES=$4

    echo "🚀 Generating ${SAMPLE_NAME} ${MOD_BASES} modBAM (aligned)..."

    # Check if pod5 dir exists
    if [ ! -d "${POD5_DIR}" ]; then
        echo "❌ Error: POD5 directory not found: ${POD5_DIR}"
        return 1
    fi

    "${DORADO}" basecaller \
        --modified-bases "${MOD_BASES}" \
        --emit-moves \
        --device cuda:0 \
        --reference "${REF}" \
        "${MODEL}" \
        "${POD5_DIR}" | samtools view -b - > "${OUTDIR}/${SAMPLE_NAME}_${MOD_BASES//\//_}_mapped.mod.bam"
}

# === Process all samples and replicates ===
SAMPLES=("S2_Light" "S2_Dark" "T" "O" "WT_Trans" "O_Trans" "WT")
REPS=("rep1" "rep2")
MOD_TYPES=("6mA" "4mC_5mC")

# Associative array for references
declare -A REFS
REFS["S2_Light"]="${REF_S2_LIGHT}"
REFS["S2_Dark"]="${REF_S2_DARK}"
REFS["T"]="${REF_T}"
REFS["O"]="${REF_O}"
REFS["WT_Trans"]="${REF_WT_TRANS}"
REFS["O_Trans"]="${REF_O_TRANS}"
REFS["WT"]="${REF_WT}"

for SAMPLE in "${SAMPLES[@]}"; do
    REF="${REFS[$SAMPLE]}"

    for REP in "${REPS[@]}"; do
        POD5_DIR=$(get_pod5_path "${SAMPLE}" "${REP}")
        SAMPLE_TAG="${SAMPLE}_${REP}"

        for MOD in "${MOD_TYPES[@]}"; do
            generate_modbam "${SAMPLE_TAG}" "${REF}" "${POD5_DIR}" "${MOD}"
        done
    done
done

# === Verify Output ===
echo ""
echo "🔍 Verifying BAM files..."
for BAM in "${OUTDIR}"/*_rep[12]_*_mapped.mod.bam; do
    if [ -f "${BAM}" ]; then
        if samtools quickcheck "${BAM}" 2>/dev/null; then
            READS=$(samtools view -c "${BAM}")
            echo "✅ $(basename "${BAM}"): ${READS} reads"
        else
            echo "❌ $(basename "${BAM}"): Corrupted or invalid format"
        fi
    fi
done

echo ""
echo "🎉 Pseudo-replicate modBAM generation complete!"
echo "📁 Output directory: ${OUTDIR}"

Step 3: Updated Samplesheets

You need to update your CSV files to include the pseudo-replicates. The group column should remain the same (e.g., “WT”) so that downstream tools know they belong to the same biological condition, but the sample name must be unique (e.g., “WT_rep1”).

samplesheet_6mA_rep.csv

group,sample,path,ref,method
WT,WT_rep1,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/WT_rep1_6mA_mapped.mod.bam,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/WT-trycycler-medaka_polished_genome.fa,ont
WT,WT_rep2,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/WT_rep2_6mA_mapped.mod.bam,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/WT-trycycler-medaka_polished_genome.fa,ont
T,T_rep1,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/T_rep1_6mA_mapped.mod.bam,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/T-trycycler-medaka_polished_genome.fa,ont
T,T_rep2,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/T_rep2_6mA_mapped.mod.bam,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/T-trycycler-medaka_polished_genome.fa,ont
O,O_rep1,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/O_rep1_6mA_mapped.mod.bam,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/O-trycycler-medaka_polished_genome.fa,ont
O,O_rep2,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/O_rep2_6mA_mapped.mod.bam,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/O-trycycler-medaka_polished_genome.fa,ont
WT_Trans,WT_Trans_rep1,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/WT_Trans_rep1_6mA_mapped.mod.bam,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/WT_Trans-trycycler-medaka_polished_genome.fa,ont
WT_Trans,WT_Trans_rep2,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/WT_Trans_rep2_6mA_mapped.mod.bam,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/WT_Trans-trycycler-medaka_polished_genome.fa,ont
O_Trans,O_Trans_rep1,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/O_Trans_rep1_6mA_mapped.mod.bam,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/O_Trans-trycycler-medaka_polished_genome.fa,ont
O_Trans,O_Trans_rep2,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/O_Trans_rep2_6mA_mapped.mod.bam,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/O_Trans-trycycler-medaka_polished_genome.fa,ont
S2_Light,S2_Light_rep1,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/S2_Light_rep1_6mA_mapped.mod.bam,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/S2_Light-trycycler-medaka_polished_genome.fa,ont
S2_Light,S2_Light_rep2,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/S2_Light_rep2_6mA_mapped.mod.bam,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/S2_Light-trycycler-medaka_polished_genome.fa,ont
S2_Dark,S2_Dark_rep1,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/S2_Dark_rep1_6mA_mapped.mod.bam,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/S2_Dark-trycycler-medaka_polished_genome.fa,ont
S2_Dark,S2_Dark_rep2,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/S2_Dark_rep2_6mA_mapped.mod.bam,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/S2_Dark-trycycler-medaka_polished_genome.fa,ont

samplesheet_4mC_5mC_rep.csv

group,sample,path,ref,method
WT,WT_rep1,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/WT_rep1_4mC_5mC_mapped.mod.bam,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/WT-trycycler-medaka_polished_genome.fa,ont
WT,WT_rep2,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/WT_rep2_4mC_5mC_mapped.mod.bam,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/WT-trycycler-medaka_polished_genome.fa,ont
T,T_rep1,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/T_rep1_4mC_5mC_mapped.mod.bam,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/T-trycycler-medaka_polished_genome.fa,ont
T,T_rep2,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/T_rep2_4mC_5mC_mapped.mod.bam,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/T-trycycler-medaka_polished_genome.fa,ont
O,O_rep1,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/O_rep1_4mC_5mC_mapped.mod.bam,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/O-trycycler-medaka_polished_genome.fa,ont
O,O_rep2,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/O_rep2_4mC_5mC_mapped.mod.bam,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/O-trycycler-medaka_polished_genome.fa,ont
WT_Trans,WT_Trans_rep1,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/WT_Trans_rep1_4mC_5mC_mapped.mod.bam,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/WT_Trans-trycycler-medaka_polished_genome.fa,ont
WT_Trans,WT_Trans_rep2,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/WT_Trans_rep2_4mC_5mC_mapped.mod.bam,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/WT_Trans-trycycler-medaka_polished_genome.fa,ont
O_Trans,O_Trans_rep1,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/O_Trans_rep1_4mC_5mC_mapped.mod.bam,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/O_Trans-trycycler-medaka_polished_genome.fa,ont
O_Trans,O_Trans_rep2,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/O_Trans_rep2_4mC_5mC_mapped.mod.bam,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/O_Trans-trycycler-medaka_polished_genome.fa,ont
S2_Light,S2_Light_rep1,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/S2_Light_rep1_4mC_5mC_mapped.mod.bam,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/S2_Light-trycycler-medaka_polished_genome.fa,ont
S2_Light,S2_Light_rep2,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/S2_Light_rep2_4mC_5mC_mapped.mod.bam,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/S2_Light-trycycler-medaka_polished_genome.fa,ont
S2_Dark,S2_Dark_rep1,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/S2_Dark_rep1_4mC_5mC_mapped.mod.bam,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/S2_Dark-trycycler-medaka_polished_genome.fa,ont
S2_Dark,S2_Dark_rep2,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/S2_Dark_rep2_4mC_5mC_mapped.mod.bam,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/S2_Dark-trycycler-medaka_polished_genome.fa,ont

Next Steps

  1. Run split_pod5.sh to create the replicated POD5 directories.
  2. Run the new generate_mapped_modbam.sh to create the BAM files. Note: This will take roughly twice as long as before since you are processing all reads again.
  3. Use the new CSV files with nf-core/methylong.
  4. When running modkit pileup manually afterwards, ensure you update the loop to iterate over the new replicate names (e.g., WT_rep1, WT_rep2, etc.) if you wish to generate per-replicate BED files, or keep the original logic if nf-core/methylong handles the aggregation correctly. Usually, for differential methylation analysis later, having per-replicate BEDs or counts is beneficial.

Small RNA-Seq Analysis Pipeline: Identifying miRNA Targets in MKL-1 and WaGa Cell Lines

  • distribution_heatmap_MKL-1
  • differentially_expressed_miRNAs_heatmap_MKL-1
  • volcano_plot_untreated_vs_parental_cells_MKL-1
  1. Input data

     WaGa wt cells (nf774* (Considering to be deleted, due to possibly be an outlier, but in the current version, it is still included in the analysis), nf961, nf962)
     WaGa wt_EV_RNA (nf657* (The sample was EXCLUDED, since it is obviously a outlier, not clustered with the other 2 samples), nf930, nf935)
     WaGa_sT_DMSO_EV_RNA (nf931, nf936, nf971)
     WaGa_sT_Dox_EV_RNA (nf932, nf937, nf972)
     WaGa_scr_DMSO_EV_RNA (nf933, nf938, nf973)
     WaGa_scr_Dox_EV_RNA (nf934, nf939, nf974)
     # --> In total, 17 samples
    
     MKL-1 wt cells (nf780*, nf796*, nf797*)
     MKL-1 wt_EV_RNA (nf655* (The sample was EXCLUDED), 2404, 2608)
     MKL-1_sT_DMSO_EV_RNA (2608, 2701, 2802)
     MKL-1_sT_Dox_EV_RNA (2608, 2701, 2802)
     MKL-1_scr_DMSO_EV_RNA (2608, 2701, 2802)
     MKL-1_scr_Dox_EV_RNA (2608, 2701, 2802)
     # --> In total, 18 samples
    
     #Note that the real paths are as follows:
     #./20260506_AV243904_0073_A/2404_MKL1_wt_EVs/2404_MKL1_wt_EVs_R1.fastq.gz, ./20260506_AV243904_0073_A/2608_MKL1_wt_EVs/2608_MKL1_wt_EVs_R1.fastq.gz
     #./20260506_AV243904_0073_A/2608_MKL1_sT_DMSO/2608_MKL1_sT_DMSO_R1.fastq.gz, ./20260506_AV243904_0073_A/2701_MKL1_sT_DMSO/2701_MKL1_sT_DMSO_R1.fastq.gz, ./20260506_AV243904_0073_A/2802_MKL1_sT_DMSO/2802_MKL1_sT_DMSO_R1.fastq.gz
     #./20260506_AV243904_0073_A/2608_MKL1_sT_Dox/2608_MKL1_sT_Dox_R1.fastq.gz, ./20260506_AV243904_0073_A/2701_MKL1_sT_Dox/2701_MKL1_sT_Dox_R1.fastq.gz, ./20260506_AV243904_0073_A/2802_MKL1_sT_Dox/2802_MKL1_sT_Dox_R1.fastq.gz
     #./20260506_AV243904_0073_A/2608_MKL1_scr_DMSO/2608_MKL1_scr_DMSO_R1.fastq.gz, ./20260506_AV243904_0073_A/2701_MKL1_scr_DMSO/2701_MKL1_scr_DMSO_R1.fastq.gz, ./20260506_AV243904_0073_A/2802_MKL1_scr_DMSO/2802_MKL1_scr_DMSO_R1.fastq.gz
     #./20260506_AV243904_0073_A/2608_MKL1_scr_Dox/2608_MKL1_scr_Dox_R1.fastq.gz, ./20260506_AV243904_0073_A/2701_MKL1_scr_Dox/2701_MKL1_scr_Dox_R1.fastq.gz, ./20260506_AV243904_0073_A/2802_MKL1_scr_Dox/2802_MKL1_scr_Dox_R1.fastq.gz
  2. Adapter trimming

     #some common adapter sequences from different kits for reference:
     #    - TruSeq Small RNA (Illumina): TGGAATTCTCGGGTGCCAAGG
     #    - Small RNA Kits V1 (Illumina): TCGTATGCCGTCTTCTGCTTGT
     #    - Small RNA Kits V1.5 (Illumina): ATCTCGTATGCCGTCTTCTGCTTG
     #    - NEXTflex Small RNA Sequencing Kit v3 for Illumina Platforms (Bioo Scientific): TGGAATTCTCGGGTGCCAAGG
     #    - LEXOGEN Small RNA-Seq Library Prep Kit (Illumina): TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC *
     mkdir Data_Ute_smallRNA_via_exceRpt_workspace/trimmed; cd Data_Ute_smallRNA_via_exceRpt_workspace/trimmed
    
     echo "------------------------------------ cutadapting nf774 -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o nf774.fastq.gz ~/DATA/Data_Ute/Data_Ute_smallRNA_4/230623_newDemulti_smallRNAs/220617_NB501882_0371_AH7572BGXM_smallRNA_Ute_newDemulti/2022_nf_ute_smallRNA/nf774/0403_WaGa_wt_S1_R1_001.fastq.gz >> LOG
    
     echo "------------------------------------ cutadapting nf657 -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o nf657.fastq.gz ~/DATA/Data_Ute/Data_Ute_smallRNA_4/230623_newDemulti_smallRNAs/210817_NB501882_0294_AHW5Y2BGXJ_smallRNA_Ute_newDemulti/2021_nf_ute_smallRNA/nf657/WaGa_derived_EV_miRNA_S2_R1_001.fastq.gz >> LOG
    
     echo "------------------------------------ cutadapting nf655 -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o nf655.fastq.gz ~/DATA/Data_Ute/Data_Ute_smallRNA_4/230623_newDemulti_smallRNAs/210817_NB501882_0294_AHW5Y2BGXJ_smallRNA_Ute_newDemulti/2021_nf_ute_smallRNA/nf655/MKL_1_derived_EV_miRNA_S1_R1_001.fastq.gz >> LOG
    
     echo "------------------------------------ cutadapting nf780 -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o nf780.fastq.gz ~/DATA/Data_Ute/Data_Ute_smallRNA_4/230623_newDemulti_smallRNAs/220617_NB501882_0371_AH7572BGXM_smallRNA_Ute_newDemulti/2022_nf_ute_smallRNA/nf780/0505_MKL1_wt_S2_R1_001.fastq.gz >> LOG
    
     echo "------------------------------------ cutadapting nf796 -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o nf796.fastq.gz ~/DATA/Data_Ute/Data_Ute_smallRNA_4/230623_newDemulti_smallRNAs/221216_NB501882_0404_AHLVNMBGXM_smallRNA_Ute_newDemulti/2022_nf_ute_smallRNA/nf796/MKL-1_wt_1_S1_R1_001.fastq.gz >> LOG
    
     echo "------------------------------------ cutadapting nf797 -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o nf797.fastq.gz ~/DATA/Data_Ute/Data_Ute_smallRNA_4/230623_newDemulti_smallRNAs/221216_NB501882_0404_AHLVNMBGXM_smallRNA_Ute_newDemulti/2022_nf_ute_smallRNA/nf797/MKL-1_wt_2_S2_R1_001.fastq.gz >> LOG
    
     echo "------------------------------------ cutadapting nf930 -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o nf930.fastq.gz ~/DATA/Data_Ute/Data_Ute_smallRNA_7/231016_NB501882_0435_AHG7HMBGXV/nf930/01_0505_WaGa_wt_EV_RNA_S1_R1_001.fastq.gz >> LOG
    
     echo "------------------------------------ cutadapting nf931 -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o nf931.fastq.gz ~/DATA/Data_Ute/Data_Ute_smallRNA_7/231016_NB501882_0435_AHG7HMBGXV/nf931/02_0505_WaGa_sT_DMSO_EV_RNA_S2_R1_001.fastq.gz >> LOG
    
     echo "------------------------------------ cutadapting nf932 -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o nf932.fastq.gz ~/DATA/Data_Ute/Data_Ute_smallRNA_7/231016_NB501882_0435_AHG7HMBGXV/nf932/03_0505_WaGa_sT_Dox_EV_RNA_S3_R1_001.fastq.gz >> LOG
    
     echo "------------------------------------ cutadapting nf933 -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o nf933.fastq.gz ~/DATA/Data_Ute/Data_Ute_smallRNA_7/231016_NB501882_0435_AHG7HMBGXV/nf933/04_0505_WaGa_scr_DMSO_EV_RNA_S4_R1_001.fastq.gz >> LOG
    
     echo "------------------------------------ cutadapting nf934 -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o nf934.fastq.gz ~/DATA/Data_Ute/Data_Ute_smallRNA_7/231016_NB501882_0435_AHG7HMBGXV/nf934/05_0505_WaGa_scr_Dox_EV_RNA_S5_R1_001.fastq.gz >> LOG
    
     echo "------------------------------------ cutadapting nf935 -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o nf935.fastq.gz ~/DATA/Data_Ute/Data_Ute_smallRNA_7/231016_NB501882_0435_AHG7HMBGXV/nf935/06_1905_WaGa_wt_EV_RNA_S6_R1_001.fastq.gz >> LOG
    
     echo "------------------------------------ cutadapting nf936 -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o nf936.fastq.gz ~/DATA/Data_Ute/Data_Ute_smallRNA_7/231016_NB501882_0435_AHG7HMBGXV/nf936/07_1905_WaGa_sT_DMSO_EV_RNA_S7_R1_001.fastq.gz >> LOG
    
     echo "------------------------------------ cutadapting nf937 -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o nf937.fastq.gz ~/DATA/Data_Ute/Data_Ute_smallRNA_7/231016_NB501882_0435_AHG7HMBGXV/nf937/08_1905_WaGa_sT_Dox_EV_RNA_S8_R1_001.fastq.gz >> LOG
    
     echo "------------------------------------ cutadapting nf938 -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o nf938.fastq.gz ~/DATA/Data_Ute/Data_Ute_smallRNA_7/231016_NB501882_0435_AHG7HMBGXV/nf938/09_1905_WaGa_scr_DMSO_EV_RNA_S9_R1_001.fastq.gz >> LOG
    
     echo "------------------------------------ cutadapting nf939 -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o nf939.fastq.gz ~/DATA/Data_Ute/Data_Ute_smallRNA_7/231016_NB501882_0435_AHG7HMBGXV/nf939/10_1905_WaGa_scr_Dox_EV_RNA_S10_R1_001.fastq.gz >> LOG
    
     echo "------------------------------------ cutadapting nf940 -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o nf940.fastq.gz ~/DATA/Data_Ute/Data_Ute_smallRNA_7/231016_NB501882_0435_AHG7HMBGXV/nf940/11_control_MKL1_S11_R1_001.fastq.gz >> LOG
    
     echo "------------------------------------ cutadapting nf941 -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o nf941.fastq.gz ~/DATA/Data_Ute/Data_Ute_smallRNA_7/231016_NB501882_0435_AHG7HMBGXV/nf941/12_control_WaGa_S12_R1_001.fastq.gz >> LOG
    
     echo "------------------------------------ cutadapting nf961 -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o nf961.fastq.gz ~/DATA/Data_Ute/Data_Ute_smallRNA_7/250411_VH00358_135_AAGKGLHM5/nf961/WaGaWTcells_1_S1_R1_001.fastq.gz >> LOG
    
     echo "------------------------------------ cutadapting nf962 -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o nf962.fastq.gz ~/DATA/Data_Ute/Data_Ute_smallRNA_7/250411_VH00358_135_AAGKGLHM5/nf962/WaGaWTcells_2_S2_R1_001.fastq.gz >> LOG
    
     echo "------------------------------------ cutadapting nf971 -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o nf971.fastq.gz ~/DATA/Data_Ute/Data_Ute_smallRNA_7/250411_VH00358_135_AAGKGLHM5/nf971/2001_WaGa_sT_DMSO_S3_R1_001.fastq.gz >> LOG
    
     echo "------------------------------------ cutadapting nf972 -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o nf972.fastq.gz ~/DATA/Data_Ute/Data_Ute_smallRNA_7/250411_VH00358_135_AAGKGLHM5/nf972/2001_WaGa_sT_Dox_S4_R1_001.fastq.gz >> LOG
    
     echo "------------------------------------ cutadapting nf973 -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o nf973.fastq.gz ~/DATA/Data_Ute/Data_Ute_smallRNA_7/250411_VH00358_135_AAGKGLHM5/nf973/2001_WaGa_scr_DMSO_S5_R1_001.fastq.gz >> LOG
    
     echo "------------------------------------ cutadapting nf974 -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o nf974.fastq.gz ~/DATA/Data_Ute/Data_Ute_smallRNA_7/250411_VH00358_135_AAGKGLHM5/nf974/2001_WaGa_scr_Dox_S6_R1_001.fastq.gz >> LOG
    
     echo "------------------------------------ cutadapting 2404_MKL1_wt_EVs -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o 2404_MKL1_wt_EVs.fastq.gz ~/DATA/Data_Ute_smallRNA/20260506_AV243904_0073_A/2404_MKL1_wt_EVs/2404_MKL1_wt_EVs_R1.fastq.gz >> LOG
    
     echo "------------------------------------ cutadapting 2608_MKL1_wt_EVs -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o 2608_MKL1_wt_EVs.fastq.gz ~/DATA/Data_Ute_smallRNA/20260506_AV243904_0073_A/2608_MKL1_wt_EVs/2608_MKL1_wt_EVs_R1.fastq.gz >> LOG
    
     echo "------------------------------------ cutadapting 2608_MKL1_sT_DMSO -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o 2608_MKL1_sT_DMSO.fastq.gz ~/DATA/Data_Ute_smallRNA/20260506_AV243904_0073_A/2608_MKL1_sT_DMSO/2608_MKL1_sT_DMSO_R1.fastq.gz >> LOG
    
     echo "------------------------------------ cutadapting 2701_MKL1_sT_DMSO -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o 2701_MKL1_sT_DMSO.fastq.gz ~/DATA/Data_Ute_smallRNA/20260506_AV243904_0073_A/2701_MKL1_sT_DMSO/2701_MKL1_sT_DMSO_R1.fastq.gz >> LOG
    
     echo "------------------------------------ cutadapting 2802_MKL1_sT_DMSO -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o 2802_MKL1_sT_DMSO.fastq.gz ~/DATA/Data_Ute_smallRNA/20260506_AV243904_0073_A/2802_MKL1_sT_DMSO/2802_MKL1_sT_DMSO_R1.fastq.gz >> LOG
    
     echo "------------------------------------ cutadapting 2608_MKL1_sT_Dox -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o 2608_MKL1_sT_Dox.fastq.gz ~/DATA/Data_Ute_smallRNA/20260506_AV243904_0073_A/2608_MKL1_sT_Dox/2608_MKL1_sT_Dox_R1.fastq.gz >> LOG
    
     echo "------------------------------------ cutadapting 2701_MKL1_sT_Dox -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o 2701_MKL1_sT_Dox.fastq.gz ~/DATA/Data_Ute_smallRNA/20260506_AV243904_0073_A/2701_MKL1_sT_Dox/2701_MKL1_sT_Dox_R1.fastq.gz >> LOG
    
     echo "------------------------------------ cutadapting 2802_MKL1_sT_Dox -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o 2802_MKL1_sT_Dox.fastq.gz ~/DATA/Data_Ute_smallRNA/20260506_AV243904_0073_A/2802_MKL1_sT_Dox/2802_MKL1_sT_Dox_R1.fastq.gz >> LOG
    
     echo "------------------------------------ cutadapting 2608_MKL1_scr_DMSO -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o 2608_MKL1_scr_DMSO.fastq.gz ~/DATA/Data_Ute_smallRNA/20260506_AV243904_0073_A/2608_MKL1_scr_DMSO/2608_MKL1_scr_DMSO_R1.fastq.gz >> LOG
    
     echo "------------------------------------ cutadapting 2701_MKL1_scr_DMSO -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o 2701_MKL1_scr_DMSO.fastq.gz ~/DATA/Data_Ute_smallRNA/20260506_AV243904_0073_A/2701_MKL1_scr_DMSO/2701_MKL1_scr_DMSO_R1.fastq.gz >> LOG
    
     echo "------------------------------------ cutadapting 2802_MKL1_scr_DMSO -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o 2802_MKL1_scr_DMSO.fastq.gz ~/DATA/Data_Ute_smallRNA/20260506_AV243904_0073_A/2802_MKL1_scr_DMSO/2802_MKL1_scr_DMSO_R1.fastq.gz >> LOG
    
     echo "------------------------------------ cutadapting 2608_MKL1_scr_Dox -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o 2608_MKL1_scr_Dox.fastq.gz ~/DATA/Data_Ute_smallRNA/20260506_AV243904_0073_A/2608_MKL1_scr_Dox/2608_MKL1_scr_Dox_R1.fastq.gz >> LOG
    
     echo "------------------------------------ cutadapting 2701_MKL1_scr_Dox -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o 2701_MKL1_scr_Dox.fastq.gz ~/DATA/Data_Ute_smallRNA/20260506_AV243904_0073_A/2701_MKL1_scr_Dox/2701_MKL1_scr_Dox_R1.fastq.gz >> LOG
    
     echo "------------------------------------ cutadapting 2802_MKL1_scr_Dox -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o 2802_MKL1_scr_Dox.fastq.gz ~/DATA/Data_Ute_smallRNA/20260506_AV243904_0073_A/2802_MKL1_scr_Dox/2802_MKL1_scr_Dox_R1.fastq.gz >> LOG
  3. Install exceRpt (https://github.gersteinlab.org/exceRpt/)

     docker pull rkitchen/excerpt
     mkdir MyexceRptDatabase
     cd /mnt/nvme0n1p1/MyexceRptDatabase
     wget http://org.gersteinlab.excerpt.s3-website-us-east-1.amazonaws.com/exceRptDB_v4_hg38_lowmem.tgz
     tar -xvf exceRptDB_v4_hg38_lowmem.tgz
     #http://org.gersteinlab.excerpt.s3-website-us-east-1.amazonaws.com/exceRptDB_v4_hg19_lowmem.tgz
     #http://org.gersteinlab.excerpt.s3-website-us-east-1.amazonaws.com/exceRptDB_v4_hg38_lowmem.tgz
     #http://org.gersteinlab.excerpt.s3-website-us-east-1.amazonaws.com/exceRptDB_v4_mm10_lowmem.tgz
     wget http://org.gersteinlab.excerpt.s3-website-us-east-1.amazonaws.com/exceRptDB_v4_EXOmiRNArRNA.tgz
     tar -xvf exceRptDB_v4_EXOmiRNArRNA.tgz
     wget http://org.gersteinlab.excerpt.s3-website-us-east-1.amazonaws.com/exceRptDB_v4_EXOGenomes.tgz
     tar -xvf exceRptDB_v4_EXOGenomes.tgz
    
     # List extracted hg38 directory structure
     find hg38 -type f | sed 's|^hg38/||' | sort > extracted_hg38.txt
     comm -3 extracted_hg38.txt <(tar -tf exceRptDB_v4_hg38_lowmem.tgz | grep '^hg38/' | sed 's|^hg38/||' | sort)  # --> DIR hg38
     tar -tf exceRptDB_v4_EXOmiRNArRNA.tgz  # --> DIR ribosomeDatabase, NCBI_taxonomy_taxdump, miRBase
     tar -tf exceRptDB_v4_EXOGenomes.tgz  # --> Genomes_BacteriaFungiMammalPlantProtistVirus
  4. Run exceRpt

     #[---- REAL_RUNNING_COMPLETE_DB ---->]
     #NOTE that if not renamed in the input files, then have to RENAME all files recursively by removing "_cutadapted.fastq" in all names in _CORE_RESULTS_v4.6.3.tgz (first unzip, removing, then zip, mv to ../results_g).
     cd trimmed
     for file in *.fastq.gz; do
         echo "mv \"$file\" \"${file/.fastq/}\""
     done
    
     mkdir results
     for sample in nf780 nf796 nf797  nf655    nf774 nf961 nf962  nf657 nf930 nf935  nf931 nf936 nf971  nf932 nf937 nf972  nf933 nf938 nf973  nf934 nf939 nf974; do
         docker run -v ~/DATA/Data_Ute_smallRNA_via_exceRpt_workspace/trimmed:/exceRptInput \
                    -v ~/DATA/Data_Ute_smallRNA_via_exceRpt_workspace/results:/exceRptOutput \
                   -v /mnt/nvme0n1p1/MyexceRptDatabase:/exceRpt_DB \
                   -t rkitchen/excerpt \
                   INPUT_FILE_PATH=/exceRptInput/${sample}.gz MAIN_ORGANISM_GENOME_ID=hg38 N_THREADS=50 JAVA_RAM='200G' MAP_EXOGENOUS=on
     done
    
     for sample in 2404_MKL1_wt_EVs 2608_MKL1_wt_EVs    2608_MKL1_sT_DMSO 2701_MKL1_sT_DMSO 2802_MKL1_sT_DMSO    2608_MKL1_sT_Dox 2701_MKL1_sT_Dox 2802_MKL1_sT_Dox    2608_MKL1_scr_DMSO 2701_MKL1_scr_DMSO 2802_MKL1_scr_DMSO    2608_MKL1_scr_Dox 2701_MKL1_scr_Dox 2802_MKL1_scr_Dox; do
         docker run -v ~/DATA/Data_Ute_smallRNA_via_exceRpt_workspace/trimmed:/exceRptInput \
                    -v ~/DATA/Data_Ute_smallRNA_via_exceRpt_workspace/results:/exceRptOutput \
                   -v /mnt/nvme3n1p1/MyexceRptDatabase:/exceRpt_DB \
                   -t rkitchen/excerpt \
                   INPUT_FILE_PATH=/exceRptInput/${sample}.gz MAIN_ORGANISM_GENOME_ID=hg38 N_THREADS=50 JAVA_RAM='200G' MAP_EXOGENOUS=on
     done
    
     #DEBUG the excerpt env
     docker inspect rkitchen/excerpt:latest
     # Without /bin/bash → May run and exit immediately
     #docker run -it rkitchen/excerpt
     # With /bin/bash → Stays open for interaction
     docker run -it --entrypoint /bin/bash rkitchen/excerpt
  5. Processing exceRpt output from multiple samples

     cd ~/DATA/Data_Ute_smallRNA_via_exceRpt_workspace/exceRpt-master
     mamba activate r_env
     mamba install -c conda-forge -c bioconda \
         bioconductor-marray \
         bioconductor-rgraphviz \
         r-plyr r-gplots r-reshape2 r-ggplot2 r-scales r-openxlsx r-rcurl r-xml \
         -y
     mamba install -c conda-forge -c bioconda \
         r-plyr r-gplots r-reshape2 r-ggplot2 r-scales r-openxlsx \
         bioconductor-marray bioconductor-rgraphviz \
         -y
    
     #mkdir summaries heatmap_all_WaGa+4_MKL-1
     mkdir results_WaGa_EXCLUDED results_MKL-1 summaries_WaGa summaries_MKL-1 heatmap_WaGa heatmap_MKL-1
     #! EXCLUDE some isolates since they have total different pattern or due to bad quality --> outliner, until now only one sample, namely nf657 from WaGa wt EV:
     sudo mv results/nf657* results_WaGa_EXCLUDED/
     sudo mv results/nf780* results_MKL-1/
     sudo mv results/nf796* results_MKL-1/
     sudo mv results/nf797* results_MKL-1/
     sudo mv results/nf655* results_MKL-1/
     for sample in 2404_MKL1_wt_EVs 2608_MKL1_wt_EVs    2608_MKL1_sT_DMSO 2701_MKL1_sT_DMSO 2802_MKL1_sT_DMSO    2608_MKL1_sT_Dox 2701_MKL1_sT_Dox 2802_MKL1_sT_Dox    2608_MKL1_scr_DMSO 2701_MKL1_scr_DMSO 2802_MKL1_scr_DMSO    2608_MKL1_scr_Dox 2701_MKL1_scr_Dox 2802_MKL1_scr_Dox; do
         echo "sudo mv results/${sample}* results_MKL-1/"
     done
     #Following our initial QC, I noticed that one of the MKL-1 wt-EV samples (nf655) is a clear outlier, clustering far apart from the other two wt-EV replicates in the PCoA plots. I recommend removing nf655 from the downstream MKL-1 analysis, which is similar to our earlier analysis for MKL-1, in which we removed the outlier nf657. Please see the attached figures for reference.
     mv results_MKL-1/nf655* results_MKL-1_EXCLUDED/
    
     (r_env) jhuang@WS-2290C:~/DATA/Data_Ute_smallRNA_via_exceRpt_workspace/exceRpt-master$ R
     #WARNING: need to reload the R-script after each change of the script.
     source("mergePipelineRuns_functions.R")
     processSamplesInDir("../results_WaGa/", "../summaries_WaGa")
     processSamplesInDir("../results_MKL-1/", "../summaries_MKL-1")
    
     #mkdir heatmap_WaGa; cp summaries_WaGa/*.RData heatmap_WaGa; rm heatmap_WaGa/exceRpt_sampleGroupDefinitions.txt;
     source("mergePipelineRuns_functions_addSampleGroupInfo_WaGa.R")
     processSamplesInDir("../results_WaGa/", "../heatmap_WaGa")
    
     #mkdir heatmap_MKL-1; cp summaries_MKL-1/*.RData heatmap_MKL-1; rm heatmap_MKL-1/exceRpt_sampleGroupDefinitions.txt;
     source("mergePipelineRuns_functions_addSampleGroupInfo_MKL-1.R")
     processSamplesInDir("../results_MKL-1/", "../heatmap_MKL-1")
    
     #!!!!! IMPORTANT: REPORT heatmap_MKL-1/exceRpt_DiagnosticPlots.pdf and heatmap_MKL-1/mapping_heatmap3.pdf (They are almost the same, mapping_heatmap3.pdf is better due to bigger font size) !!!!
     #CONSIDERING_TO_DEL_nf774 since it is very far to another two samples (MAYBE BETTER NOT DO THIS, SINCE I HAVE TO GENERATE PCA- and MANHATTAN PLOTS!!): now the sample nf774 was kept in the WaGa results.
    
     #~/Tools/csv2xls-0.4/csv_to_xls.py exceRpt_miRNA_ReadsPerMillion.txt exceRpt_tRNA_ReadsPerMillion.txt exceRpt_piRNA_ReadsPerMillion.txt -d$'\t' -o exceRpt_results_detailed.xls
    
     # Report summaries_WaGa/exceRpt_mapping_heatmaps_WaGa.xlsx or summaries_MKL-1/exceRpt_mapping_heatmaps_MKL-1.xlsx;
     #        summaries_WaGa/exceRpt_results_detailed_WaGa.xls or summaries_MKL-1/exceRpt_results_detailed_MKL-1.xls;
     #        heatmap_WaGa/mapping_heatmap3_WaGa.pdf or heatmap_MKL-1/mapping_heatmap3_MKL-1.pdf
  6. Downstream analyis using R for miRNAs (17 WaGa samples)

     #Input file
     #exceRpt_miRNA_ReadCounts.txt
     #exceRpt_piRNA_ReadCounts.txt
    
     ## WaGa experimental groups (scr = scramble control; sT = target knockdown)
     #WaGa_scr_DMSO_EV (nf933, nf938, nf973)
     #WaGa_scr_Dox_EV (nf934, nf939, nf974)
     #WaGa_sT_DMSO_EV (nf931, nf936, nf971)
     #WaGa_sT_Dox_EV (nf932, nf937, nf972)
     #
     ## WaGa wild-type controls
     #WaGa_wt_cells (nf774, nf961, nf962)
     #WaGa_wt_EV (nf930, nf935)
    
     cd ~/DATA/Data_Ute_smallRNA_via_exceRpt_workspace/summaries_WaGa
     mamba activate r_env
     R
    
     #BiocManager::install("AnnotationDbi")
     #BiocManager::install("clusterProfiler")
     #BiocManager::install(c("ReactomePA","org.Hs.eg.db"))
     #BiocManager::install("limma")
     #BiocManager::install("sva")
     #install.packages("writexl")
     #install.packages("openxlsx")
     library("AnnotationDbi")
     library("clusterProfiler")
     library("ReactomePA")
     library("org.Hs.eg.db")
     library(DESeq2)
     library(gplots)
     library(limma)
     library(sva)
     #library(writexl)  #d.raw_with_rownames <- cbind(RowNames = rownames(d.raw), d.raw); write_xlsx(d.raw, path = "d_raw.xlsx");
     library(openxlsx)
    
     d.raw<- read.delim2("exceRpt_miRNA_ReadCounts.txt",sep="\t", header=TRUE, row.names=1)
    
     # Desired column order
     desired_order <- c(
         "nf933", "nf938", "nf973",
         "nf934", "nf939", "nf974",
         "nf931", "nf936", "nf971",
         "nf932", "nf937", "nf972",
         "nf774", "nf961", "nf962",
         "nf930", "nf935"
     )
    
     # Reorder columns
     d.raw <- d.raw[, desired_order]
     setdiff(desired_order, colnames(d.raw))  # Shows missing or misnamed columns
     #sapply(d.raw, is.numeric)
     d.raw[] <- lapply(d.raw, as.numeric)
     #d.raw[] <- lapply(d.raw, function(x) as.numeric(as.character(x)))
     d.raw <- round(d.raw)
     write.csv(d.raw, file ="d_raw.csv")
     write.xlsx(d.raw, file = "d_raw.xlsx", rowNames = TRUE)
    
     # ------ Code sent to Ute ------
     #d.raw <- read.delim2("d_raw.csv",sep=",", header=TRUE, row.names=1)
     Cell_or_EV = as.factor(c("EV","EV","EV",  "EV","EV","EV",  "EV","EV","EV",  "EV","EV","EV",  "Cell","Cell","Cell",  "EV","EV"))
     replicates = as.factor(c("WaGa_scr_DMSO_EV","WaGa_scr_DMSO_EV","WaGa_scr_DMSO_EV",     "WaGa_scr_Dox_EV","WaGa_scr_Dox_EV","WaGa_scr_Dox_EV",  "WaGa_sT_DMSO_EV","WaGa_sT_DMSO_EV","WaGa_sT_DMSO_EV",  "WaGa_sT_Dox_EV","WaGa_sT_Dox_EV","WaGa_sT_Dox_EV",  "WaGa_wt_cells", "WaGa_wt_cells","WaGa_wt_cells",  "WaGa_wt_EV", "WaGa_wt_EV"))
     ids = as.factor(c(
         "nf933", "nf938", "nf973",
         "nf934", "nf939", "nf974",
         "nf931", "nf936", "nf971",
         "nf932", "nf937", "nf972",
         "nf774", "nf961", "nf962",
         "nf930", "nf935"))
     cData = data.frame(row.names=colnames(d.raw), replicates=replicates, ids=ids, Cell_or_EV=Cell_or_EV)
     dds<-DESeqDataSetFromMatrix(countData=d.raw, colData=cData, design=~replicates)
    
     # Filter low-count miRNAs
     dds <- dds[ rowSums(counts(dds)) > 10, ]
     rld <- rlogTransformation(dds)
    
     # -- before pca --
     png("pca.png", 1200, 800)
     plotPCA(rld, intgroup=c("replicates"))
     #plotPCA(rld, intgroup = c("replicates", "batch"))
     #plotPCA(rld, intgroup = c("replicates", "ids"))
     #plotPCA(rld, "batch")
     dev.off()
     png("pca2.png", 1200, 800)
     #plotPCA(rld, intgroup=c("replicates"))
     #plotPCA(rld, intgroup = c("replicates", "batch"))
     plotPCA(rld, intgroup = c("replicates", "ids"))
     #plotPCA(rld, "batch")
     dev.off()
    
     # Batch Effect Removal Methods (Non-batch effect removal applied!)
    
     #### STEP2: DEGs ####
     #- Heatmap untreated/wt vs parental; 1x for WaGa cell line
     #- Volcano plot untreated/wt vs parental; 1x for WaGa cell line
     #- Manhattan plot miRNAs; 1x for WaGa cell line
     #- Distribution of different small RNA species untreated/wt and parental; 1x for WaGa cell line
     #- Motif analysis: identify RNA-binding proteins that may regulate small RNA loading; 1x for WaGa cell line
    
     #convert bam to bigwig using deepTools by feeding inverse of DESeq’s size Factor
     sizeFactors(dds)
     #NULL
     dds <- estimateSizeFactors(dds)
     sizeFactors(dds)
     normalized_counts <- counts(dds, normalized=TRUE)
     write.table(normalized_counts, file="normalized_counts.txt", sep="\t", quote=F, col.names=NA)
     write.xlsx(normalized_counts, file = "normalized_counts.xlsx", rowNames = TRUE)
    
     dds<-DESeqDataSetFromMatrix(countData=d.raw, colData=cData, design=~replicates)
    
     dds$replicates <- relevel(dds$replicates, "WaGa_wt_cells")
     dds = DESeq(dds, betaPrior=FALSE)  #default betaPrior is FALSE
     resultsNames(dds)
     clist <- c("WaGa_wt_EV_vs_WaGa_wt_cells")
    
     #NOTE that the results sent to Ute is |padj|<=0.1.
     for (i in clist) {
         contrast = paste("replicates", i, sep="_")
         res = results(dds, name=contrast)
         res <- res[!is.na(res$log2FoldChange),]
         #https://bioconductor.org/packages/release/bioc/vignettes/DESeq2/inst/doc/DESeq2.html#why-are-some-p-values-set-to-na
         res$padj <- ifelse(is.na(res$padj), 1, res$padj)
         res_df <- as.data.frame(res)
         write.csv(as.data.frame(res_df[order(res_df$pvalue),]), file = paste(i, "all.txt", sep="-"))
         up <- subset(res_df, padj<=0.05 & log2FoldChange>=2)
         down <- subset(res_df, padj<=0.05 & log2FoldChange<=-2)
         write.csv(as.data.frame(up[order(up$log2FoldChange,decreasing=TRUE),]), file = paste(i, "up.txt", sep="-"))
         write.csv(as.data.frame(down[order(abs(down$log2FoldChange),decreasing=TRUE),]), file = paste(i, "down.txt", sep="-"))
     }
    
     ~/Tools/csv2xls-0.4/csv_to_xls.py \
     WaGa_wt_EV_vs_WaGa_wt_cells-all.txt \
     WaGa_wt_EV_vs_WaGa_wt_cells-up.txt \
     WaGa_wt_EV_vs_WaGa_wt_cells-down.txt \
     -d$',' -o WaGa_wt_EV_vs_WaGa_wt_cells.xls;
    
     # ------------------- volcano_plot -------------------
     library(ggplot2)
     library(ggrepel)
    
     geness_res <- read.csv(file = paste("WaGa_wt_EV_vs_WaGa_wt_cells", "all.txt", sep="-"), row.names=1)
    
     external_gene_name <- rownames(geness_res)
     geness_res <- cbind(geness_res, external_gene_name)
     #top_g are from ids
     top_g <- c("hsa-let-7b-5p","hsa-let-7g-5p","hsa-let-7i-5p","hsa-miR-103a-3p","hsa-miR-107","hsa-miR-1224-5p","hsa-miR-122-5p","hsa-miR-1226-5p","hsa-miR-1246","hsa-miR-127-3p","hsa-miR-1290","hsa-miR-130a-3p","hsa-miR-139-3p","hsa-miR-141-3p","hsa-miR-143-3p","hsa-miR-148b-3p","hsa-miR-155-5p","hsa-miR-15a-5p","hsa-miR-17-5p","hsa-miR-184","hsa-miR-18a-3p","hsa-miR-18a-5p","hsa-miR-190a-5p","hsa-miR-191-5p","hsa-miR-193b-5p","hsa-miR-197-5p","hsa-miR-200a-3p","hsa-miR-200b-5p","hsa-miR-206","hsa-miR-20a-5p","hsa-miR-210-3p","hsa-miR-2110","hsa-miR-21-5p","hsa-miR-218-5p","hsa-miR-219a-1-3p","hsa-miR-221-3p","hsa-miR-23b-3p","hsa-miR-27a-3p","hsa-miR-27b-3p","hsa-miR-27b-5p","hsa-miR-28-3p","hsa-miR-30a-5p","hsa-miR-30c-5p","hsa-miR-30e-5p","hsa-miR-3127-5p","hsa-miR-3131","hsa-miR-3180|hsa-miR-3180-3p","hsa-miR-320a","hsa-miR-320b","hsa-miR-320c","hsa-miR-320d","hsa-miR-330-3p","hsa-miR-335-3p","hsa-miR-33b-5p","hsa-miR-340-5p","hsa-miR-342-5p","hsa-miR-3605-5p","hsa-miR-361-3p","hsa-miR-365a-5p","hsa-miR-374b-5p","hsa-miR-378i","hsa-miR-379-5p","hsa-miR-3940-5p","hsa-miR-409-3p","hsa-miR-411-5p","hsa-miR-423-3p","hsa-miR-423-5p","hsa-miR-4286","hsa-miR-429","hsa-miR-432-5p","hsa-miR-4326","hsa-miR-451a","hsa-miR-4520-3p","hsa-miR-454-3p","hsa-miR-4646-5p","hsa-miR-4667-5p","hsa-miR-4748","hsa-miR-483-5p","hsa-miR-486-5p","hsa-miR-5010-5p","hsa-miR-504-3p","hsa-miR-5187-5p","hsa-miR-590-3p","hsa-miR-6128","hsa-miR-625-5p","hsa-miR-6726-5p","hsa-miR-6730-5p","hsa-miR-676-3p","hsa-miR-6767-5p","hsa-miR-6777-5p","hsa-miR-6780a-5p","hsa-miR-6794-5p","hsa-miR-6817-3p","hsa-miR-708-5p","hsa-miR-7-5p","hsa-miR-766-5p","hsa-miR-7854-3p","hsa-miR-873-3p","hsa-miR-885-3p","hsa-miR-92b-5p","hsa-miR-93-5p","hsa-miR-937-3p","hsa-miR-9-5p","hsa-miR-98-5p")
     subset(geness_res, external_gene_name %in% top_g & pvalue < 0.05 & (abs(geness_res$log2FoldChange) >= 2.0))
     geness_res$Color <- "NS or log2FC < 2.0"
     geness_res$Color[geness_res$pvalue < 0.05] <- "P < 0.05"
     geness_res$Color[geness_res$padj < 0.05] <- "P-adj < 0.05"
     geness_res$Color[abs(geness_res$log2FoldChange) < 2.0] <- "NS or log2FC < 2.0"
    
     write.csv(geness_res, "WaGa_wt_EV_vs_WaGa_wt_cells_with_Category.csv")
     geness_res$invert_P <- (-log10(geness_res$pvalue)) * sign(geness_res$log2FoldChange)
    
     geness_res <- geness_res[, -1*ncol(geness_res)]
     png("WaGa_wt_EV_vs_WaGa_wt_cells.png",width=1200, height=1400)
     #svg("WaGa_wt_EV_vs_WaGa_wt_cells.svg",width=12, height=14)
     ggplot(geness_res,       aes(x = log2FoldChange, y = -log10(pvalue),           color = Color, label = external_gene_name)) +       geom_vline(xintercept = c(2.0, -2.0), lty = "dashed") +       geom_hline(yintercept = -log10(0.05), lty = "dashed") +       geom_point() +       labs(x = "log2(FC)", y = "Significance, -log10(P)", color = "Significance") +       scale_color_manual(values = c("P < 0.05"="orange","P-adj < 0.05"="red","NS or log2FC < 2.0"="darkgray"),guide = guide_legend(override.aes = list(size = 4))) + scale_y_continuous(expand = expansion(mult = c(0,0.05))) +       geom_text_repel(data = subset(geness_res, external_gene_name %in% top_g & pvalue < 0.05 & (abs(geness_res$log2FoldChange) >= 2.0)), size = 4, point.padding = 0.15, color = "black", min.segment.length = .1, box.padding = .2, lwd = 2) +       theme_bw(base_size = 16) +       theme(legend.position = "bottom")
     dev.off()
    
     # ----------------------------------------
     # ----------- manhattan_plot -------------
    
     Rscript manhattan_plot_Carmen_custom_labels.R  #exceRpt_miRNA_ReadCounts.txt
  7. Downstream analyis using R for miRNAs (17 MKL-1 samples)

     #Input file
     #exceRpt_miRNA_ReadCounts.txt
     #exceRpt_piRNA_ReadCounts.txt
    
     #MKL-1_sT_DMSO_EV ("X2608_MKL1_sT_DMSO","X2701_MKL1_sT_DMSO","X2802_MKL1_sT_DMSO")
     #MKL-1_sT_Dox_EV ("X2608_MKL1_sT_Dox","X2701_MKL1_sT_Dox","X2802_MKL1_sT_Dox")
     #MKL-1_scr_DMSO_EV ("X2608_MKL1_scr_DMSO","X2701_MKL1_scr_DMSO","X2802_MKL1_scr_DMSO")
     #MKL-1_scr_Dox_EV ()"X2608_MKL1_scr_Dox","X2701_MKL1_scr_Dox","X2802_MKL1_scr_Dox")
     #MKL-1_wt_cells ("nf780","nf796","nf797")
     #MKL-1_wt_EV ("X2404_MKL1_wt_EVs","X2608_MKL1_wt_EVs")
    
     cd ~/DATA/Data_Ute_smallRNA_via_exceRpt_workspace/summaries_MKL-1
     mamba activate r_env
     R
    
     #BiocManager::install("AnnotationDbi")
     #BiocManager::install("clusterProfiler")
     #BiocManager::install(c("ReactomePA","org.Hs.eg.db"))
     #BiocManager::install("limma")
     #BiocManager::install("sva")
     #install.packages("writexl")
     #install.packages("openxlsx")
     library("AnnotationDbi")
     library("clusterProfiler")
     library("ReactomePA")
     library("org.Hs.eg.db")
     library(DESeq2)
     library(gplots)
     library(limma)
     library(sva)
     #library(writexl)  #d.raw_with_rownames <- cbind(RowNames = rownames(d.raw), d.raw); write_xlsx(d.raw, path = "d_raw.xlsx");
     library(openxlsx)
    
     d.raw<- read.delim2("exceRpt_miRNA_ReadCounts.txt",sep="\t", header=TRUE, row.names=1)
    
     # Desired column order
     desired_order <- c(
         "X2608_MKL1_sT_DMSO","X2701_MKL1_sT_DMSO","X2802_MKL1_sT_DMSO", "X2608_MKL1_sT_Dox","X2701_MKL1_sT_Dox","X2802_MKL1_sT_Dox", "X2608_MKL1_scr_DMSO","X2701_MKL1_scr_DMSO","X2802_MKL1_scr_DMSO", "X2608_MKL1_scr_Dox","X2701_MKL1_scr_Dox","X2802_MKL1_scr_Dox",
         "nf780","nf796","nf797", "X2404_MKL1_wt_EVs","X2608_MKL1_wt_EVs"
     )
    
     # Reorder columns
     d.raw <- d.raw[, desired_order]
     setdiff(desired_order, colnames(d.raw))  # Shows missing or misnamed columns
     #sapply(d.raw, is.numeric)
     d.raw[] <- lapply(d.raw, as.numeric)
     #d.raw[] <- lapply(d.raw, function(x) as.numeric(as.character(x)))
     d.raw <- round(d.raw)
     write.csv(d.raw, file ="d_raw.csv")
     write.xlsx(d.raw, file = "d_raw.xlsx", rowNames = TRUE)
    
     #d.raw <- read.delim2("d_raw.csv",sep=",", header=TRUE, row.names=1)
     Cell_or_EV = as.factor(c("EV","EV","EV",  "EV","EV","EV",  "EV","EV","EV",  "EV","EV","EV",  "Cell","Cell","Cell",  "EV","EV"))
     replicates = as.factor(c("MKL-1_sT_DMSO_EV","MKL-1_sT_DMSO_EV","MKL-1_sT_DMSO_EV",     "MKL-1_sT_Dox_EV","MKL-1_sT_Dox_EV","MKL-1_sT_Dox_EV",  "MKL-1_scr_DMSO_EV","MKL-1_scr_DMSO_EV","MKL-1_scr_DMSO_EV",  "MKL-1_scr_Dox_EV","MKL-1_scr_Dox_EV","MKL-1_scr_Dox_EV",    "MKL-1_wt_cells", "MKL-1_wt_cells","MKL-1_wt_cells",  "MKL-1_wt_EV","MKL-1_wt_EV"))
     ids = as.factor(c("X2608_MKL1_sT_DMSO","X2701_MKL1_sT_DMSO","X2802_MKL1_sT_DMSO", "X2608_MKL1_sT_Dox","X2701_MKL1_sT_Dox","X2802_MKL1_sT_Dox", "X2608_MKL1_scr_DMSO","X2701_MKL1_scr_DMSO","X2802_MKL1_scr_DMSO", "X2608_MKL1_scr_Dox","X2701_MKL1_scr_Dox","X2802_MKL1_scr_Dox",
         "nf780","nf796","nf797", "X2404_MKL1_wt_EVs","X2608_MKL1_wt_EVs"))
     cData = data.frame(row.names=colnames(d.raw), replicates=replicates, ids=ids, Cell_or_EV=Cell_or_EV)
     dds<-DESeqDataSetFromMatrix(countData=d.raw, colData=cData, design=~replicates)
    
     # Filter low-count miRNAs
     dds <- dds[ rowSums(counts(dds)) > 10, ]
     rld <- rlogTransformation(dds)
    
     # -- before pca --
     png("pca.png", 1200, 800)
     plotPCA(rld, intgroup=c("replicates"))
     #plotPCA(rld, intgroup = c("replicates", "batch"))
     #plotPCA(rld, intgroup = c("replicates", "ids"))
     #plotPCA(rld, "batch")
     dev.off()
     png("pca2.png", 1200, 800)
     #plotPCA(rld, intgroup=c("replicates"))
     #plotPCA(rld, intgroup = c("replicates", "batch"))
     plotPCA(rld, intgroup = c("replicates", "ids"))
     #plotPCA(rld, "batch")
     dev.off()
    
     # Batch Effect Removal Methods (Non-batch effect removal applied!)
    
     #### STEP2: DEGs ####
     #- Heatmap untreated/wt vs parental; 1x for WaGa cell line
     #- Volcano plot untreated/wt vs parental; 1x for WaGa cell line
     #- Manhattan plot miRNAs; 1x for WaGa cell line
     #- Distribution of different small RNA species untreated/wt and parental; 1x for WaGa cell line
     #- Motif analysis: identify RNA-binding proteins that may regulate small RNA loading; 1x for WaGa cell line
    
     #convert bam to bigwig using deepTools by feeding inverse of DESeq’s size Factor
     sizeFactors(dds)
     #NULL
     dds <- estimateSizeFactors(dds)
     sizeFactors(dds)
     normalized_counts <- counts(dds, normalized=TRUE)
     write.table(normalized_counts, file="normalized_counts.txt", sep="\t", quote=F, col.names=NA)
     write.xlsx(normalized_counts, file = "normalized_counts.xlsx", rowNames = TRUE)
    
     dds<-DESeqDataSetFromMatrix(countData=d.raw, colData=cData, design=~replicates)
    
     dds$replicates <- relevel(dds$replicates, "MKL-1_wt_cells")
     dds = DESeq(dds, betaPrior=FALSE)  #default betaPrior is FALSE
     resultsNames(dds)
     clist <- c("MKL.1_wt_EV_vs_MKL.1_wt_cells")
    
     #NOTE that the results sent to Ute is |padj|<=0.1.
     for (i in clist) {
         contrast = paste("replicates", i, sep="_")
         res = results(dds, name=contrast)
         res <- res[!is.na(res$log2FoldChange),]
         #https://bioconductor.org/packages/release/bioc/vignettes/DESeq2/inst/doc/DESeq2.html#why-are-some-p-values-set-to-na
         res$padj <- ifelse(is.na(res$padj), 1, res$padj)
         res_df <- as.data.frame(res)
         write.csv(as.data.frame(res_df[order(res_df$pvalue),]), file = paste(i, "all.txt", sep="-"))
         up <- subset(res_df, padj<=0.05 & log2FoldChange>=2)
         down <- subset(res_df, padj<=0.05 & log2FoldChange<=-2)
         write.csv(as.data.frame(up[order(up$log2FoldChange,decreasing=TRUE),]), file = paste(i, "up.txt", sep="-"))
         write.csv(as.data.frame(down[order(abs(down$log2FoldChange),decreasing=TRUE),]), file = paste(i, "down.txt", sep="-"))
     }
    
     ~/Tools/csv2xls-0.4/csv_to_xls.py \
     MKL.1_wt_EV_vs_MKL.1_wt_cells-all.txt \
     MKL.1_wt_EV_vs_MKL.1_wt_cells-up.txt \
     MKL.1_wt_EV_vs_MKL.1_wt_cells-down.txt \
     -d$',' -o MKL.1_wt_EV_vs_MKL.1_wt_cells.xls;
    
     # ------------------- volcano_plot -------------------
     library(ggplot2)
     library(ggrepel)
    
     geness_res <- read.csv(file = paste("MKL.1_wt_EV_vs_MKL.1_wt_cells", "all.txt", sep="-"), row.names=1)
    
     external_gene_name <- rownames(geness_res)
     geness_res <- cbind(geness_res, external_gene_name)
     #top_g are from ids
    
     top_g <- c("hsa-miR-203a-3p","hsa-miR-6850-5p","hsa-miR-4511","hsa-miR-5187-5p","hsa-miR-133b","hsa-miR-1246","hsa-miR-625-3p","hsa-miR-6741-3p","hsa-miR-192-5p","hsa-miR-10b-5p","hsa-miR-885-5p","hsa-miR-30e-3p","hsa-miR-101-3p","hsa-miR-1307-5p","hsa-miR-95-3p","hsa-miR-889-3p","hsa-miR-206","hsa-miR-301a-3p","hsa-miR-1-3p","hsa-let-7c-5p","hsa-miR-196a-5p","hsa-let-7f-5p","hsa-let-7e-5p","hsa-miR-30c-5p","hsa-miR-30a-3p","hsa-miR-146b-5p","hsa-miR-25-3p","hsa-miR-182-5p","hsa-miR-98-5p","hsa-let-7a-5p","hsa-miR-149-5p","hsa-miR-148a-3p","hsa-miR-873-3p","hsa-miR-19b-3p","hsa-miR-320c","hsa-miR-375","hsa-miR-30a-5p","hsa-miR-877-5p","hsa-miR-34a-5p","hsa-miR-324-5p","hsa-miR-652-3p","hsa-miR-342-5p","hsa-miR-7706","hsa-miR-361-3p","hsa-miR-361-5p","hsa-miR-1180-3p","hsa-miR-217","hsa-miR-1307-3p","hsa-miR-1908-5p","hsa-miR-15b-5p","hsa-miR-92b-5p","hsa-miR-484","hsa-miR-197-3p","hsa-miR-200c-3p","hsa-miR-671-5p","hsa-miR-339-5p","hsa-miR-1301-3p","hsa-miR-769-5p","hsa-miR-328-3p","hsa-miR-93-5p","hsa-miR-103a-3p")
     subset(geness_res, external_gene_name %in% top_g & pvalue < 0.05 & (abs(geness_res$log2FoldChange) >= 2.0))
     geness_res$Color <- "NS or log2FC < 2.0"
     geness_res$Color[geness_res$pvalue < 0.05] <- "P < 0.05"
     geness_res$Color[geness_res$padj < 0.05] <- "P-adj < 0.05"
     geness_res$Color[abs(geness_res$log2FoldChange) < 2.0] <- "NS or log2FC < 2.0"
    
     write.csv(geness_res, "MKL.1_wt_EV_vs_MKL.1_wt_cells_with_Category.csv")
     geness_res$invert_P <- (-log10(geness_res$pvalue)) * sign(geness_res$log2FoldChange)
    
     geness_res <- geness_res[, -1*ncol(geness_res)]
     png("MKL.1_wt_EV_vs_MKL.1_wt_cells.png",width=1200, height=1400)
     #svg("MKL.1_wt_EV_vs_MKL.1_wt_cells.svg",width=12, height=14)
     ggplot(geness_res,       aes(x = log2FoldChange, y = -log10(pvalue),           color = Color, label = external_gene_name)) +       geom_vline(xintercept = c(2.0, -2.0), lty = "dashed") +       geom_hline(yintercept = -log10(0.05), lty = "dashed") +       geom_point() +       labs(x = "log2(FC)", y = "Significance, -log10(P)", color = "Significance") +       scale_color_manual(values = c("P < 0.05"="orange","P-adj < 0.05"="red","NS or log2FC < 2.0"="darkgray"),guide = guide_legend(override.aes = list(size = 4))) + scale_y_continuous(expand = expansion(mult = c(0,0.05))) +       geom_text_repel(data = subset(geness_res, external_gene_name %in% top_g & pvalue < 0.05 & (abs(geness_res$log2FoldChange) >= 2.0)), size = 4, point.padding = 0.15, color = "black", min.segment.length = .1, box.padding = .2, lwd = 2) +       theme_bw(base_size = 16) +       theme(legend.position = "bottom")
     dev.off()
    
     # ----------------------------------------
     # ----------- manhattan_plot -------------
    
     Rscript manhattan_plot_Carmen_custom_labels.R  #exceRpt_miRNA_ReadCounts.txt

Until now, done and sent!

  • Raw count data (d_raw_MKL-1.xlsx): Contains the raw, unnormalized read counts for all miRNAs.
  • Mapping heatmap (mapping_heatmap3_MKL-1.pdf)
  • Volcano plot (MKL.1_wt_EV_vs_MKL.1_wt_cells.png and .svg)
  • PCA plot (pca_MKL-1.png)
  • Manhattan plot and data (manhattan_plot_MKL1_vs_EV.png, .svg, and manhattan_plot_MKL1_data.xlsx)
  1. Draw distribution_heatmap.png for MKL-1 samples sent afterwards

     # -- R-code --
    
         # Load required library
         library(dplyr)
         library(openxlsx)
    
         # The numbers are extracted manually from summaries_MKL-1/mapping_heatmap3.pdf with the samples ordered by
         #    sampleID   sampleGroup sampleGroup2
         #    nf780  MKL-1 wt cells  "parental_cells_1"
         #    nf796  MKL-1 wt cells  "parental_cells_2"
         #    nf797  MKL-1 wt cells  "parental_cells_3"
         #    2608_MKL1_sT_Dox   MKL-1 sT Dox EV "sT_Dox_1"
         #    2701_MKL1_scr_DMSO MKL-1 scr DMSO EV   "scr_DMSO_1"
         #    2701_MKL1_sT_DMSO  MKL-1 sT DMSO EV    "sT_DMSO_1"
         #    2608_MKL1_sT_DMSO  MKL-1 sT DMSO EV    "sT_DMSO_2"
         #    2701_MKL1_scr_Dox  MKL-1 scr Dox EV    "scr_Dox_1"
         #    2404_MKL1_wt_EVs   MKL-1 wt EV "untreated_1"
         #    2608_MKL1_wt_EVs   MKL-1 wt EV "untreated_2"
         #    2701_MKL1_sT_Dox   MKL-1 sT Dox EV "sT_Dox_2"
         #    2608_MKL1_scr_DMSO MKL-1 scr DMSO EV   "scr_DMSO_2"
         #    2608_MKL1_scr_Dox  MKL-1 scr Dox EV    "scr_Dox_2"
         #    2802_MKL1_scr_DMSO MKL-1 scr DMSO EV   "scr_DMSO_3"
         #    2802_MKL1_sT_DMSO  MKL-1 sT DMSO EV    "sT_DMSO_3"
         #    2802_MKL1_scr_Dox  MKL-1 scr Dox EV    "scr_Dox_3"
         #    2802_MKL1_sT_Dox   MKL-1 sT Dox EV "sT_Dox_3"
    
         # Original data matrix (Note that the following is the complete table including tRNA_sense and tRNA_antisense ..., the code summing the sense and antisense numbers and resulting in total numbers)
         data_orig <- matrix(c(100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0,
             97.9, 94.4, 94.0, 43.1, 42.5, 47.1, 44.7, 44.5, 59.5, 56.6, 54.5, 54.9, 55.1, 71.0, 65.3, 67.0, 66.5,
             1.9, 1.6, 1.0, 27.6, 29.0, 34.3, 30.5, 30.1, 43.9, 42.9, 39.5, 40.0, 40.9, 54.4, 48.8, 52.1, 52.5,
             0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
             0.1, 0.1, 0.0, 0.1, 0.1, 0.1, 0.0, 0.0, 0.1, 0.1, 0.1, 0.0, 0.0, 0.0, 0.1, 0.1, 0.0,
             0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
             0.2, 12.0, 10.7, 1.9, 1.8, 1.7, 1.9, 2.0, 3.2, 2.7, 1.9, 2.6, 2.6, 2.3, 2.3, 1.8, 2.0,
             0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
             0.0, 0.1, 0.0, 0.2, 0.3, 0.3, 0.4, 0.3, 0.7, 0.4, 0.5, 0.7, 0.3, 0.5, 0.5, 0.5, 0.4,
             0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
             88.5, 71.9, 67.5, 6.6, 5.9, 6.0, 6.6, 6.5, 7.7, 6.4, 7.4, 6.6, 6.5, 10.7, 10.0, 9.0, 8.3,
             0.1, 0.2, 0.4, 0.2, 0.2, 0.3, 0.3, 0.3, 0.4, 0.3, 0.2, 0.3, 0.2, 0.2, 0.2, 0.2, 0.2,
             0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
             0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
             2.1, 5.6, 6.0, 56.9, 57.5, 52.9, 55.3, 55.5, 40.5, 43.4, 45.5, 45.1, 44.9, 29.0, 34.7, 33.0, 33.5,
             0.0, 0.0, 0.0, 1.5, 1.4, 1.1, 1.0, 1.3, 0.7, 1.4, 1.1, 1.1, 1.1, 0.4, 0.5, 0.7, 0.5,
             0.0, 0.2, 0.3, 1.4, 1.4, 1.1, 1.3, 1.5, 0.9, 1.2, 1.1, 1.2, 1.0, 0.5, 0.6, 0.9, 0.8,
             0.0, 0.0, 0.0, 0.0, 0.0, 0.1, 0.0, 0.0, 0.1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
             0.0, 0.0, 0.0, 1.1, 1.6, 0.9, 1.3, 1.0, 0.8, 0.8, 0.8, 0.8, 0.7, 0.9, 0.6, 0.7, 0.6,
             0.1, 0.1, 0.3, 21.3, 17.7, 17.0, 15.4, 18.4, 12.2, 13.3, 14.8, 14.5, 14.1, 6.5, 9.1, 8.9, 8.5), nrow = 20, byrow = TRUE)
    
         # Original vectors
         samples_orig <- c("parental_cells_1", "parental_cells_2", "parental_cells_3",
            "sT_Dox_1", "scr_DMSO_1", "sT_DMSO_1",
            "sT_DMSO_2", "scr_Dox_1",
            "untreated_1", "untreated_2",
            "sT_Dox_2", "scr_DMSO_2", "scr_Dox_2",
            "scr_DMSO_3", "sT_DMSO_3", "scr_Dox_3",
            "sT_Dox_3")
    
         categories_orig <- c("reads_used_for_alignment", "genome", "miRNA_sense", "miRNA_antisense",
                             "miRNAprecursor_sense", "miRNAprecursor_antisense", "tRNA_sense", "tRNA_antisense",
                             "piRNA_sense", "piRNA_antisense", "gencode_sense", "gencode_antisense",
                             "circularRNA_sense", "circularRNA_antisense", "not_mapped_to_genome_or_libs",
                             "repetitiveElements", "endogenous_gapped", "exogenous_miRNA", "exogenous_rRNA",
                             "exogenous_genomes")
    
         # Provided samples and categories (desired order and format)
         samples <- c("parental_cells_1","parental_cells_2","parental_cells_3",
                     "untreated_1","untreated_2",
                     "scr_Dox_1","scr_Dox_2","scr_Dox_3",
                     "sT_DMSO_1","sT_DMSO_2","sT_DMSO_3",
                     "scr_DMSO_1","scr_DMSO_2","scr_DMSO_3",
                     "sT_Dox_1","sT_Dox_2","sT_Dox_3")
    
         categories <- c("reads_used_for_alignment", "genome", "miRNA", "miRNAprecursor", "tRNA", "piRNA",
                         "gencode", "circularRNA", "not_mapped_to_genome_or_libs", "repetitiveElements",
                         "endogenous_gapped", "exogenous_miRNA", "exogenous_rRNA", "exogenous_genomes")
    
         rownames(data_orig) <- categories_orig
         colnames(data_orig) <- samples_orig
    
         # Collapse sense/antisense
         merge_rows <- function(prefix) {
             row1 <- paste0(prefix, "_sense")
             row2 <- paste0(prefix, "_antisense")
             if (row1 %in% rownames(data_orig) && row2 %in% rownames(data_orig)) {
                 return(data_orig[row1, ] + data_orig[row2, ])
             } else if (row1 %in% rownames(data_orig)) {
                 return(data_orig[row1, ])
             } else {
                 return(rep(0, ncol(data_orig)))
             }
         }
    
         # Construct merged data
         data_merged <- rbind(
             reads_used_for_alignment = data_orig["reads_used_for_alignment", ],
             genome = data_orig["genome", ],
             miRNA = merge_rows("miRNA"),
             miRNAprecursor = merge_rows("miRNAprecursor"),
             tRNA = merge_rows("tRNA"),
             piRNA = merge_rows("piRNA"),
             gencode = merge_rows("gencode"),
             circularRNA = merge_rows("circularRNA"),
             not_mapped_to_genome_or_libs = data_orig["not_mapped_to_genome_or_libs", ],
             repetitiveElements = data_orig["repetitiveElements", ],
             endogenous_gapped = data_orig["endogenous_gapped", ],
             exogenous_miRNA = data_orig["exogenous_miRNA", ],
             exogenous_rRNA = data_orig["exogenous_rRNA", ],
             exogenous_genomes = data_orig["exogenous_genomes", ]
         )
    
         # Reorder columns to match desired sample order
         data_final <- data_merged[, samples[samples %in% colnames(data_merged)]]
    
         #genome --> human_genome, not_mapped_to_genome_or_libs --> not_mapped_to_human_genome
         rownames(data_final)[rownames(data_final) == "genome"] <- "human_genome"
         rownames(data_final)[rownames(data_final) == "not_mapped_to_genome_or_libs"] <- "not_mapped_to_human_genome"
    
         # Save to Excel
         write.xlsx(data_final, file = "distribution_heatmap.xlsx", rowNames = TRUE)
    
     # -- Python-code --
    
         python plot_distribution_heatmap.py distribution_heatmap.xlsx distribution_heatmap.png
    
             import pandas as pd
             import numpy as np
             import seaborn as sns
             import matplotlib.pyplot as plt
    
             ## Load data from Excel file
             file_path = "distribution_heatmap.xlsx"
    
             # Read Excel file, assuming first column is index (row labels)
             df = pd.read_excel(file_path, index_col=0)
    
             # The data is already in percentage format, convert to decimals if needed
             # If you want fractions (0-1 range), divide by 100
             data = df.values / 100.0
    
             # Get categories (row names) and samples (column names)
             categories = df.index.tolist()
             samples = df.columns.tolist()
    
             # Create DataFrame with proper structure
             df_plot = pd.DataFrame(data, index=categories, columns=samples)
    
             # Plot heatmap
             plt.figure(figsize=(14, 6))
             sns.heatmap(df_plot, annot=True, cmap="coolwarm", fmt=".3f", linewidths=0.5, cbar_kws={'label': 'Fraction Aligned Reads'})
    
             # Improve layout
             plt.title("Heatmap of Read Alignments by Category and Sample", fontsize=14)
             plt.xlabel("Sample", fontsize=12)
             plt.ylabel("Read Category", fontsize=12)
             plt.xticks(rotation=25, ha="right", fontsize=10)
             plt.yticks(rotation=0, fontsize=10)
             plt.tight_layout()
    
             # Save as PNG
             plt.savefig("distribution_heatmap.png", dpi=300, bbox_inches="tight")
    
             # Save as SVG (Vector) - Recommended for publications/editing
             plt.savefig("distribution_heatmap.svg", bbox_inches="tight")
    
             # Show plot
             plt.show()
  2. Draw differentially_expressed_miRNAs_heatmap.png sent afterwards (Namely downstream analyis using R for miRNAs)

     #Input file
     #exceRpt_miRNA_ReadCounts.txt
     #exceRpt_piRNA_ReadCounts.txt
    
     #cd ~/DATA/Data_Ute_smallRNA_7/summaries_exo7
     cd ~/DATA/Data_Ute_smallRNA_via_exceRpt_workspace/summaries_MKL-1
     mamba activate r_env
     R
     #> .libPaths()
     #[1] "/home/jhuang/mambaforge/envs/r_env/lib/R/library"
    
     #BiocManager::install("AnnotationDbi")
     #BiocManager::install("clusterProfiler")
     #BiocManager::install(c("ReactomePA","org.Hs.eg.db"))
     #BiocManager::install("limma")
     #BiocManager::install("sva")
     #install.packages("writexl")
     #install.packages("openxlsx")
     library("AnnotationDbi")
     library("clusterProfiler")
     library("ReactomePA")
     library("org.Hs.eg.db")
     library(DESeq2)
     library(gplots)
     library(limma)
     library(sva)
     #library(writexl)  #d.raw_with_rownames <- cbind(RowNames = rownames(d.raw), d.raw); write_xlsx(d.raw, path = "d_raw.xlsx");
     library(openxlsx)
    
     # 1. Load data
     d.raw <- read.delim2("exceRpt_miRNA_ReadCounts.txt", sep="\t", header=TRUE, row.names=1)
    
     # 2. Define the mapping from Original Column Names to Standardized Names
     # Ensure these keys EXACTLY match what is in colnames(d.raw)
     sample_map <- c(
     "nf780"               = "parental_cells_1",
     "nf796"               = "parental_cells_2",
     "nf797"               = "parental_cells_3",
    
     "X2404_MKL1_wt_EVs"   = "untreated_1",
     "X2608_MKL1_wt_EVs"   = "untreated_2",
    
     "X2701_MKL1_scr_DMSO" = "scr_DMSO_1",
     "X2608_MKL1_scr_DMSO" = "scr_DMSO_2",
     "X2802_MKL1_scr_DMSO" = "scr_DMSO_3",
    
     "X2701_MKL1_scr_Dox"  = "scr_Dox_1",
     "X2608_MKL1_scr_Dox"  = "scr_Dox_2",
     "X2802_MKL1_scr_Dox"  = "scr_Dox_3",
    
     "X2701_MKL1_sT_DMSO"  = "sT_DMSO_1",
     "X2608_MKL1_sT_DMSO"  = "sT_DMSO_2",
     "X2802_MKL1_sT_DMSO"  = "sT_DMSO_3",
    
     "X2701_MKL1_sT_Dox"   = "sT_Dox_1",
     "X2608_MKL1_sT_Dox"   = "sT_Dox_2",
     "X2802_MKL1_sT_Dox"   = "sT_Dox_3"
     )
    
     # 3. Safe Renaming Strategy
     # Create a vector of new names for ALL current columns
     new_col_names <- colnames(d.raw)
    
     # Identify which current columns are in our map
     matched_indices <- match(colnames(d.raw), names(sample_map))
    
     # Replace names where a match was found
     # matched_indices will be NA if no match is found
     found_mask <- !is.na(matched_indices)
     new_col_names[found_mask] <- sample_map[colnames(d.raw)[found_mask]]
    
     # Assign the new names back to the dataframe
     colnames(d.raw) <- new_col_names
    
     # Optional: Check if any expected samples were missing entirely
     missing_samples <- setdiff(names(sample_map), colnames(d.raw)) # Check against OLD names? No, check against original input
     # Better check:
     original_cols <- colnames(read.delim2("exceRpt_miRNA_ReadCounts.txt", sep="\t", header=TRUE, nrows=1))
     missing_in_data <- setdiff(names(sample_map), original_cols)
     if(length(missing_in_data) > 0) {
     warning(paste("WARNING: The following samples from your map were NOT found in the file:", paste(missing_in_data, collapse=", ")))
     }
    
     # 4. Define the desired final order
     desired_order <- c(
         "parental_cells_1", "parental_cells_2", "parental_cells_3",
         "untreated_1", "untreated_2",
         "scr_Dox_1", "scr_Dox_2", "scr_Dox_3",
         "sT_DMSO_1", "sT_DMSO_2", "sT_DMSO_3",
         "scr_DMSO_1", "scr_DMSO_2", "scr_DMSO_3",
         "sT_Dox_1", "sT_Dox_2", "sT_Dox_3"
     )
    
     # 5. Check for missing columns in the final desired set
     missing_final <- setdiff(desired_order, colnames(d.raw))
     if (length(missing_final) > 0) {
     stop(paste("ERROR: Missing required columns after renaming:", paste(missing_final, collapse=", ")))
     }
    
     # 6. Subset and Reorder
     d.raw <- d.raw[, desired_order]
    
     # 7. Ensure numeric type and round
     d.raw[] <- lapply(d.raw, function(x) as.numeric(as.character(x)))
     d.raw <- round(d.raw)
    
     # 8. Save outputs
     write.csv(d.raw, file = "d_raw.csv", row.names = TRUE)
     write.xlsx(d.raw, file = "d_raw.xlsx", rowNames = TRUE)
    
     print("Processing complete. Files saved.")
    
     #d.raw <- read.delim2("d_raw.csv",sep=",", header=TRUE, row.names=1)
    
     parental_or_EV = as.factor(c("parental","parental","parental", "EV","EV","EV","EV","EV","EV","EV","EV","EV","EV","EV","EV","EV","EV"))
     #batch = as.factor(c("Aug22","March25","March25", "Sep23","Sep23", "Sep23","Sep23","March25", "Sep23","Sep23","March25", "Sep23","Sep23","March25", "Sep23","Sep23","March25"))
     replicates = as.factor(c("parental_cells", "parental_cells", "parental_cells",
         "untreated", "untreated",
         "scr_Dox", "scr_Dox", "scr_Dox",
         "sT_DMSO", "sT_DMSO", "sT_DMSO",
         "scr_DMSO", "scr_DMSO", "scr_DMSO",
         "sT_Dox", "sT_Dox", "sT_Dox"))
     ids = as.factor(c(
         "parental_cells_1", "parental_cells_2", "parental_cells_3",
         "untreated_1", "untreated_2",
         "scr_Dox_1", "scr_Dox_2", "scr_Dox_3",
         "sT_DMSO_1", "sT_DMSO_2", "sT_DMSO_3",
         "scr_DMSO_1", "scr_DMSO_2", "scr_DMSO_3",
         "sT_Dox_1", "sT_Dox_2", "sT_Dox_3"
     ))
     cData = data.frame(row.names=colnames(d.raw), replicates=replicates, ids=ids, parental_or_EV=parental_or_EV)
     #dds<-DESeqDataSetFromMatrix(countData=d.raw, colData=cData, design=~replicates+batch)
     dds<-DESeqDataSetFromMatrix(countData=d.raw, colData=cData, design=~replicates)
    
     # Filter low-count miRNAs
     dds <- dds[ rowSums(counts(dds)) > 10, ]  #1322-->903
     rld <- rlogTransformation(dds)
    
     # -- before pca --
     png("pca.png", 1200, 800)
     plotPCA(rld, intgroup=c("replicates"))
     #plotPCA(rld, intgroup = c("replicates", "batch"))
     #plotPCA(rld, intgroup = c("replicates", "ids"))
     #plotPCA(rld, "batch")
     dev.off()
    
     # Batch Effect Removal Methods (Non-batch effect removal applied!)
    
     #### STEP2: DEGs ####
     #- Heatmap untreated/wt vs parental; 1x for WaGa cell line
     #- Volcano plot untreated/wt vs parental; 1x for WaGa cell line
     #- Manhattan plot miRNAs; 1x for WaGa cell line
     #- Distribution of different small RNA species untreated/wt and parental; 1x for WaGa cell line
     #- Motif analysis: identify RNA-binding proteins that may regulate small RNA loading; 1x for WaGa cell line
    
     #convert bam to bigwig using deepTools by feeding inverse of DESeq’s size Factor
     sizeFactors(dds)
     #NULL
     dds <- estimateSizeFactors(dds)
     sizeFactors(dds)
     normalized_counts <- counts(dds, normalized=TRUE)
     write.table(normalized_counts, file="normalized_counts.txt", sep="\t", quote=F, col.names=NA)
     write.xlsx(normalized_counts, file = "normalized_counts.xlsx", rowNames = TRUE)
    
     #---- untreated, scr_Dox, sT_DMSO, scr_DMSO, sT_Dox to parental_cells ----
    
     dds$replicates <- relevel(dds$replicates, "parental_cells")
     dds = DESeq(dds, betaPrior=FALSE)  #default betaPrior is FALSE
     resultsNames(dds)
     clist <- c("untreated_vs_parental_cells")
    
     dds$replicates <- relevel(dds$replicates, "untreated")
     dds = DESeq(dds, betaPrior=FALSE)
     resultsNames(dds)
     clist <- c("sT_DMSO_vs_untreated", "scr_Dox_vs_untreated", "scr_DMSO_vs_untreated", "sT_Dox_vs_untreated")
    
     dds$replicates <- relevel(dds$replicates, "sT_DMSO")
     dds = DESeq(dds, betaPrior=FALSE)
     resultsNames(dds)
     clist <- c("sT_Dox_vs_sT_DMSO")
    
     dds$replicates <- relevel(dds$replicates, "scr_Dox")
     dds = DESeq(dds, betaPrior=FALSE)
     resultsNames(dds)
     clist <- c("sT_Dox_vs_scr_Dox")
    
     dds$replicates <- relevel(dds$replicates, "scr_DMSO")
     dds = DESeq(dds, betaPrior=FALSE)
     resultsNames(dds)
     clist <- c("sT_Dox_vs_scr_DMSO")
    
     #NOTE that the results sent to Ute is |padj|<=0.1.
     for (i in clist) {
         contrast = paste("replicates", i, sep="_")
         res = results(dds, name=contrast)
         res <- res[!is.na(res$log2FoldChange),]
         #https://bioconductor.org/packages/release/bioc/vignettes/DESeq2/inst/doc/DESeq2.html#why-are-some-p-values-set-to-na
         res$padj <- ifelse(is.na(res$padj), 1, res$padj)
         res_df <- as.data.frame(res)
         write.csv(as.data.frame(res_df[order(res_df$pvalue),]), file = paste(i, "all.txt", sep="-"))
         up <- subset(res_df, padj<=0.05 & log2FoldChange>=2)
         down <- subset(res_df, padj<=0.05 & log2FoldChange<=-2)
         write.csv(as.data.frame(up[order(up$log2FoldChange,decreasing=TRUE),]), file = paste(i, "up.txt", sep="-"))
         write.csv(as.data.frame(down[order(abs(down$log2FoldChange),decreasing=TRUE),]), file = paste(i, "down.txt", sep="-"))
     }
    
     ~/Tools/csv2xls-0.4/csv_to_xls.py \
     untreated_vs_parental_cells-all.txt \
     untreated_vs_parental_cells-up.txt \
     untreated_vs_parental_cells-down.txt \
     -d$',' -o untreated_vs_parental_cells.xls;
    
     ~/Tools/csv2xls-0.4/csv_to_xls.py \
     sT_DMSO_vs_untreated-all.txt \
     sT_DMSO_vs_untreated-up.txt \
     sT_DMSO_vs_untreated-down.txt \
     -d$',' -o sT_DMSO_vs_untreated.xls;
    
     ~/Tools/csv2xls-0.4/csv_to_xls.py \
     scr_Dox_vs_untreated-all.txt \
     scr_Dox_vs_untreated-up.txt \
     scr_Dox_vs_untreated-down.txt \
     -d$',' -o scr_Dox_vs_untreated.xls;
    
     ~/Tools/csv2xls-0.4/csv_to_xls.py \
     scr_DMSO_vs_untreated-all.txt \
     scr_DMSO_vs_untreated-up.txt \
     scr_DMSO_vs_untreated-down.txt \
     -d$',' -o scr_DMSO_vs_untreated.xls;
    
     ~/Tools/csv2xls-0.4/csv_to_xls.py \
     sT_Dox_vs_untreated-all.txt \
     sT_Dox_vs_untreated-up.txt \
     sT_Dox_vs_untreated-down.txt \
     -d$',' -o sT_Dox_vs_untreated.xls;
    
     ~/Tools/csv2xls-0.4/csv_to_xls.py \
     sT_Dox_vs_sT_DMSO-all.txt \
     sT_Dox_vs_sT_DMSO-up.txt \
     sT_Dox_vs_sT_DMSO-down.txt \
     -d$',' -o sT_Dox_vs_sT_DMSO.xls;
    
     ~/Tools/csv2xls-0.4/csv_to_xls.py \
     sT_Dox_vs_scr_Dox-all.txt \
     sT_Dox_vs_scr_Dox-up.txt \
     sT_Dox_vs_scr_Dox-down.txt \
     -d$',' -o sT_Dox_vs_scr_Dox.xls;
    
     ~/Tools/csv2xls-0.4/csv_to_xls.py \
     sT_Dox_vs_scr_DMSO-all.txt \
     sT_Dox_vs_scr_DMSO-up.txt \
     sT_Dox_vs_scr_DMSO-down.txt \
     -d$',' -o sT_Dox_vs_scr_DMSO.xls;
    
     # ------------------- volcano_plot -------------------
     library(ggplot2)
     library(ggrepel)
    
     geness_res <- read.csv(file = paste("untreated_vs_parental_cells", "all.txt", sep="-"), row.names=1)
    
     external_gene_name <- rownames(geness_res)
     geness_res <- cbind(geness_res, external_gene_name)
     #top_g are from ids
     top_g <- c("hsa-miR-10b-5p","hsa-miR-1246","hsa-let-7a-5p","hsa-miR-182-5p","hsa-let-7f-5p","hsa-miR-1-3p","hsa-miR-375","hsa-miR-200c-3p","hsa-miR-30a-5p","hsa-miR-98-5p","hsa-miR-25-3p","hsa-miR-192-5p","hsa-miR-30c-5p","hsa-miR-1180-3p","hsa-let-7e-5p","hsa-miR-203a-3p","hsa-miR-625-3p","hsa-miR-146b-5p","hsa-miR-95-3p","hsa-miR-877-5p","hsa-miR-1307-3p","hsa-let-7c-5p","hsa-miR-361-5p","hsa-miR-30e-3p","hsa-miR-885-5p","hsa-miR-34a-5p","hsa-miR-93-5p","hsa-miR-5187-5p","hsa-miR-101-3p","hsa-miR-6850-5p","hsa-miR-103a-3p","hsa-miR-4511","hsa-miR-196a-5p","hsa-miR-1908-5p","hsa-miR-484","hsa-miR-92b-5p","hsa-miR-9-5p","hsa-miR-15b-5p","hsa-miR-30a-3p","hsa-miR-133b","hsa-miR-148a-3p","hsa-miR-1307-5p","hsa-miR-19b-3p","hsa-miR-6741-3p","hsa-miR-486-5p","hsa-miR-181a-5p","hsa-miR-342-5p","hsa-miR-873-3p","hsa-miR-324-5p","hsa-miR-769-5p","hsa-miR-328-3p","hsa-miR-301a-3p","hsa-miR-1224-5p","hsa-miR-671-5p","hsa-miR-652-3p","hsa-miR-1301-3p","hsa-miR-206","hsa-miR-889-3p","hsa-miR-197-3p","hsa-miR-217","hsa-miR-339-5p","hsa-miR-320c","hsa-miR-423-3p","hsa-miR-7706","hsa-miR-425-5p","hsa-miR-19a-3p","hsa-miR-149-5p","hsa-miR-361-3p","hsa-miR-4476","hsa-miR-186-5p","hsa-miR-342-3p","hsa-miR-708-3p","hsa-let-7b-5p","hsa-miR-17-5p","hsa-miR-532-3p","hsa-miR-1226-5p","hsa-miR-4677-3p","hsa-miR-3187-3p","hsa-miR-320a","hsa-miR-183-5p","hsa-miR-93-3p","hsa-miR-128-3p","hsa-miR-92a-1-5p","hsa-miR-501-5p","hsa-miR-454-3p","hsa-miR-760","hsa-miR-193b-3p","hsa-miR-200a-3p","hsa-miR-1290","hsa-miR-107","hsa-miR-331-3p","hsa-miR-148b-3p","hsa-miR-505-3p","hsa-miR-26b-5p","hsa-miR-130b-3p","hsa-miR-23b-3p","hsa-let-7g-5p","hsa-miR-188-5p","hsa-miR-432-5p","hsa-miR-190b","hsa-miR-1296-5p","hsa-miR-615-3p","hsa-miR-132-3p","hsa-miR-195-5p","hsa-miR-362-5p","hsa-miR-324-3p","hsa-miR-500a-3p","hsa-miR-151b","hsa-miR-92a-3p","hsa-miR-769-3p","hsa-miR-191-5p","hsa-miR-486-3p","hsa-miR-940","hsa-miR-449c-5p","hsa-miR-500a-5p","hsa-miR-22-3p","hsa-miR-183-3p","hsa-miR-181d-5p","hsa-miR-3200-3p","hsa-miR-1306-3p","hsa-miR-30c-2-3p","hsa-let-7b-3p","hsa-miR-1254","hsa-miR-7974","hsa-miR-216b-5p","hsa-miR-200b-5p","hsa-miR-1306-5p","hsa-miR-181b-5p","hsa-miR-133a-3p","hsa-miR-425-3p","hsa-miR-3934-5p","hsa-miR-421","hsa-miR-200b-3p","hsa-miR-18a-5p","hsa-miR-3605-5p","hsa-miR-210-3p","hsa-miR-193b-5p","hsa-miR-30b-5p","hsa-miR-190a-5p","hsa-miR-30e-5p","hsa-miR-106b-5p","hsa-miR-423-5p","hsa-mir-378c","hsa-miR-15a-5p","hsa-miR-92b-3p","hsa-miR-15b-3p","hsa-miR-148a-5p","hsa-miR-130b-5p","hsa-miR-181c-5p","hsa-miR-378e","hsa-miR-744-5p","hsa-miR-320b","hsa-miR-20a-5p","hsa-miR-885-3p","hsa-miR-339-3p","hsa-let-7i-5p","hsa-miR-181a-2-3p","hsa-miR-378i","hsa-miR-27b-3p","hsa-let-7a-3","hsa-miR-16-2-3p","hsa-miR-3615","hsa-miR-4510","hsa-miR-4492","hsa-miR-212-3p","hsa-let-7c","hsa-miR-660-5p","hsa-miR-25-5p","hsa-miR-16-5p","hsa-miR-141-3p","hsa-miR-30d-5p","hsa-let-7a-1","hsa-miR-151a-3p","hsa-let-7a-2","hsa-miR-30b-3p","hsa-miR-532-5p","hsa-miR-378d","hsa-let-7d-3p","hsa-miR-378c","hsa-miR-27a-3p","hsa-miR-378a-3p","hsa-miR-21-5p","hsa-miR-320d","hsa-miR-106b-3p","hsa-miR-320e","hsa-miR-196b-5p","hsa-miR-30d-3p","hsa-miR-4516","hsa-let-7b","hsa-miR-708-5p","hsa-miR-151a-5p|hsa-miR-151b","hsa-miR-6134","hsa-miR-106a-5p","hsa-miR-335-3p","hsa-miR-1269b","hsa-let-7d-5p","hsa-miR-139-3p","hsa-miR-218-5p","hsa-miR-6128","hsa-miR-215-5p","hsa-miR-26a-5p","hsa-miR-20b-5p","hsa-miR-24-3p","hsa-miR-330-3p","hsa-miR-941","hsa-miR-10a-5p","hsa-miR-1270","hsa-miR-345-5p","hsa-miR-140-3p","hsa-miR-7-5p","hsa-miR-577","hsa-let-7a-3p","hsa-miR-1269a","hsa-miR-1468-5p","hsa-miR-146a-5p")
     subset(geness_res, external_gene_name %in% top_g & pvalue < 0.05 & (abs(geness_res$log2FoldChange) >= 2.0))
     geness_res$Color <- "NS or log2FC < 2.0"
     geness_res$Color[geness_res$pvalue < 0.05] <- "P < 0.05"
     geness_res$Color[geness_res$padj < 0.05] <- "P-adj < 0.05"
     geness_res$Color[abs(geness_res$log2FoldChange) < 2.0] <- "NS or log2FC < 2.0"
    
     write.csv(geness_res, "untreated_vs_parental_cells_with_Category.csv")
     geness_res$invert_P <- (-log10(geness_res$pvalue)) * sign(geness_res$log2FoldChange)
    
     geness_res <- geness_res[, -1*ncol(geness_res)]
     png("volcano_plot_untreated_vs_parental_cells.png",width=1200, height=1400)
     #svg("untreated_vs_parental_cells.svg",width=12, height=14)
     ggplot(geness_res,       aes(x = log2FoldChange, y = -log10(pvalue),           color = Color, label = external_gene_name)) +       geom_vline(xintercept = c(2.0, -2.0), lty = "dashed") +       geom_hline(yintercept = -log10(0.05), lty = "dashed") +       geom_point() +       labs(x = "log2(FC)", y = "Significance, -log10(P)", color = "Significance") +       scale_color_manual(values = c("P < 0.05"="orange","P-adj < 0.05"="red","NS or log2FC < 2.0"="darkgray"),guide = guide_legend(override.aes = list(size = 4))) + scale_y_continuous(expand = expansion(mult = c(0,0.05))) +       geom_text_repel(data = subset(geness_res, external_gene_name %in% top_g & pvalue < 0.05 & (abs(geness_res$log2FoldChange) >= 2.0)), size = 4, point.padding = 0.15, color = "black", min.segment.length = .1, box.padding = .2, lwd = 2) +       theme_bw(base_size = 16) +       theme(legend.position = "bottom")
     dev.off()
    
     # ------------------ differentially_expressed_miRNAs_heatmap -----------------
     # Batch Effect Removal Methods (Non-batch effect removal applied!)
     # prepare all_genes
     #rld <- rlogTransformation(dds)
     #mat <- assay(rld)
     #mm <- model.matrix(~replicates, colData(rld))
     #mat <- limma::removeBatchEffect(mat, batch=rld$batch, design=mm)
     #assay(rld) <- mat
     RNASeq.NoCellLine <- assay(rld)
    
     #Manully defining miRNA for visualization
     for i in untreated_vs_parental_cells sT_Dox_vs_untreated sT_DMSO_vs_untreated scr_Dox_vs_untreated scr_DMSO_vs_untreated sT_Dox_vs_sT_DMSO sT_Dox_vs_scr_Dox sT_Dox_vs_scr_DMSO; do
       echo "cut -d',' -f1-1 ${i}-up.txt > ${i}-up.id";
       echo "cut -d',' -f1-1 ${i}-down.txt > ${i}-down.id";
     done
     #cat *.id | sort -u > ids
     ##add Gene_Id in the first line, delete the ""
     GOI <- read.csv("ids")$Gene_Id
     datamat = RNASeq.NoCellLine[GOI, ]
    
     # clustering the genes and draw heatmap
     #datamat <- datamat[,-1]  #delete the sample "control MKL1"
     #datamat <- datamat[, 1:5]
    
     #parental_cells_1 parental_cells_2 parental_cells_3    untreated_1 untreated_2    scr_Dox_1 scr_Dox_2 scr_Dox_3     sT_DMSO_1 sT_DMSO_2 sT_DMSO_3    scr_DMSO_1 scr_DMSO_2 scr_DMSO_3    sT_Dox_1 sT_Dox_2 sT_Dox_3 -->
     #parental cells 1 parental cells 2 parental cells 3    untreated 1 untreated 2    scr control 1 scr control 2 scr control 3    DMSO control 1 DMSO control 2 DMSO control 3    scr DMSO control 1 scr DMSO control 2 scr DMSO control 3    sT knockdown 1 sT knockdown 2 sT knockdown 3
     colnames(datamat)[1] <- "parental cells 1"
     colnames(datamat)[2] <- "parental cells 2"
     colnames(datamat)[3] <- "parental cells 3"
     colnames(datamat)[4] <- "untreated 1"
     colnames(datamat)[5] <- "untreated 2"
     colnames(datamat)[6] <- "scr Dox 1"
     colnames(datamat)[7] <- "scr Dox 2"
     colnames(datamat)[8] <- "scr Dox 3"
     colnames(datamat)[9] <- "sT DMSO 1"
     colnames(datamat)[10] <- "sT DMSO 2"
     colnames(datamat)[11] <- "sT DMSO 3"
     colnames(datamat)[12] <- "scr DMSO 1"
     colnames(datamat)[13] <- "scr DMSO 2"
     colnames(datamat)[14] <- "scr DMSO 3"
     colnames(datamat)[15] <- "sT Dox 1"
     colnames(datamat)[16] <- "sT Dox 2"
     colnames(datamat)[17] <- "sT Dox 3"
    
     write.csv(datamat, file ="differentially_expressed_miRNAs_heatmap.txt")
     write.xlsx(datamat, file = "differentially_expressed_miRNAs_heatmap.xlsx", rowNames = TRUE)
     #"ward.D"’, ‘"ward.D2"’,‘"single"’, ‘"complete"’, ‘"average"’ (= UPGMA), ‘"mcquitty"’(= WPGMA), ‘"median"’ (= WPGMC) or ‘"centroid"’ (= UPGMC)
     hr <- hclust(as.dist(1-cor(t(datamat), method="pearson")), method="complete")
     hc <- hclust(as.dist(1-cor(datamat, method="spearman")), method="complete")
     mycl = cutree(hr, h=max(hr$height)/1.1)
     mycol = c("YELLOW", "BLUE", "ORANGE", "CYAN", "GREEN", "MAGENTA", "GREY", "LIGHTCYAN", "RED",     "PINK", "DARKORANGE", "MAROON",  "LIGHTGREEN", "DARKBLUE",  "DARKRED",   "LIGHTBLUE", "DARKCYAN",  "DARKGREEN", "DARKMAGENTA");
     mycol = mycol[as.vector(mycl)]
    
     rownames(datamat) <- sub("\\|.*", "", rownames(datamat))
    
     png("differentially_expressed_miRNAs_heatmap.png", width=1000, height=1400)
     heatmap.2(as.matrix(datamat),
         Rowv=as.dendrogram(hr),
         Colv=NA,
         dendrogram='row',
         labRow=row.names(datamat),
         scale='row',
         trace='none',
         col=bluered(75),
         RowSideColors=mycol,
         srtCol=30,
         lhei=c(1,8),
         cexRow=1.4,   # Increase row label font size
         cexCol=1.7,    # Increase column label font size
         margin=c(8, 12)
         )
     dev.off()
    
     svg("differentially_expressed_miRNAs_heatmap.svg", width=12, height=16)
     heatmap.2(as.matrix(datamat),
         Rowv=as.dendrogram(hr),
         Colv=NA,
         dendrogram='row',
         labRow=row.names(datamat),
         scale='row',
         trace='none',
         col=bluered(75),
         RowSideColors=mycol,
         srtCol=30,
         lhei=c(1,8),
         cexRow=1.4,   # Increase row label font size
         cexCol=1.7,    # Increase column label font size
         margin=c(8, 12)
         )
     dev.off()
    
     # mv differentially_expressed_miRNAs_heatmap.txt differentially_expressed_miRNAs_heatmap_MKL-1.txt
     # mv differentially_expressed_miRNAs_heatmap.xlsx differentially_expressed_miRNAs_heatmap_MKL-1.xlsx
     # mv differentially_expressed_miRNAs_heatmap.png differentially_expressed_miRNAs_heatmap_MKL-1.png
     # mv differentially_expressed_miRNAs_heatmap.svg differentially_expressed_miRNAs_heatmap_MKL-1.svg
     # mv distribution_heatmap.png distribution_heatmap_MKL-1.png
     # mv distribution_heatmap.svg distribution_heatmap_MKL-1.svg
     # mv volcano_plot_untreated_vs_parental_cells.png volcano_plot_untreated_vs_parental_cells_MKL-1.png

映射表 between new group names and old group names

3. 最终映射表

热图列号 旧名称 (Old Name) 实验条件推断 新名称 (New Name) 理由 (Chinese Explanation)
1 nf780 MKL-1 wt cells parental_cells_1 野生型细胞总RNA,作为亲本细胞对照1。
2 nf796 MKL-1 wt cells parental_cells_2 野生型细胞总RNA,作为亲本细胞对照2。
3 nf797 MKL-1 wt cells parental_cells_3 野生型细胞总RNA,作为亲本细胞对照3。
4 2608_MKL1_sT_Dox sT + Dox EV sT_knockdown_1 sT敲低+诱导(Dox),实验组1。
5 2701_MKL1_scr_DMSO Scr + DMSO EV scr_DMSO_control_1 Scramble对照+溶剂(DMSO),双阴性对照1。
6 2701_MKL1_sT_DMSO sT + DMSO EV DMSO_control_1 sT载体+溶剂(DMSO),未诱导的sT对照1。
7 2608_MKL1_sT_DMSO sT + DMSO EV DMSO_control_2 sT载体+溶剂(DMSO),未诱导的sT对照2。
8 2701_MKL1_scr_Dox Scr + Dox EV scr_control_1 Scramble对照+诱导(Dox),诱导对照组1。
9 2404_MKL1_wt_EVs WT EV untreated_1 野生型外泌体,未处理对照1。
10 2608_MKL1_wt_EVs WT EV untreated_2 野生型外泌体,未处理对照2。
11 2701_MKL1_sT_Dox sT + Dox EV sT_knockdown_2 sT敲低+诱导(Dox),实验组2。
12 2608_MKL1_scr_DMSO Scr + DMSO EV scr_DMSO_control_2 Scramble对照+溶剂(DMSO),双阴性对照2。
13 2608_MKL1_scr_Dox Scr + Dox EV scr_control_2 Scramble对照+诱导(Dox),诱导对照组2。
14 2802_MKL1_scr_DMSO Scr + DMSO EV scr_DMSO_control_3 Scramble对照+溶剂(DMSO),双阴性对照3。
15 2802_MKL1_sT_DMSO sT + DMSO EV DMSO_control_3 sT载体+溶剂(DMSO),未诱导的sT对照3。
16 2802_MKL1_scr_Dox Scr + Dox EV scr_control_3 Scramble对照+诱导(Dox),诱导对照组3。
17 2802_MKL1_sT_Dox sT + Dox EV sT_knockdown_3 sT敲低+诱导(Dox),实验组3。

(注:untreated_1/2parental_cells_1/2/3 的具体编号顺序(1,2,3)可以根据原始样本ID的数字大小或实验记录微调,但类别对应是确定的。上述编号是按它们在列表中出现的顺序分配的。)

4. 为什么这样映射?(Explanation in Chinese)

  1. 区分细胞与外泌体 (Cells vs EVs):

    • 旧名称中的 nf780/796/797 标记为 “MKL-1 wt cells”,这是细胞裂解液的 RNA-seq 数据,而非外泌体。在新名称中,parental_cells 是最合适的对应项,代表亲本细胞系的基线表达。
    • 旧名称中的 2404/2608 ... wt_EVs 标记为 “MKL-1 wt EV”,这是野生型的外泌体。在新名称中,untreated 通常指未经过任何转染或药物处理的天然状态,因此对应 WT EVs。
  2. 区分处理条件 (Treatment Conditions):

    • sT_knockdown: 对应旧名称中的 sT_Dox。因为 Dox (Doxycycline) 是诱导剂,用于启动 shRNA/siRNA 的表达从而实现敲低。这是主要的实验组。
    • scr_control: 对应旧名称中的 scr_Dox。Scramble (乱序序列) 是阴性对照,同样加 Dox 诱导,用于排除诱导剂本身和非特异性序列的影响。这是 sT_knockdown 的直接对照。
    • DMSO_control: 对应旧名称中的 sT_DMSO。这里 sT 载体存在,但加入的是 DMSO (溶剂) 而不是 Dox,因此基因敲低未被诱导(或仅有极低背景泄漏)。这用于评估在没有诱导的情况下,sT 载体本身对细胞/外泌体的影响。
    • scr_DMSO_control: 对应旧名称中的 scr_DMSO。既没有功能性敲低序列 (Scr),也没有诱导剂 (DMSO)。这是最基础的“双阴性”对照,代表转染了空载体或乱序载体且未诱导的状态。
  3. 重复样本 (Replicates):

    • 每个条件都有3个生物学重复(来自不同的批次或制备,如 2608, 2701, 2802),因此新名称中的 _1, _2, _3 分别对应这三个不同的来源。

R 代码实现映射

# 定义旧名称顺序 (对应热图列 1-17)
old_names <- c("nf780", "nf796", "nf797", 
               "2608_MKL1_sT_Dox", "2701_MKL1_scr_DMSO", "2701_MKL1_sT_DMSO", 
               "2608_MKL1_sT_DMSO", "2701_MKL1_scr_Dox", 
               "2404_MKL1_wt_EVs", "2608_MKL1_wt_EVs", 
               "2701_MKL1_sT_Dox", "2608_MKL1_scr_DMSO", "2608_MKL1_scr_Dox", 
               "2802_MKL1_scr_DMSO", "2802_MKL1_sT_DMSO", "2802_MKL1_scr_Dox", 
               "2802_MKL1_sT_Dox")

# 定义新名称顺序 (根据上述逻辑映射)
new_names <- c("parental_cells_1", "parental_cells_2", "parental_cells_3",
               "sT_knockdown_1", "scr_DMSO_control_1", "DMSO_control_1",
               "DMSO_control_2", "scr_control_1",
               "untreated_1", "untreated_2",
               "sT_knockdown_2", "scr_DMSO_control_2", "scr_control_2",
               "scr_DMSO_control_3", "DMSO_control_3", "scr_control_3",
               "sT_knockdown_3")

# 创建映射数据框
mapping_df <- data.frame(
  Old_Name = old_names,
  New_Name = new_names
)

print(mapping_df)

Yes, your calculated sums are correct.

Here is the step-by-step verification adding the two rows you provided:

Index Row 1 (gencode_sense) Row 2 (gencode_antisense) Your Sum Calculated Sum (gencode) Match?
1 88.5 0.1 88.6 88.6
2 71.9 0.2 72.1 72.1
3 67.5 0.4 67.9 67.9
4 6.6 0.2 6.8 6.8
5 5.9 0.2 6.1 6.1
6 6.0 0.3 6.3 6.3
7 6.6 0.3 6.9 6.9
8 6.5 0.3 6.8 6.8
9 7.7 0.4 8.1 8.1
10 6.4 0.3 6.7 6.7
11 7.4 0.2 7.6 7.6
12 6.6 0.3 6.9 6.9
13 6.5 0.2 6.7 6.7
14 10.7 0.2 10.9 10.9
15 10.0 0.2 10.2 10.2
16 9.0 0.2 9.2 9.2
17 8.3 0.2 8.5 8.5

Your calculation is perfectly accurate.

exFAT is compatible with modern Linux systems, but how?

Actually, exFAT is compatible with modern Linux systems, but there are some important details to understand:

Why You Might Think It’s Not Compatible

1. Older Linux Kernels (< 5.4)

  • Before Linux kernel 5.4 (released November 2019), exFAT support was not included in the mainline kernel
  • You needed to install third-party drivers like exfat-fuse or exfat-utils
  • Many older distributions didn’t have these packages by default

2. Missing Packages

Even on newer systems, you might need to install specific packages:

# For Debian/Ubuntu-based systems
sudo apt install exfat-fuse exfat-utils

# For newer systems (kernel 5.4+)
sudo apt install exfatprogs

# For RHEL/CentOS/Fedora
sudo dnf install exfatprogs
# or
sudo yum install exfat-utils fuse-exfat

3. Check Your Kernel Version

uname -r
  • If your kernel is 5.4 or newer, exFAT support is built-in
  • If older, you need the FUSE-based drivers

How to Mount exFAT on Linux

Modern Systems (Kernel 5.4+):

sudo mount -t exfat /dev/sdX1 /mnt/usb

Older Systems:

sudo mount -t exfat-fuse /dev/sdX1 /mnt/usb

Check if exFAT Support is Available

# Check if the module is loaded
lsmod | grep exfat

# Check available filesystem types
cat /proc/filesystems | grep exfat

# Try to list supported filesystems
mount -l | grep exfat

Alternative Solutions

If you’re still having issues:

  1. Reformat to a more compatible format:

    • ext4: Best for Linux-only use
    • FAT32: Universal compatibility (but 4GB file size limit)
    • NTFS: Good cross-platform support (read/write on most modern Linux)
  2. Install missing packages:

    sudo apt update
    sudo apt install exfat-fuse exfat-utils exfatprogs
  3. Update your kernel if you’re running an very old distribution

Quick Diagnostic

Run this to check your system:

# Check kernel version
uname -r

# Check if exfat tools are installed
which mount.exfat
which mount.exfat-fuse

# List installed exfat packages
dpkg -l | grep exfat    # Debian/Ubuntu
rpm -qa | grep exfat    # RHEL/CentOS

What Linux distribution and version are you using? I can provide more specific instructions based on your system.

Data_Denise_LT_DNA_Bindung + Data_Denise_LT_K331A_RNASeq

基于您提供的文件列表和已发表的论文背景,以下是 LT (Large Tumor Antigen) 相关未发表数据的完整表格整理。这些数据分为 ChIP-seq(LT蛋白结合位点)和 RNA-seq(LT及突变体转录组影响)。

1. LT 蛋白特异性 ChIP-Seq 数据集

状态: 未发表 (Unpublished) 目的: 绘制 LT 蛋白在全基因组上的直接结合位点。 抗体: Cm2b4 (针对 LT/LTtr 蛋白) 或 IgG/Input 对照。 注意: 部分样本为 LT+sT 共表达,部分为 LT 单独表达。

样本名称 (Sample ID) 细胞类型 供体/ID 处理条件 (Condition) 对照类型 (Control) 文件名示例 (File Name) 备注
HEK293_r1 HEK293 N/A LT + sT Input HEK293_LT+sT_r1.fastq.gz
HEK293_LT+sT_r1_Input.fastq.gz
重复1
HEK293_r2 HEK293 N/A LT + sT Input HEK293_LT+sT_r2.fastq.gz 重复2 (Input可能在其他目录或共用)
HEK293_r3 HEK293 N/A LT + sT Input HEK293_LT+sT_r3.fastq.gz
HEK293_LT+sT_r3_Input.fastq.gz
重复3
HEK293_Mock_r1-3 HEK293 N/A Mock (Vector) Input HEK293_mock_r1...r3.fastq.gz
..._Input.fastq.gz
阴性对照 (之前分析中 r2/r3 质量较差可能被排除)
hTERT_LT_r1 hTERT (BJ5ta) N/A LT only Input? hTERT_LT_r1.fastq.gz 仅 LT 表达 (注意:之前分析中此样本可能因质量被排除,需检查对应 Input)
hTERT_LT_r2 hTERT (BJ5ta) N/A LT only Input hTERT_LT_r2.fastq.gz
hTERT_LT_r2_Input.fastq.gz
仅 LT 表达,高质量重复
hTERT_LT+sT_r1 hTERT (BJ5ta) N/A LT + sT Input hTERT_LT+sT_r1.fastq.gz
hTERT_LT+sT_r1_Input.fastq.gz
LT+sT 共表达
hTERT_LT+sT_r2 hTERT (BJ5ta) N/A LT + sT Input hTERT_LT+sT_r2.fastq.gz
hTERT_LT+sT_r2_Input.fastq.gz
LT+sT 共表达
hTERT_Mock_r1-2 hTERT (BJ5ta) N/A Mock (Vector) Input hTERT_mock_r1...r2.fastq.gz
..._Input.fastq.gz
阴性对照
NHDF_Donor1 NHDF (Primary) Donor 1 LT (Cm2b4) Input NHDF_LT_Donor1.fastq.gz
NHDF_LT_Donor1_Input.fastq.gz
原代细胞,生理相关性高
NHDF_Donor2 NHDF (Primary) Donor 2 LT (Cm2b4) Input NHDF_LT_Donor2.fastq.gz
NHDF_LT_Donor2_Input.fastq.gz
原代细胞,生理相关性高
p783_DonorI NHDF (Primary) Donor I (p783) LT?/Cm2b4 Input p783_ChIP_DonorI.fastq.gz
p783_input_DonorI.fastq.gz
2023年新批次数据
p783_DonorII NHDF (Primary) Donor II (p783) LT?/Cm2b4 Input p783_ChIP_DonorII.fastq.gz
p783_input_DonorII.fastq.gz
2023年新批次数据
PFSK-1A_r1 PFSK-1A N/A LT + sT IgG PFSK-1A_LT+sT_r1.fastq.gz
PFSK-1A_LT+sT_r1_IgG.fastq.gz
注意: 使用 IgG 作为对照,而非 Input
PFSK-1A_r2 PFSK-1A N/A LT + sT IgG PFSK-1A_LT+sT_r2.fastq.gz
PFSK-1A_LT+sT_r2_IgG.fastq.gz
注意: 使用 IgG 作为对照
PFSK-1B_r1 PFSK-1B N/A LT + sT Input PFSK-1B_LT+sT_r1.fastq.gz
PFSK-1B_LT+sT_r1_Input.fastq.gz
使用 Input 作为对照
PFSK-1B_r2 PFSK-1B N/A LT + sT Input PFSK-1B_LT+sT_r2.fastq.gz
PFSK-1B_LT+sT_r2_Input.fastq.gz
使用 Input 作为对照
PFSK-1A_H3K4 PFSK-1A N/A H3K4me3 ChIP IgG PFSK-1A_H3K4_...fastq.gz 非LT蛋白ChIP,为组蛋白修饰数据,可用于辅助注释

2. LT-K331A 突变体 RNA-Seq 数据集

状态: 未发表 (Unpublished) 目的: 比较野生型 LT、截短体 LTtr 和解旋酶突变体 K331A 对宿主转录组的影响。 细胞模型: NHDF (原代人真皮成纤维细胞),两个独立供体 (Donor I & II)。 时间点: 转导后第 8 天 (Day 8)。

样本名称 (Sample ID) 细胞类型 供体 (Donor) 处理条件 (Condition) 文件名 (File Name) 备注
Control_DI NHDF Donor I Vector Control control_d8_DonorI.fastq.gz 空白对照
Control_DII NHDF Donor II Vector Control control_d8_DonorII.fastq.gz 空白对照
Control_DII_Re NHDF Donor II Vector Control control-d8-DII_re.fastq.gz Donor II 的重复或重测数据
LT_WT_DI NHDF Donor I LT (Wild Type) LT_d8_DonorI.fastq.gz 野生型 LT
LT_WT_DII NHDF Donor II LT (Wild Type) LT_d8_DonorII.fastq.gz 野生型 LT
LTtr_DI NHDF Donor I LTtr (Truncated) LTtr_d8_DonorI.fastq.gz 肿瘤相关截短体
LTtr_DII NHDF Donor II LTtr (Truncated) LTtr_d8_DonorII.fastq.gz 肿瘤相关截短体
LT_K331A_DI NHDF Donor I LT-K331A (Mutant) LT_K331A_d8_DonorI.fastq.gz 解旋酶结构域突变体
LT_K331A_DII NHDF Donor II LT-K331A (Mutant) LT_K331A_d8_DonorII.fastq.gz 解旋酶结构域突变体
LT_K331A_DII_Re NHDF Donor II LT-K331A (Mutant) LT-K331A-d8-DII_re.fastq.gz Donor II 的重复或重测数据

数据分析建议

  1. ChIP-Seq 分析策略:

    • 分组: 将样本分为 LT_only (hTERT_LT_r2, NHDF_Donors), LT+sT (HEK293, hTERT_LT+sT, PFSK), 和 Mock
    • 对照处理: 注意 PFSK-1A 使用 IgG 对照,而其他样本主要使用 Input。在调用峰值 (Peak Calling, 如 MACS2) 时,需针对不同对照类型调整参数或分别处理。
    • 整合: 将 LT 结合位点与 RNA-Seq 中的差异基因 (DEGs) 进行重叠分析,特别是关注 LT-K331A 突变是否导致某些关键基因启动子区域的 LT 结合丢失或减弱。
  2. RNA-Seq 分析策略:

    • 差异表达: 使用 DESeq2 进行以下对比:
      • LT_WT vs Control
      • LTtr vs Control
      • LT_K331A vs Control
      • LT_K331A vs LT_WT (关键对比:确定 K331A 突变特异性影响的基因)
    • 功能富集: 重点关注干扰素信号通路 (ISGs)、细胞周期调控和 DNA 损伤反应基因。根据已发表论文,LT 会诱导 ISGs,而 K331A 突变可能会改变这种诱导能力或影响其他下游通路。
  3. 多组学整合:

    • 利用 NHDF Donor 1 & 2 的数据进行跨组学整合,因为这部分既有 ChIP-seq (LT 结合) 又有 RNA-seq (LT/K331A 表达影响),且来自相同的原代细胞系统,生物学一致性最高。


Based on the file list you provided and the background of published papers, here is the complete table of unpublished data related to LT (Large Tumor Antigen). These data are divided into ChIP-seq (LT protein binding sites) and RNA-seq (transcriptomic impact of LT and its mutants).

1. LT Protein-Specific ChIP-Seq Datasets

Status: Unpublished Objective: To map the direct genome-wide binding sites of the LT protein. Antibody: Cm2b4 (targeting LT/LTtr proteins) or IgG/Input controls. Note: Some samples involve co-expression of LT+sT, while others involve LT expression alone.

Sample ID Cell Type Donor/ID Condition Control Type Example File Name Remarks
HEK293_r1 HEK293 N/A LT + sT Input HEK293_LT+sT_r1.fastq.gz
HEK293_LT+sT_r1_Input.fastq.gz
Replicate 1
HEK293_r2 HEK293 N/A LT + sT Input HEK293_LT+sT_r2.fastq.gz Replicate 2 (Input may be in another directory or shared)
HEK293_r3 HEK293 N/A LT + sT Input HEK293_LT+sT_r3.fastq.gz
HEK293_LT+sT_r3_Input.fastq.gz
Replicate 3
HEK293_Mock_r1-3 HEK293 N/A Mock (Vector) Input HEK293_mock_r1...r3.fastq.gz
..._Input.fastq.gz
Negative control (r2/r3 might have been excluded due to poor quality in previous analyses)
hTERT_LT_r1 hTERT (BJ5ta) N/A LT only Input? hTERT_LT_r1.fastq.gz LT expression only (Note: This sample might have been excluded due to quality in previous analyses; check for corresponding Input)
hTERT_LT_r2 hTERT (BJ5ta) N/A LT only Input hTERT_LT_r2.fastq.gz
hTERT_LT_r2_Input.fastq.gz
LT expression only, high-quality replicate
hTERT_LT+sT_r1 hTERT (BJ5ta) N/A LT + sT Input hTERT_LT+sT_r1.fastq.gz
hTERT_LT+sT_r1_Input.fastq.gz
Co-expression of LT+sT
hTERT_LT+sT_r2 hTERT (BJ5ta) N/A LT + sT Input hTERT_LT+sT_r2.fastq.gz
hTERT_LT+sT_r2_Input.fastq.gz
Co-expression of LT+sT
hTERT_Mock_r1-2 hTERT (BJ5ta) N/A Mock (Vector) Input hTERT_mock_r1...r2.fastq.gz
..._Input.fastq.gz
Negative control
NHDF_Donor1 NHDF (Primary) Donor 1 LT (Cm2b4) Input NHDF_LT_Donor1.fastq.gz
NHDF_LT_Donor1_Input.fastq.gz
Primary cells, high physiological relevance
NHDF_Donor2 NHDF (Primary) Donor 2 LT (Cm2b4) Input NHDF_LT_Donor2.fastq.gz
NHDF_LT_Donor2_Input.fastq.gz
Primary cells, high physiological relevance
p783_DonorI NHDF (Primary) Donor I (p783) LT?/Cm2b4 Input p783_ChIP_DonorI.fastq.gz
p783_input_DonorI.fastq.gz
New batch data from 2023
p783_DonorII NHDF (Primary) Donor II (p783) LT?/Cm2b4 Input p783_ChIP_DonorII.fastq.gz
p783_input_DonorII.fastq.gz
New batch data from 2023
PFSK-1A_r1 PFSK-1A N/A LT + sT IgG PFSK-1A_LT+sT_r1.fastq.gz
PFSK-1A_LT+sT_r1_IgG.fastq.gz
Note: Uses IgG as control, not Input
PFSK-1A_r2 PFSK-1A N/A LT + sT IgG PFSK-1A_LT+sT_r2.fastq.gz
PFSK-1A_LT+sT_r2_IgG.fastq.gz
Note: Uses IgG as control
PFSK-1B_r1 PFSK-1B N/A LT + sT Input PFSK-1B_LT+sT_r1.fastq.gz
PFSK-1B_LT+sT_r1_Input.fastq.gz
Uses Input as control
PFSK-1B_r2 PFSK-1B N/A LT + sT Input PFSK-1B_LT+sT_r2.fastq.gz
PFSK-1B_LT+sT_r2_Input.fastq.gz
Uses Input as control
PFSK-1A_H3K4 PFSK-1A N/A H3K4me3 ChIP IgG PFSK-1A_H3K4_...fastq.gz Not LT protein ChIP; histone modification data, useful for auxiliary annotation

2. LT-K331A Mutant RNA-Seq Datasets

Status: Unpublished Objective: To compare the impact of Wild-Type LT, Truncated LT (LTtr), and Helicase Mutant K331A on the host transcriptome. Cell Model: NHDF (Primary Human Dermal Fibroblasts), two independent donors (Donor I & II). Time Point: Day 8 post-transduction.

Sample ID Cell Type Donor Condition File Name Remarks
Control_DI NHDF Donor I Vector Control control_d8_DonorI.fastq.gz Blank control
Control_DII NHDF Donor II Vector Control control_d8_DonorII.fastq.gz Blank control
Control_DII_Re NHDF Donor II Vector Control control-d8-DII_re.fastq.gz Replicate or re-test data for Donor II
LT_WT_DI NHDF Donor I LT (Wild Type) LT_d8_DonorI.fastq.gz Wild-Type LT
LT_WT_DII NHDF Donor II LT (Wild Type) LT_d8_DonorII.fastq.gz Wild-Type LT
LTtr_DI NHDF Donor I LTtr (Truncated) LTtr_d8_DonorI.fastq.gz Tumor-associated truncated form
LTtr_DII NHDF Donor II LTtr (Truncated) LTtr_d8_DonorII.fastq.gz Tumor-associated truncated form
LT_K331A_DI NHDF Donor I LT-K331A (Mutant) LT_K331A_d8_DonorI.fastq.gz Helicase domain mutant
LT_K331A_DII NHDF Donor II LT-K331A (Mutant) LT_K331A_d8_DonorII.fastq.gz Helicase domain mutant
LT_K331A_DII_Re NHDF Donor II LT-K331A (Mutant) LT-K331A-d8-DII_re.fastq.gz Replicate or re-test data for Donor II

Data Analysis Recommendations

  1. ChIP-Seq Analysis Strategy:

    • Grouping: Divide samples into LT_only (hTERT_LT_r2, NHDF_Donors), LT+sT (HEK293, hTERT_LT+sT, PFSK), and Mock.
    • Control Handling: Note that PFSK-1A uses IgG controls, while other samples primarily use Input. When calling peaks (e.g., using MACS2), adjust parameters or process them separately based on the control type.
    • Integration: Overlap LT binding sites with Differentially Expressed Genes (DEGs) from RNA-Seq. Pay particular attention to whether the LT-K331A mutation leads to the loss or weakening of LT binding at the promoter regions of key genes.
  2. RNA-Seq Analysis Strategy:

    • Differential Expression: Use DESeq2 for the following comparisons:
      • LT_WT vs Control
      • LTtr vs Control
      • LT_K331A vs Control
      • LT_K331A vs LT_WT (Key comparison: Identify genes specifically affected by the K331A mutation)
    • Functional Enrichment: Focus on Interferon signaling pathways (ISGs), cell cycle regulation, and DNA damage response genes. According to published literature, LT induces ISGs, and the K331A mutation may alter this induction capacity or affect other downstream pathways.
  3. Multi-Omics Integration:

    • Utilize data from NHDF Donor 1 & 2 for cross-omics integration, as these samples have both ChIP-seq (LT binding) and RNA-seq (impact of LT/K331A expression) data from the same primary cell system, offering the highest biological consistency.