Skip to content
This repository has been archived by the owner on Jan 10, 2024. It is now read-only.

Commit

Permalink
fix ENC
Browse files Browse the repository at this point in the history
  • Loading branch information
Hebin-zhang committed Sep 29, 2023
1 parent 54994bd commit 69b4584
Show file tree
Hide file tree
Showing 13 changed files with 123,568 additions and 127 deletions.
37 changes: 37 additions & 0 deletions cubat2/.ipynb_checkpoints/Untitled-checkpoint.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "45bf49b1-e761-4502-b5b9-32befcab53ca",
"metadata": {},
"outputs": [],
"source": [
"library(ggplot2)\n",
"library(data.table)\n",
"library(Bioconductor::Biostrings)\n"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.5"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
3 changes: 3 additions & 0 deletions cubat2/.ipynb_checkpoints/test-checkpoint.r
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
library(ggplot2)
library(data.table)
library(Bioconductor::Biostrings)
Binary file added cubat2/Rplots.pdf
Binary file not shown.
54 changes: 54 additions & 0 deletions cubat2/Untitled.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "45bf49b1-e761-4502-b5b9-32befcab53ca",
"metadata": {},
"outputs": [
{
"ename": "SyntaxError",
"evalue": "invalid syntax (2852074393.py, line 3)",
"output_type": "error",
"traceback": [
"\u001b[0;36m Cell \u001b[0;32mIn[1], line 3\u001b[0;36m\u001b[0m\n\u001b[0;31m library(Bioconductor::Biostrings)\u001b[0m\n\u001b[0m ^\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m invalid syntax\n"
]
}
],
"source": [
"library(ggplot2)\n",
"library(data.table)\n",
"library(Bioconductor::Biostrings)\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "52eee6d8-e483-47a2-9efe-b033d22c4f2d",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.5"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
30,800 changes: 30,800 additions & 0 deletions cubat2/cf.csv

Large diffs are not rendered by default.

34 changes: 32 additions & 2 deletions cubat2/codon_table.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import pandas as pd
from Bio.Data import CodonTable


Expand Down Expand Up @@ -57,8 +58,37 @@ def codon_table_completion(index=1):
return complete_codon_table


# 用法示例:
def codon_table_subfamily(index= 1):
"""
根据密码子表编号获取密码子表的子家族信息。
参数:
- index (str): 密码子表的编号,默认为 '1'。
返回:
- codon_table_subfamily (pd.DataFrame): 包含密码子子家族信息的DataFrame, 包括 aa_code, amino_acid, codon, 和 subfam 列。
"""
codon_table = CodonTable.unambiguous_dna_by_id[int(index)]
codon_table_dict = {
'codon': [],
'amino_acid': [],
'subfamily': []
}

for codon, amino_acid in codon_table.forward_table.items():
aa_code = CodonTable.ambiguous_dna_by_id[int(index)].forward_table[codon]
subfamily = f"{amino_acid}_{codon[:2]}"
codon_table_dict['codon'].append(codon)
codon_table_dict['amino_acid'].append(amino_acid)
codon_table_dict['subfamily'].append(subfamily)

codon_table_subfamily = pd.DataFrame(codon_table_dict)
return codon_table_subfamily


# 测试代码:
if __name__ == "__main__":
index = 1 # 例如,选择标准密码子表
codon_table = get_codon_table_by_index(index)
codon_table = codon_table_subfamily(index)
print(codon_table)

30,800 changes: 30,800 additions & 0 deletions cubat2/enc.csv

Large diffs are not rendered by default.

116 changes: 116 additions & 0 deletions cubat2/example.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
"type","codon","anticodon"
"WC","TTG","CAA"
"WC","TTA","TAA"
"WC","TTC","GAA"
"IU","TTT","AAA"
"IC","TTC","AAA"
"GU","TTT","GAA"
"UG","TTG","TAA"
"WC","TCG","CGA"
"WC","TCA","TGA"
"WC","TCC","GGA"
"IU","TCT","AGA"
"IC","TCC","AGA"
"IA","TCA","AGA"
"GU","TCT","GGA"
"UG","TCG","TGA"
"WC","TAC","GTA"
"IU","TAT","ATA"
"IC","TAC","ATA"
"GU","TAT","GTA"
"WC","TGG","CCA"
"WC","TGC","GCA"
"IU","TGT","ACA"
"IC","TGC","ACA"
"GU","TGT","GCA"
"WC","CTG","CAG"
"WC","CTA","TAG"
"WC","CTC","GAG"
"IU","CTT","AAG"
"IC","CTC","AAG"
"IA","CTA","AAG"
"GU","CTT","GAG"
"UG","CTG","TAG"
"WC","CCG","CGG"
"WC","CCA","TGG"
"WC","CCC","GGG"
"IU","CCT","AGG"
"IC","CCC","AGG"
"IA","CCA","AGG"
"GU","CCT","GGG"
"UG","CCG","TGG"
"WC","CAG","CTG"
"WC","CAA","TTG"
"WC","CAC","GTG"
"IU","CAT","ATG"
"IC","CAC","ATG"
"GU","CAT","GTG"
"UG","CAG","TTG"
"WC","CGG","CCG"
"WC","CGA","TCG"
"WC","CGC","GCG"
"IU","CGT","ACG"
"IC","CGC","ACG"
"IA","CGA","ACG"
"GU","CGT","GCG"
"UG","CGG","TCG"
"WC","ATG","CAT"
"WC","ATA","TAT"
"WC","ATC","GAT"
"IU","ATT","AAT"
"IC","ATC","AAT"
"IA","ATA","AAT"
"GU","ATT","GAT"
"WC","ACG","CGT"
"WC","ACA","TGT"
"WC","ACC","GGT"
"IU","ACT","AGT"
"IC","ACC","AGT"
"IA","ACA","AGT"
"GU","ACT","GGT"
"UG","ACG","TGT"
"WC","AAG","CTT"
"WC","AAA","TTT"
"WC","AAC","GTT"
"IU","AAT","ATT"
"IC","AAC","ATT"
"GU","AAT","GTT"
"UG","AAG","TTT"
"WC","AGG","CCT"
"WC","AGA","TCT"
"WC","AGC","GCT"
"IU","AGT","ACT"
"IC","AGC","ACT"
"GU","AGT","GCT"
"UG","AGG","TCT"
"WC","GTG","CAC"
"WC","GTA","TAC"
"WC","GTC","GAC"
"IU","GTT","AAC"
"IC","GTC","AAC"
"IA","GTA","AAC"
"GU","GTT","GAC"
"UG","GTG","TAC"
"WC","GCG","CGC"
"WC","GCA","TGC"
"WC","GCC","GGC"
"IU","GCT","AGC"
"IC","GCC","AGC"
"IA","GCA","AGC"
"GU","GCT","GGC"
"UG","GCG","TGC"
"WC","GAG","CTC"
"WC","GAA","TTC"
"WC","GAC","GTC"
"IU","GAT","ATC"
"IC","GAC","ATC"
"GU","GAT","GTC"
"UG","GAG","TTC"
"WC","GGG","CCC"
"WC","GGA","TCC"
"WC","GGC","GCC"
"IU","GGT","ACC"
"IC","GGC","ACC"
"IA","GGA","ACC"
"GU","GGT","GCC"
"UG","GGG","TCC"
Loading

0 comments on commit 69b4584

Please sign in to comment.