Skip to content

Commit d06c11d

Browse files
committed
Reorganize imports
1 parent e737deb commit d06c11d

10 files changed

Lines changed: 34 additions & 38 deletions

File tree

ribotricer/bam.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1414
# GNU General Public License for more details.
1515

16+
from .common import is_read_uniq_mapping
1617
from collections import Counter
1718
from collections import defaultdict
1819

@@ -21,8 +22,6 @@
2122

2223
tqdm.pandas()
2324

24-
from .common import is_read_uniq_mapping
25-
2625

2726
def split_bam(bam_path, protocol, prefix, read_lengths=None):
2827
"""Split bam by read length and strand

ribotricer/common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def _clean_input(comma_string):
113113

114114
def collapse_coverage_to_codon(coverage):
115115
"""Collapse nucleotide level coverage to codon level.
116-
116+
117117
Parameters
118118
----------
119119
coverage: list

ribotricer/count_orfs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def count_orfs_codon(
8888
):
8989
"""
9090
Create genewise codon summaries
91-
91+
9292
Parameters
9393
----------
9494
ribotricer_index: str

ribotricer/detect_orfs.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,23 @@
1313
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1414
# GNU General Public License for more details.
1515

16+
from .statistics import coherence
17+
from .plotting import plot_metagene
18+
from .plotting import plot_read_lengths
19+
from .orf import ORF
20+
from .metagene import align_metagenes
21+
from .metagene import metagene_coverage
22+
from .infer_protocol import infer_protocol
23+
from .const import MINIMUM_DENSITY_OVER_ORF
24+
from .const import MINIMUM_READS_PER_CODON
25+
from .const import MINIMUM_VALID_CODONS_RATIO
26+
from .const import MINIMUM_VALID_CODONS
27+
from .const import CUTOFF
28+
from .common import parent_dir
29+
from .common import mkdir_p
30+
from .common import collapse_coverage_to_codon
31+
from .bam import split_bam
32+
from quicksect import Interval, IntervalTree
1633
from collections import Counter
1734
from collections import defaultdict
1835
import datetime
@@ -21,24 +38,7 @@
2138
from tqdm.autonotebook import tqdm
2239

2340
tqdm.pandas()
24-
from quicksect import Interval, IntervalTree
2541

26-
from .bam import split_bam
27-
from .common import collapse_coverage_to_codon
28-
from .common import mkdir_p
29-
from .common import parent_dir
30-
from .const import CUTOFF
31-
from .const import MINIMUM_VALID_CODONS
32-
from .const import MINIMUM_VALID_CODONS_RATIO
33-
from .const import MINIMUM_READS_PER_CODON
34-
from .const import MINIMUM_DENSITY_OVER_ORF
35-
from .infer_protocol import infer_protocol
36-
from .metagene import metagene_coverage
37-
from .metagene import align_metagenes
38-
from .orf import ORF
39-
from .plotting import plot_read_lengths
40-
from .plotting import plot_metagene
41-
from .statistics import coherence
4242

4343
# Required for IntervalTree
4444
STRAND_TO_NUM = {"+": 1, "-": -1}

ribotricer/infer_protocol.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def infer_protocol(bam, gene_interval_tree, prefix, n_reads=20000):
4141
-------
4242
protocol: string
4343
forward/reverse
44-
44+
4545
The strategy to do this is simple: keep a track
4646
of mapped reads and their strand and then tally
4747
if the location of their mapping has a gene defined
@@ -52,7 +52,7 @@ def infer_protocol(bam, gene_interval_tree, prefix, n_reads=20000):
5252
Higher proportion of (++, --) implies forward protocol
5353
Higher proportion of (+-, -+) implies reverse protocol
5454
Equal proportion of the above two scenairos implies unstranded protocol.
55-
55+
5656
"""
5757
iteration = 0
5858
bam = pysam.AlignmentFile(bam, "rb")

ribotricer/learn_cutoff.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,8 @@ def determine_cutoff_bam(
166166
List of 'yes/no/reverse'
167167
rna_stranded_protocols: list
168168
List of 'yes/no/reverse'
169-
170-
169+
170+
171171
Returns
172172
-------
173173
cutoff: float

ribotricer/metagene.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1414
# GNU General Public License for more details.
1515

16+
from .statistics import coherence
17+
from .interval import Interval
18+
from .const import CUTOFF, TYPICAL_OFFSET
1619
import sys
1720
from collections import Counter, OrderedDict
1821

@@ -22,10 +25,6 @@
2225

2326
tqdm.pandas()
2427

25-
from .const import CUTOFF, TYPICAL_OFFSET
26-
from .interval import Interval
27-
from .statistics import coherence
28-
2928

3029
def next_genome_pos(ivs, max_positions, leader, trailer, reverse=False):
3130
if len(ivs) == 0:

ribotricer/orf_seq.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,15 @@
1313
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1414
# GNU General Public License for more details.
1515

16+
from .fasta import FastaReader
17+
from .interval import Interval
1618
import pandas as pd
1719
import sys
1820
from tqdm.autonotebook import tqdm
1921

2022
tqdm.pandas()
2123

2224

23-
from .interval import Interval
24-
from .fasta import FastaReader
25-
26-
2725
def translate_nt_to_aa(seq):
2826
codon_table = {
2927
"ATA": "I",
@@ -108,7 +106,7 @@ def translate_nt_to_aa(seq):
108106

109107
def orf_seq(ribotricer_index, genome_fasta, saveto, translate=False):
110108
"""Generate sequence for ribotricer annotation.
111-
109+
112110
Parameters
113111
-----------
114112

ribotricer/prepare_orfs.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def tracks_to_ivs(tracks):
3434
----------
3535
tracks: List[GTFTrack]
3636
list of gtf tracks
37-
37+
3838
Returns
3939
-------
4040
intervals: List[Interval]
@@ -228,7 +228,7 @@ def check_orf_type(orf, cds_orfs):
228228
otype: str
229229
Type of the candidate ORF
230230
231-
This method uses a fail-sast strategy
231+
This method uses a fail-fast strategy
232232
and hence multiple returns.
233233
"""
234234
if orf.gid not in cds_orfs:

ribotricer/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ def _nucleotide_to_codon_profile(profile):
357357

358358
def summarize_profile_to_codon_level(detected_orfs, saveto):
359359
"""Collapse nucleotide level profiles in ribotricer to codon leve.
360-
360+
361361
Parameters
362362
----------
363363
ribotricer_output: string
@@ -407,7 +407,7 @@ def translate(seq):
407407

408408
def learn_ribotricer_cutoff(roc_input_file):
409409
"""Learn ribotricer phase score cutoff
410-
410+
411411
Parameters
412412
----------
413413
roc_input_file: str

0 commit comments

Comments
 (0)