Package: biofkit
biofkitBiofkit 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 InstallCondaconda install -c chou_uken biofkitMambamamba install -c chou_uken biofkitPippip install biofkitHow to UseProteinKitfrombiofkit.proteinKitimportpdbKit# if argument fasta is True, a fasta file will be created in the same path as the pdb file.defpdb2Seq(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.SeqKitfrombiofkit.seqKitimportconvKit# Read fasta files and generate a dictionary whose keys are taxonomy and values are sequencesdefreadFasta(fastaFilePath:str)->dict[str,str]:# fastaFilePath: the path of your fasta file.# transcriptiondefdna2Rna(dnaSeq:str)->str:# dnaSeq: the sequence of DNA, a string containing 'A', 'C', 'G', 'T' but without 'U'.# reverse transcriptiondefrna2Dna(rnaSeq:str)->str:# rnaSeq: the sequence of RNA, a string containing 'A', 'C', 'G', 'U' but without 'T'.# DNA translationdefdna2Pro(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 tranlationdefrna2Pro(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 alignmentdefpairwiseDnaAlign(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 alignmentdefpairwiseProtAlign(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.