Search code examples
pandasstringmappingcallbiopython

How to use PCcli command to generate hundreds of peptide coordinates?


There is a PCcli command [https://pypi.org/project/PeptideConstructor/] which construct the .pdb file of a given peptide sequence however I couldn't understand how to use it for hundreds of peptide sequences. Its usage for single peptide is like this:

pip install PeptideConstructor

PCcli -s AaDdKSQym -o output.pdb

Here the characters coming after -s flag is the peptide sequence and -o flag is used to name the output .pdb file. I have a list of peptide sequences in a .csv file and would like to use PCcli command to produce the .pdb's of these sequences.

Let's say I have an 100 sequences and read the 'Sequences' column with pd.read_csv.

import pandas as pd

df = pd.read_csv("PeptideSequences.csv")

Then with a for loop I tried to place every sequence line after -s flag and give the sequence name to the output .pdb files in the same manner.

for i in range(100):

    PCcli -s str(df.loc[i,'Sequences']) -o str(df.loc[i,'Sequences']).pdb

However, I got invalid syntax error. Could you please help me to use the command? I would also be grateful for alternative usage suggestions. For ex. mapping the sequences


Solution

  • You can use subprocess.call:

    from subprocess import call
    
    for seq in df['Sequences']:
        call(['PCcli', '-s', seq, '-o', f'{seq}.pdb'])