Commit 765b2492 authored by Thomas Van Parys's avatar Thomas Van Parys
Browse files

Make linter happy

parent 84f68594
#!/usr/bin/env python3
import readline
import attr
import sys
import click
......@@ -11,6 +10,7 @@ from prettytable import PrettyTable
import cedalion.scripts.plaza_api as plaza
class bcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
......@@ -48,7 +48,6 @@ class bcolors:
return bcolors.FAIL + msg + bcolors.ENDC
@attr.s
class SpeciesEntry(object):
cedalionId: str = attr.ib()
......@@ -79,10 +78,11 @@ class SpeciesEntry(object):
def getAsList(self):
return [self.cedalionId, self.longName, self.role, self.plazaId, self.proteome, self.cds, self.gff3]
def parseSpeciesFile(species_file_name):
import csv
entries=[]
entries = []
with open(species_file_name) as species_file:
reader = csv.DictReader(species_file, delimiter='\t')
for row in reader:
......@@ -137,14 +137,12 @@ def prompt(species_file):
print(table)
def quitPrompt():
confirm = input("Quit. Are you sure? (y/N)> ")
if confirm == 'y':
print("Bye!")
sys.exit()
def addSpecies():
print()
cId = input("New Cedalion ID> ")
......@@ -179,7 +177,6 @@ def prompt(species_file):
if confirm == 'y':
del entries[speciesNr]
def getEntryDetails(thisEntry):
output = []
output.append("\t{}: {}".format(bcolors.markOption(SpeciesEntry.contentNames['name'],'I'), thisEntry.cedalionId))
......@@ -193,7 +190,6 @@ def prompt(species_file):
details = '\n'.join(output)
return details
def editSpecies(entryNr):
entryNr = entryNr - 1
......@@ -207,7 +203,7 @@ def prompt(species_file):
print("Entering '-' will erase the current value.")
print()
##Edit prompt
#Edit prompt
def editCedalionId():
value = input("{} ({})> ".format(SpeciesEntry.contentNames['name'], thisEntry.cedalionId))
......@@ -219,7 +215,6 @@ def prompt(species_file):
if value:
thisEntry.longName = value if value!='-' else ''
def editRole():
roles = {'n': 'new',
'b': 'background',
......@@ -251,7 +246,6 @@ def prompt(species_file):
if value:
thisEntry.proteome = value if value!='-' else ''
def editCds():
value = input("{} ({})> ".format(SpeciesEntry.contentNames['cds'], thisEntry.cds))
thisEntry.cds = value if value!='-' else ''
......@@ -260,7 +254,6 @@ def prompt(species_file):
value = input("{} ({})> ".format(SpeciesEntry.contentNames['gff3'], thisEntry.gff3))
thisEntry.gff3 = value if value!='-' else ''
editOptions = {
'i': editCedalionId,
'l': editLongName,
......@@ -279,13 +272,11 @@ def prompt(species_file):
print()
print(getEntryDetails(thisEntry))
def generateLaunchScript():
runName = input("Cedalion run name> ")
launchScript = "launch_{}.sh".format(runName)
## Get main Nextflow pipeline script
# Get main Nextflow pipeline script
main_nf = 'main.nf'
modpath, modfile = os.path.split(__file__)
cedpath, mod = os.path.split(modpath)
......@@ -399,7 +390,6 @@ def prompt(species_file):
return approved
def save():
approved = checkList()
if not approved:
......@@ -418,8 +408,6 @@ def prompt(species_file):
print("Bye!")
sys.exit()
def helpDoc():
helpList = [
......@@ -431,7 +419,7 @@ def prompt(species_file):
'help',
'quit'
]
helpList = [ '\t' + bcolors.markPosition(line, 0) for line in helpList]
helpList = ['\t' + bcolors.markPosition(line, 0) for line in helpList]
print()
for line in helpList:
......@@ -478,11 +466,10 @@ def prompt(species_file):
editChoice = int(choice)
if editChoice > 0 and editChoice <= len(entries):
editSpecies(editChoice)
except:
except ValueError:
# Ignore non-numeric input
pass
if __name__ == '__main__':
prompt()
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