I am trying to write a code to compare some covid samples but I am getting a syntax error on:
print('Total proteins:', len(df))def conv(item):
I tried to add "()" and change some def
in the code but I keeps comming back as a syntax error. What am I actually doing wrong? Am I defining something incorrectly?
for sequence in SeqIO.parse(r'C:\Users\Downloads\archive\', "fasta"):
print(sequence.seq)
print(len(sequence),'nucliotides')
from Bio.SeqRecord import SeqRecord
from Bio import SeqIO
DNAsequence = SeqIO.read(r'C:\Users\Downloads\archive\, "fasta")
DNA = DNAsequence.seq #Convert DNA into mRNA Sequence
mRNA = DNA.transcribe() #Transcribe a DNA sequence into RNA.
print(mRNA)
print('Size : ',len(mRNA))
Amino_Acid = mRNA.translate(table=1, cds=False)
print('Amino Acid', Amino_Acid)
print("Length of Protein:",len(Amino_Acid))
print("Length of Original mRNA:",len(mRNA))
from Bio.Data import CodonTable
print(CodonTable.unambiguous_rna_by_name['Standard'])
#Identify all the Proteins (chains of amino acids)
Proteins = Amino_Acid.split('*') # * is translated stop codon
df = pd.DataFrame(Proteins)
df.describe()
#Identify all the Proteins (chains of amino acids)
Proteins = Amino_Acid.split('*') # * is translated stop codon
df = pd.DataFrame(Proteins)
df.describe()
print('Total proteins:', len(df))def conv(item):
return len(item)def to_str(item):
return str(item)df['sequence_str'] = df[0].apply(to_str)
df['length'] = df[0].apply(conv)
df.rename(columns={0: "sequence"}, inplace=True)
df.head()# Take only longer than 20
functional_proteins = df.loc[df['length'] >= 20]
print('Total functional proteins:', len(functional_proteins))
functional_proteins.describe()```
Your code is improperly formatted, as comments have pointed out. I assume this is what it should look like:
.
.
.
df.describe()
print('Total proteins:', len(df))
def conv(item):
return len(item)
def to_str(item):
return str(item)
df['sequence_str'] = df[0].apply(to_str)
df['length'] = df[0].apply(conv)
df.rename(columns={0: "sequence"}, inplace=True)
df.head()# Take only longer than 20
.
.
.
That's it, really...