Commit f5e729b6 authored by Thomas Van Parys's avatar Thomas Van Parys
Browse files

Use PrettyTables in launcher (fixes #50)

parent e472f8fa
...@@ -7,6 +7,8 @@ import click ...@@ -7,6 +7,8 @@ import click
import re import re
import os import os
from prettytable import PrettyTable
import cedalion.scripts.plaza_api as plaza import cedalion.scripts.plaza_api as plaza
class bcolors: class bcolors:
...@@ -74,6 +76,8 @@ class SpeciesEntry(object): ...@@ -74,6 +76,8 @@ class SpeciesEntry(object):
def getOutputRow(self): def getOutputRow(self):
return '\t'.join([self.cedalionId, self.longName, self.role, self.plazaId, self.proteome, self.cds, self.gff3]) return '\t'.join([self.cedalionId, self.longName, self.role, self.plazaId, self.proteome, self.cds, self.gff3])
def getAsList(self):
return [self.cedalionId, self.longName, self.role, self.plazaId, self.proteome, self.cds, self.gff3]
def parseSpeciesFile(species_file_name): def parseSpeciesFile(species_file_name):
import csv import csv
...@@ -115,16 +119,24 @@ def prompt(species_file): ...@@ -115,16 +119,24 @@ def prompt(species_file):
""" """
def listSpecies(): def listSpecies():
header = '\t'.join(SpeciesEntry.contentNames) table = PrettyTable()
hr = '---------------------------------------------------------------------------------------------------------' table.field_names = [''] + list(SpeciesEntry.contentNames.values())
print()
print('\t'+header) table.align[''] = 'r'
print(hr) table.align['Cedalion ID'] = 'l'
table.align['Role'] = 'l'
table.align['Plaza ID'] = 'l'
table.align['Proteome file'] = 'l'
table.align['CDS file'] = 'l'
table.align['GFF3 file'] = 'l'
n = 1 n = 1
for e in entries: for e in entries:
print("\t{}: {}".format(bcolors.mark(str(n)), e.getOutputRow())) table.add_row([bcolors.mark(str(n))] + e.getAsList())
n += 1 n += 1
print(table)
def quitPrompt(): def quitPrompt():
confirm = input("Quit. Are you sure? (y/N)> ") confirm = input("Quit. Are you sure? (y/N)> ")
......
...@@ -34,6 +34,7 @@ setup_args = dict( ...@@ -34,6 +34,7 @@ setup_args = dict(
'pillow==5.2.*', 'pillow==5.2.*',
'seaborn==0.9.*', 'seaborn==0.9.*',
'scipy==1.1.*', 'scipy==1.1.*',
'prettytable~=0.7.2'
], ],
extras_require={ extras_require={
'dev': [ 'dev': [
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment