Skip to main content

With biofkit you can deal with pdb file (extract sequence, atom information and so on) very easily.

Project description

biofkit

Biofkit is now containing only one module with one package which can deal with pdb file (extract sequence, atom information and so on) very easily.

How to Install

Conda

conda install -c chou_uken biofkit

Mamba

mamba install -c chou_uken biofkit

Pip

pip install biofkit

How to Use

ProteinKit

from biofkit.proteinKit import pdbKit

# if argument fasta is True, a fasta file will be created in the same path as the pdb file.
def pdb2Seq(pdbFilePath: str, fastaFilePath: str = None, fastaLineLen: int = 80) -> dict[str, str]:
    # pdfFilePath: the file path of the pdb you want to transfer.
    # fastaFilePath: The path to save the fasta files, do not contain your fasta file name.
    # fastaLineLen: How many residues are contained in a single line of the fasta, only work when `fasta` is true.

# load the information of all amino-acid-residue atoms into a list. output[idx] shows the information of an atom.
pdb2List(pdbFilePath: str, csvPath: str = None, colName: bool = False) -> list[list[int, str, str, int, str, float, float, float]]:
    # pdbFilePath: the file path of the pdb you want to load.
    # csvPath: if given, then write a csv file for your atom information.
    # colName: a prepared colname list for the output. If colName is true, the output[0] will be such a list shown below. May help when column names are needed.
    pdbInfoColumns: [str] = ['Serial', 'Atom', 'ResName', 'ResSeq', 'ChainId', 'X', 'Y', 'Z']

# load the information of all amimo-acid-residue atoms into a dictionary, which can be converted into a dataframe with famous `pandas`.
pdb2Dict(pdbFilePath: str) -> dict[str, list]:
    # pdbFilePath: the file path of the pdb you want to load.

SeqKit

from biofkit.seqKit import convKit

# Read fasta files and generate a dictionary whose keys are taxonomy and values are sequences
def readFasta(fastaFilePath: str) -> dict[str, str]:
    # fastaFilePath: the path of your fasta file.

# transcription
def dna2Rna(dnaSeq: str) -> str:
    # dnaSeq: the sequence of DNA, a string containing 'A', 'C', 'G', 'T' but without 'U'.

# reverse transcription
def rna2Dna(rnaSeq: str) -> str:
    # rnaSeq: the sequence of RNA, a string containing 'A', 'C', 'G', 'U' but without 'T'.
    
# DNA translation
def dna2Pro(dnaSeq: str, start: int = 0, end: int = -1) -> str:
    # dnaSeq: the sequence of DNA, a string containing 'A', 'C', 'G', 'T' but without 'U'.
    # start: From where to tranlate into protein.
    # end: To where to tranlate into protein.
    
# RNA tranlation
def rna2Pro(rnaSeq: str, start: int = 0, end: int = -1) -> str:
    # dnaSeq: the sequence of DNA, a string containing 'A', 'C', 'G', 'U' but without 'T'.
    # start: From where to tranlate into protein.
    # end: To where to tranlate into protein.

# DNA pairwise alignment
def pairwiseDnaAlign(fasta: str = '', seqA: str = 'ACGT', seqB: str = 'ACGTA', matrix: str = 'unitary', gapOpen: float = -10, gapExtend: float = -0.5, consoleWidth = 50) -> None:
    # fasta: the path of your fasta file.
    # seqA/B: If fasta file is not provided, seqA/B must be given.
    # matrix: Scoring matrix('unitary', 'blast', 'tt'(transition-transversion)).
    # gapOpen: punishment got when a gap opened.
    # gaoExtend: punishment got when a gap extended.
    # consoleWidth: How many bases printed in a line.

# Protein pairwise alignment
def pairwiseProtAlign(fasta: str = '', seqA: str = 'ACGT', seqB: str = 'ACGTT', matrix: str = 'unitary', gapOpen: float = -10, gapExtend: float = -0.5, consoleWidth = 50) -> None:
    # fasta: the path of your fasta file.
    # seqA/B: If fasta file is not provided, seqA/B must be given.
    # matrix: Scoring matrix('unitary', 'pam250', 'blosum62').
    # gapOpen: punishment got when a gap opened.
    # gaoExtend: punishment got when a gap extended.
    # consoleWidth: How many bases printed in a line.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

biofkit-0.1.5.tar.gz (18.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

biofkit-0.1.5-py3-none-any.whl (18.7 kB view details)

Uploaded Python 3

File details

Details for the file biofkit-0.1.5.tar.gz.

File metadata

  • Download URL: biofkit-0.1.5.tar.gz
  • Upload date:
  • Size: 18.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.8

File hashes

Hashes for biofkit-0.1.5.tar.gz
Algorithm Hash digest
SHA256 2f9bcec8fd35d1d46b24930add994739b528471671c68b771e079f3dcd0fb931
MD5 88bf27677d2f17f3d8704674f7e07166
BLAKE2b-256 766e3c42be5766632435027d3d8b1efe5d74625035772a6ea22772dfecbe8cb9

See more details on using hashes here.

File details

Details for the file biofkit-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: biofkit-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 18.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.8

File hashes

Hashes for biofkit-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 811b8361d9ceb3bead88fece41e0899943c3d7c00a821b2b4b7051a054ed7e54
MD5 42996f36102fd81a4c2e3103dedb0e83
BLAKE2b-256 d30254b086c891e399d81c3baea9f6d1e4c30037d6c32fdd783fc277ad0d0b20

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page