Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions bcftbx/cli/analyse_solid_run.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python
#
# analyse_solid_run.py: analyse and report on SOLiD sequencer runs
# Copyright (C) University of Manchester 2011-2021 Peter Briggs
# Copyright (C) University of Manchester 2011-2026 Peter Briggs

"""
Provides functionality for analysing a SOLiD run, to verify and report data
Expand All @@ -22,10 +22,10 @@
import argparse
import logging
logging.basicConfig(format="%(levelname)s %(message)s")
from ..SolidData import SolidRun
from ..SolidData import list_run_directories
from ..Experiment import Experiment
from ..Md5sum import md5sum
from ..platforms.solid.data import RunDir
from ..platforms.solid.data import list_run_directories
from ..platforms.solid.experiment import Experiment
from ..utils.checksums import md5sum
from ..Spreadsheet import Spreadsheet
from .. import get_version

Expand All @@ -41,7 +41,7 @@ def report_run(solid_runs,report_paths=False):
etc.

Arguments:
solid_runs: a list or tuple of SolidRun objects to report.
solid_runs: a list or tuple of 'RunDir' objects to report.
report_paths: if True then also report the full paths for the
primary data files for each library.
"""
Expand Down Expand Up @@ -104,7 +104,7 @@ def write_spreadsheet(solid_runs,spreadsheet):
input.

Arguments:
solid_runs: a list or tuple of SolidRun objects to report.
solid_runs: a list or tuple of 'RunDir' objects to report.
spreadsheet: the name of the XLS-format spreadsheet to write
the data
"""
Expand Down Expand Up @@ -234,13 +234,13 @@ def write_spreadsheet(solid_runs,spreadsheet):
def suggest_analysis_layout(solid_runs):
"""Generate a bash script to build the analysis directory scheme

Given a set of SolidRuns, print a set of script commands for running the
Given a set of 'RunDir' instances, print a set of script commands for running the
build_analysis_dir.py program to create and populate the analysis directories.

The script can be edited before being executed by the user.

Arguments:
solid_runs: a list of SolidRun objects.
solid_runs: a list of RunDir objects.
"""
print("#!/bin/sh\n#\n# Script commands to build analysis directory structure")
for run in solid_runs:
Expand All @@ -267,7 +267,7 @@ def suggest_analysis_layout(solid_runs):
def suggest_rsync_command(solid_runs):
"""Generate a bash script to rsync data to another location

Given a set of SolidRuns, print a set of script commands for running rsync
Given a set of 'RunDir' instances, print a set of script commands for running rsync
to copy the data directories to another location.

The script should be edited before being executed by the user.
Expand All @@ -285,7 +285,7 @@ def suggest_rsync_command(solid_runs):
def verify_runs(solid_dirs):
"""Do basic verification checks on SOLiD run directories

For each SOLiD run directory, create a SolidRun object and check for the
For each SOLiD run directory, create a 'RunDir' object and check for the
expected sample and library directories, and that primary data files
(csfasta and qual) have been assigned and exist.

Expand All @@ -303,7 +303,7 @@ def verify_runs(solid_dirs):
for solid_dir in solid_dirs:
# Initialise
run_status = 0
run = SolidRun(solid_dir)
run = RunDir(solid_dir)
if not run.verify():
run_status = 1
print("%s:" % run.run_name,)
Expand Down Expand Up @@ -341,7 +341,7 @@ def copy_data(solid_runs,library_defns):
The files are copied to the current directory.

Arguments:
solid_runs: list of populated SolidRun objects
solid_runs: list of populated 'RunDir' objects
library_defns: list of library definition strings (see above
for syntax/format)
"""
Expand Down Expand Up @@ -388,7 +388,7 @@ def gzip_data(solid_runs,library_defns):
Gzipped copies of the files are made in the current directory.

Arguments:
solid_runs: list of populated SolidRun objects
solid_runs: list of populated 'RunDir' objects
library_defns: list of library definition strings (see above
for syntax/format)
"""
Expand Down Expand Up @@ -449,7 +449,7 @@ def md5_checksums(solid_runs,library_defns):
Md5 sums are calculated and printed for each matching primary data file.

Arguments:
solid_runs: list of populated SolidRun objects
solid_runs: list of populated 'RunDir' objects
library_defns: list of library definition strings (see above
for syntax/format)
"""
Expand Down Expand Up @@ -609,7 +609,7 @@ def main():
# Get the run information
solid_runs = []
for solid_dir in solid_dirs:
run = SolidRun(solid_dir)
run = RunDir(solid_dir)
if not run:
logging.error("Error extracting run data for %s" % solid_dir)
sys.exit(1)
Expand Down
7 changes: 3 additions & 4 deletions bcftbx/cli/best_exons.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python
#
# best_exons.py: pick 'best' exons for gene symbols and average data
# Copyright (C) University of Manchester 2013-2021 Peter Briggs
# Copyright (C) University of Manchester 2013-2026 Peter Briggs
#
########################################################################

Expand Down Expand Up @@ -54,15 +54,14 @@
# Imports
#########################################################################

from builtins import str
import sys
import os
import io
import argparse
import logging
from operator import attrgetter
from bcftbx.TabFile import TabFileIterator
from bcftbx.utils import OrderedDictionary
from bcftbx.io.tabular import TabFileIterator
from bcftbx.utils.collections import OrderedDictionary
from .. import get_version

########################################################################
Expand Down
12 changes: 4 additions & 8 deletions bcftbx/cli/extract_reads.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python
#
# extract_reads.py: write random subsets of read records from input files
# Copyright (C) University of Manchester 2012-2021 Peter Briggs
# Copyright (C) University of Manchester 2012-2026 Peter Briggs
#

"""
Expand All @@ -19,18 +19,14 @@
# Imports
#######################################################################

from builtins import str
from builtins import range
import sys
import os
import io
import gzip
import argparse
import random
import re
from ..ngsutils import getreads
from ..ngsutils import getreads_subset
from ..ngsutils import getreads_regex
from ..utils.ngs import getreads
from ..utils.ngs import getreads_subset
from ..utils.ngs import getreads_regex
from .. import get_version

#######################################################################
Expand Down
10 changes: 4 additions & 6 deletions bcftbx/cli/fastq_strand.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
#!/usr/bin/env python
#
# fastq_strand.py: determine strandedness of fastq pair using STAR
# Copyright (C) University of Manchester 2017-2022 Peter Briggs
# Copyright (C) University of Manchester 2017-2026 Peter Briggs
#

#######################################################################
# Imports
#######################################################################

from builtins import str
from builtins import range
import sys
import os
import io
Expand All @@ -19,9 +17,9 @@
import subprocess
import shutil
import logging
from ..utils import find_program
from ..ngsutils import getreads
from ..ngsutils import getreads_subset
from ..utils.os import find_program
from ..utils.ngs import getreads
from ..utils.ngs import getreads_subset
from ..qc.report import strip_ngs_extensions
from .. import get_version

Expand Down
17 changes: 8 additions & 9 deletions bcftbx/cli/make_macs_xls.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python
#
# make_macs_xls.py: Convert MACS output file to XLS spreadsheet
# Copyright (C) University of Manchester 2011-2021 Peter Briggs
# Copyright (C) University of Manchester 2011-2026 Peter Briggs
#


Expand All @@ -23,7 +23,6 @@
# Imports
#######################################################################

from builtins import str
import os
import io
import sys
Expand All @@ -32,7 +31,7 @@
# Configure logging output
logging.basicConfig(format="[%(levelname)s] %(message)s")

from ..TabFile import TabFile
from ..io.tabular import TabFile
from ..Spreadsheet import Workbook
from .. import get_version

Expand Down Expand Up @@ -84,7 +83,7 @@ def main():
header.append(line.strip())
else:
# Data
data.append(tabdata=line.strip())
data.append(line.strip())
fp.close()

# Temporarily remove first line
Expand Down Expand Up @@ -114,19 +113,19 @@ def main():
data.sort(lambda line: line['-10*log10(pvalue)'],reverse=True)

# Restore first line
data.insert(0,tabdata=header_line)
data.insert(0, header_line)

# Insert "order" column
data.appendColumn("order")
data.append_column("order")
# Perhaps confusingly must also insert initial value "#order"
data[0]['order'] = "#order"
for i in range(1,len(data)):
data[i]['order'] = i
# Reorder columns to put it at the start
data = data.reorderColumns(['order','chr','start','end','length','summit','tags',
'-10*log10(pvalue)','fold_enrichment','FDR(%)'])
data = data.reorder(['order','chr','start','end','length','summit','tags',
'-10*log10(pvalue)','fold_enrichment','FDR(%)'])

# Legnds text
# Legends text
legends_text = """order\tSorting order Pvalue and FE
chr\tChromosome location of binding region
start\tStart coordinate of binding region
Expand Down
8 changes: 4 additions & 4 deletions bcftbx/cli/md5checker.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python
#
# md5checker.py: check files and directories using md5 checksums
# Copyright (C) University of Manchester 2012-2022 Peter Briggs
# Copyright (C) University of Manchester 2012-2026 Peter Briggs
#

"""
Expand All @@ -20,9 +20,9 @@
import io
import argparse
import logging
from ..Md5sum import md5sum
from ..Md5sum import Md5CheckReporter
from ..Md5sum import Md5Checker
from ..utils.checksums import md5sum
from ..utils.checksums import Md5CheckReporter
from ..utils.checksums import Md5Checker
from .. import get_version

#######################################################################
Expand Down
6 changes: 3 additions & 3 deletions bcftbx/cli/prep_sample_sheet.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python
#
# prep_sample_sheet.py: prepare sample sheet file for Illumina sequencers
# Copyright (C) University of Manchester 2012-2025 Peter Briggs
# Copyright (C) University of Manchester 2012-2026 Peter Briggs

"""
Prepare sample sheet file for Illumina sequencers.
Expand All @@ -18,8 +18,8 @@
import pydoc
from ..platforms.illumina.samplesheet import SampleSheet
from ..platforms.illumina.samplesheet import SampleSheetPredictor
from ..utils import parse_lanes
from ..utils import parse_named_lanes
from ..utils.parser import parse_lanes
from ..utils.parser import parse_named_lanes
from .. import get_version

#######################################################################
Expand Down
9 changes: 4 additions & 5 deletions bcftbx/cli/split_fastq.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
#!/usr/bin/env python
#
# split_fastq.py: split Fastq by lane
# Copyright (C) University of Manchester 2018-2025 Peter Briggs
# Copyright (C) University of Manchester 2018-2026 Peter Briggs
#

#######################################################################
# Imports
#######################################################################

from builtins import str
import argparse
import re
import os
import io
from ..platforms.illumina.utils import IlluminaFastq
from ..platforms.illumina.exceptions import IlluminaError
from ..utils import parse_lanes
from ..ngsutils import getreads
from ..ngsutils import getreads_regex
from ..utils.parser import parse_lanes
from ..utils.ngs import getreads
from ..utils.ngs import getreads_regex
from .. import get_version

#######################################################################
Expand Down
Loading