Mercurial > repos > jay > pdaug_aa_property_based_peptide_generation
view PDAUG_Peptide_Global_Descriptors/PDAUG_Peptide_Global_Descriptors.py @ 7:e64307e1733b draft
"planemo upload for repository https://github.com/jaidevjoshi83/pdaug commit 32b9c48c81639a81be24bb3e2f48dc0a81c0deca"
author | jay |
---|---|
date | Sun, 09 Jan 2022 05:06:26 +0000 |
parents | 1199b572b86c |
children |
line wrap: on
line source
from modlamp.descriptors import * import os import pandas as pd def Descriptor_calcultor(DesType, inputfile, ph, amide,OutFile ): list_pep_name = [] f = open(inputfile) lines = f.readlines() for line in lines: if ">" in line: pass else: list_pep_name.append(line.strip('\n')) desc = GlobalDescriptor(list_pep_name) if DesType == "Length": desc.length() df = desc.descriptor dfN = desc.featurenames elif DesType == "Weight": desc.calculate_MW() df = desc.descriptor dfN = desc.featurenames elif DesType == "Charge": desc.calculate_charge(ph=int(ph), amide=amide) df = desc.descriptor dfN = desc.featurenames elif DesType == "ChargeDensity": desc.charge_density(ph=int(ph), amide=amide) df = desc.descriptor dfN = desc.featurenames elif DesType == "IsoelectricPoint": desc.isoelectric_point(amide=amide) df = desc.descriptor dfN = desc.featurenames elif DesType == "InstabilityIndex": desc.instability_index() df = desc.descriptor dfN = desc.featurenames elif DesType == "Aromaticity": desc.aromaticity() df = desc.descriptor dfN = desc.featurenames elif DesType == "AliphaticIndex": desc.aliphatic_index() df = desc.descriptor dfN = desc.featurenames elif DesType == "BomanIndex": desc.boman_index() df = desc.descriptor dfN = desc.featurenames elif DesType == "HydrophobicRatio": desc.hydrophobic_ratio() df = desc.descriptor dfN = desc.featurenames elif DesType == "All": desc.calculate_all(ph=int(ph), amide=amide) df = desc.descriptor dfN = desc.featurenames else: pass df = desc.descriptor dfN = desc.featurenames dfOut = pd.DataFrame(df,columns=dfN) dfOut.to_csv(OutFile, index=False, sep='\t') if __name__=="__main__": import argparse parser = argparse.ArgumentParser() parser.add_argument("-t", "--DesType", required=True, default=None, help="Descriptors Type") parser.add_argument("-i", "--InFile", required=True, default=None, help="Peptide File") parser.add_argument("-p", "--Ph", required=False, default=7.0, help="Ph 0-14") parser.add_argument("-a", "--Amide", required=False, default="True", help="True or False") parser.add_argument("-O", "--OutFile", required=False, default="out.tsv", help="True or False") args = parser.parse_args() Descriptor_calcultor(args.DesType, args.InFile, args.Ph, args.Amide, args.OutFile)