Mercurial > repos > jay > pdaug_basic_plots
view PDAUG_Peptide_Global_Descriptors/PDAUG_Peptide_Global_Descriptors.py @ 9:15b6eec94c40 draft default tip
"planemo upload for repository https://github.com/jaidevjoshi83/pdaug commit d396d7ff89705cc0dd626ed32c45a9f4029b1b05"
author | jay |
---|---|
date | Wed, 12 Jan 2022 19:47:58 +0000 |
parents | 7d247e27ff11 |
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)