Skip to content

OmarHolayell/Calculate-Molecular-Weight-of-Genome-Enzyme-Proteins

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 

Repository files navigation

Molecular-Weight-of-Genome-Enzyme

EgCompBio Diploma

Python Profile Views

import and install libraries

!pip install BioPython
from Bio import SeqIO
from Bio.SeqUtils.ProtParam import ProteinAnalysis
from Bio.SeqUtils import molecular_weight
from Bio.Seq import Seq
from Bio.SeqUtils import ProtParam
import pandas as pd

create function that calculate mw of one protein

def get_molecular_weight(protein_sequence):
    analyzed_seq = ProteinAnalysis(protein_sequence)
    return analyzed_seq.molecular_weight()

# Example sequence
protein_sequence = "MKRISTTITTTITITTGNGAG"
print(get_molecular_weight(protein_sequence)/1000,"K Dalton")

read fasta file path

file_path=SeqIO.parse(protein fasta file path)

create function to calculate mw for all proteins

def calculate_molecular_weights (file_path):
 
    data = []   # create list to store data
    for record in SeqIO.parse(protein fasta file path):
        accession = record.id
        sequence = str(record.seq)
        prot_param = ProtParam.ProteinAnalysis(sequence)
        molecular_weight = prot_param.molecular_weight()
        data.append([accession, sequence, molecular_weight])
        

    df = pd.DataFrame(data, columns=['Accession', 'Sequence', 'MolecularWeight(dalton)'])  # create data frame to store variables
    return df

calling function

df = calculate_molecular_weights(file_path)
print(df)

read PTT file

pttfile=pd.read_csv(pttfile path)

insert Locus tag to data frame

df['Locus tag']=pttfile['Locus tag']
df

create copy of data frame and drop column

data_frame2=df.copy()
data_frame2=data_frame2.drop(['Accession', 'Sequence'], axis=1)

About

how to calculate molecular weight of genome enzyme (proteins)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors