Skip to content

Commit

Permalink
update sort
Browse files Browse the repository at this point in the history
  • Loading branch information
Yenaled committed Nov 21, 2023
1 parent 8d3023f commit 6017f94
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions ngs_tools/fasta/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,13 @@ def split_genomic_fasta_to_cdna(
Returns:
Path to written FASTA
"""
gene_infos_sorted = {k: gene_infos[k] for k in sorted(gene_infos)}
with Fasta(fasta_path, 'r') as f_in, Fasta(out_path, 'w') as f_out:
for entry in progress(f_in, desc='Splitting cDNA',
disable=not show_progress):
# Find all gene and transcripts in this chromosome
_gene_infos = {}
_tx_infos = {}
for gene_id, gene_attributes in gene_infos_sorted.items():
for gene_id, gene_attributes in gene_infos.items():
if gene_attributes['chromosome'] == entry.name:
_gene_infos[gene_id] = gene_attributes
_tx_infos.update({
Expand Down Expand Up @@ -101,14 +100,13 @@ def split_genomic_fasta_to_intron(
Returns:
Path to written FASTA
"""
gene_infos_sorted = {k: gene_infos[k] for k in sorted(gene_infos)}
with Fasta(fasta_path, 'r') as f_in, Fasta(out_path, 'w') as f_out:
for entry in progress(f_in, desc='Splitting introns',
disable=not show_progress):
# Find all gene and transcripts in this chromosome
_gene_infos = {}
_tx_infos = {}
for gene_id, gene_attributes in gene_infos_sorted.items():
for gene_id, gene_attributes in gene_infos.items():
if gene_attributes['chromosome'] == entry.name:
_gene_infos[gene_id] = gene_attributes
_tx_infos.update({
Expand Down Expand Up @@ -175,13 +173,12 @@ def split_genomic_fasta_to_nascent(
Returns:
Path to written FASTA
"""
gene_infos_sorted = {k: gene_infos[k] for k in sorted(gene_infos)}
with Fasta(fasta_path, 'r') as f_in, Fasta(out_path, 'w') as f_out:
for entry in progress(f_in, desc='Splitting nascent',
disable=not show_progress):
# Find all genes in this chromosome
_gene_infos = {}
for gene_id, gene_attributes in gene_infos_sorted.items():
for gene_id, gene_attributes in gene_infos.items():
if gene_attributes['chromosome'] == entry.name:
_gene_infos[gene_id] = gene_attributes
gene_name = gene_attributes.get('gene_name')
Expand Down

0 comments on commit 6017f94

Please sign in to comment.