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

Load optional species file in launcher (#48)

parent b44ed5e2
......@@ -74,8 +74,33 @@ class SpeciesEntry(object):
def getOutputRow(self):
return '\t'.join([self.cedalionId, self.longName, self.role, self.plazaId, self.proteome, self.cds, self.gff3])
def parseSpeciesFile(species_file_name):
import csv
entries=[]
with open(species_file_name) as species_file:
reader = csv.DictReader(species_file, delimiter='\t')
for row in reader:
entry = SpeciesEntry(cedalionId=row['name'],
longName=row['long_name'] if row['long_name'] else '',
role=row['type'] if row['type'] else '',
plazaId=row['plaza_id'] if row['plaza_id'] else '',
proteome=row['proteome'] if row['proteome'] else '',
cds=row['cds'] if row['cds'] else '',
gff3=row['gff3'] if row['gff3'] else ''
)
entries.append(entry)
return entries
@click.command()
def prompt():
@click.argument('species_file',
nargs=1, required=False,
type=click.Path(exists=True)
)
def prompt(species_file):
"""
This is the Cedalion launcher.
......@@ -85,6 +110,8 @@ def prompt():
Also, a bash script will be generated that can launch a Cedalion run.
It is advised to check and complete both the species file and the launch script before actually starting the pipeline.
SPECIES_FILE : existing species file (optional)
"""
def listSpecies():
......@@ -402,7 +429,11 @@ def prompt():
'h': helpDoc
}
entries = []
if species_file:
entries = parseSpeciesFile(species_file)
else:
entries = []
choice = ''
print("This is the interactive Cedalion Launcher.")
......@@ -414,6 +445,7 @@ def prompt():
print()
print("Enter 'h' for a list of commands.")
print()
while True:
choice = input("What now> ")
if choice:
......
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