Commit fd41416e authored by Remi  PLANEL's avatar Remi PLANEL
Browse files

update script to create fasta file and update post-procession script

parent 5ce3686f
......@@ -12,18 +12,25 @@ from itertools import chain
type=click.Path(exists=True, dir_okay=True, file_okay=True),
help="Genome input source",
@click.option("-o", "--output-dir", type=click.Path("wb"))
def convert_genomes(directory, output_dir):
"-o", "--output-dir", type=click.Path("wb"), help="path to the output dir"
@click.option("-f", "--output-format", type=str, help="output sequence format")
def convert_genomes(directory, output_dir, output_format):
genomes = gen_path_with_format(directory)
gen_genomes = gen_genomes_with_steam(genomes)
for filename, genome in gen_genomes:
write_genbank(genome, filename, output_dir)
write_genbank(genome, filename, output_dir, output_format)
def write_genbank(genome, filename, directory):
with open(Path(directory) / (filename + ".genbank"), "w") as output_handle:
def write_genbank(genome, filename, directory, sequence_format):
with open(
Path(directory) / (filename + "." + sequence_format), "w"
) as output_handle:
print("-Write file " + filename)
SeqIO.write(genome, output_handle, "genbank")
SeqIO.write(genome, output_handle, sequence_format)
def gen_path_with_format(input_str):
......@@ -31,7 +38,7 @@ def gen_path_with_format(input_str):
if input_path.is_dir():
for genome_path in chain(
map(lambda genome: ("embl", genome), input_path.rglob("*.embl")),
map(lambda genome: ("genbank", genome), input_path.rglob("*.gbk")),
map(lambda genome: ("genbank", genome), input_path.rglob("*.genbank")),
yield genome_path
# perl -i.bak -pne 's/\tRBS\t/\tShine_Dalgarno_sequence\t/' /home/rplanel/projects/legiolist-intermine/data/legiolist/genomes/gff/legiolist-gff/LpLens.genbank.gff3
python /home/rplanel/projects/legiolist-intermine/legiolist/scripts/ -d /home/rplanel/projects/legiolist-intermine/data/legiolist/genomes/genbank/ -o /home/rplanel/projects/legiolist-intermine/data/legiolist/genomes/fasta/ -f fasta
\ No newline at end of file
Supports Markdown
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