Compare commits
18 Commits
419adcd098
...
master
Author | SHA1 | Date | |
---|---|---|---|
f08e4c7d35 | |||
2f49699a23 | |||
9d97ee6244 | |||
bfeec68756 | |||
ba4a532784 | |||
b047b6f8fc | |||
d1b3993011 | |||
ad8fe00479 | |||
df132814c8 | |||
9b56853e36 | |||
0cc3539280 | |||
2c38d7d172 | |||
3ca07feade | |||
cf9df14fce | |||
8b379198ec | |||
43758c45f8 | |||
f74fea0b24 | |||
eccb08153e |
11
.devcontainer/Dockerfile
Normal file
11
.devcontainer/Dockerfile
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
FROM mcr.microsoft.com/devcontainers/anaconda:1-3
|
||||||
|
|
||||||
|
# Copy environment.yml (if found) to a temp location so we update the environment. Also
|
||||||
|
# copy "noop.txt" so the COPY instruction does not fail if no environment.yml exists.
|
||||||
|
COPY environment.yml* .devcontainer/noop.txt /tmp/conda-tmp/
|
||||||
|
RUN if [ -f "/tmp/conda-tmp/environment.yml" ]; then umask 0002 && /opt/conda/bin/conda env update -n base -f /tmp/conda-tmp/environment.yml; fi \
|
||||||
|
&& rm -rf /tmp/conda-tmp
|
||||||
|
|
||||||
|
# [Optional] Uncomment this section to install additional OS packages.
|
||||||
|
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
|
||||||
|
# && apt-get -y install --no-install-recommends <your-package-list-here>
|
35
.devcontainer/devcontainer.json
Normal file
35
.devcontainer/devcontainer.json
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
|
||||||
|
// README at: https://github.com/devcontainers/templates/tree/main/src/anaconda
|
||||||
|
{
|
||||||
|
"name": "Anaconda (Python 3)",
|
||||||
|
"build": {
|
||||||
|
"context": "..",
|
||||||
|
"dockerfile": "Dockerfile"
|
||||||
|
},
|
||||||
|
"customizations": {
|
||||||
|
"vscode": {
|
||||||
|
"extensions": [
|
||||||
|
"ms-python.debugpy",
|
||||||
|
"ms-python.python",
|
||||||
|
"ms-python.vscode-pylance",
|
||||||
|
"ms-python.black-formatter",
|
||||||
|
"ms-python.flake8"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Features to add to the dev container. More info: https://containers.dev/features.
|
||||||
|
// "features": {},
|
||||||
|
|
||||||
|
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
||||||
|
// "forwardPorts": [],
|
||||||
|
|
||||||
|
// Use 'postCreateCommand' to run commands after the container is created.
|
||||||
|
// "postCreateCommand": "python --version",
|
||||||
|
|
||||||
|
// Configure tool-specific properties.
|
||||||
|
// "customizations": {},
|
||||||
|
|
||||||
|
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
|
||||||
|
// "remoteUser": "root"
|
||||||
|
}
|
3
.devcontainer/noop.txt
Normal file
3
.devcontainer/noop.txt
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
This file copied into the container along with environment.yml* from the parent
|
||||||
|
folder. This file is included to prevents the Dockerfile COPY instruction from
|
||||||
|
failing if no environment.yml is found.
|
9
.vscode/launch.json
vendored
9
.vscode/launch.json
vendored
@@ -8,15 +8,16 @@
|
|||||||
"name": "Splitter Single Gene with Translation",
|
"name": "Splitter Single Gene with Translation",
|
||||||
"type": "python",
|
"type": "python",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"program": "${workspaceFolder}/msa_splitter.py",
|
"program": "${workspaceFolder}/splitmsa/splitmsa.py",
|
||||||
"args": [
|
"args": [
|
||||||
"${workspaceFolder}/tests/resources/test_msa-shortened.fa",
|
"${workspaceFolder}/tests/resources/test_msa-shortened.fa",
|
||||||
"--gene-list", "${workspaceFolder}/tests/resources/gene_list.csv",
|
"--gene-list",
|
||||||
|
"${workspaceFolder}/tests/resources/gene_list.csv",
|
||||||
"-C",
|
"-C",
|
||||||
"-E", "DEBUG",
|
"-E",
|
||||||
|
"DEBUG",
|
||||||
"--do-translate",
|
"--do-translate",
|
||||||
"--gen-cut-stop-codon"
|
"--gen-cut-stop-codon"
|
||||||
|
|
||||||
],
|
],
|
||||||
"console": "integratedTerminal",
|
"console": "integratedTerminal",
|
||||||
"justMyCode": true
|
"justMyCode": true
|
||||||
|
42
Jenkinsfile
vendored
Normal file
42
Jenkinsfile
vendored
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
pipeline {
|
||||||
|
agent {
|
||||||
|
kubernetes {
|
||||||
|
cloud 'Reslate Systems'
|
||||||
|
defaultContainer 'conda'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stages {
|
||||||
|
stage("install") {
|
||||||
|
steps {
|
||||||
|
sh 'conda update conda -y -q'
|
||||||
|
sh 'conda env update -n base --file environment.yml'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage("build") {
|
||||||
|
steps {
|
||||||
|
sh "conda run -n base python -m build"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage("test") {
|
||||||
|
steps {
|
||||||
|
sh "conda run -n base pip install dist/*.whl"
|
||||||
|
sh "conda run -n base splitmsa -h"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage("archive") {
|
||||||
|
steps {
|
||||||
|
archiveArtifacts artifacts: 'dist/*.tar.gz, dist/*.whl'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage("publish") {
|
||||||
|
when {
|
||||||
|
branch '**/master'
|
||||||
|
}
|
||||||
|
steps {
|
||||||
|
withCredentials([usernamePassword(credentialsId: 'rs-git-package-registry-ydeng', passwordVariable: 'PASS', usernameVariable: 'USER')]) {
|
||||||
|
sh returnStatus: true, script: 'conda run -n base python -m twine upload --repository-url https://git.reslate.systems/api/packages/${USER}/pypi -u ${USER} -p ${PASS} --non-interactive --disable-progress-bar --verbose dist/*'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -1,4 +1,4 @@
|
|||||||
# MSA Splitter
|
# SplitMSA
|
||||||
|
|
||||||
Simple FASTA file splitter. Capable of batch trimming a large amount of sequences in the form of a MSA in a FASTA file.
|
Simple FASTA file splitter. Capable of batch trimming a large amount of sequences in the form of a MSA in a FASTA file.
|
||||||
|
|
||||||
|
@@ -1,46 +0,0 @@
|
|||||||
name: /home/ydeng/msa-splitter/envs
|
|
||||||
channels:
|
|
||||||
- conda-forge
|
|
||||||
dependencies:
|
|
||||||
- _libgcc_mutex=0.1=conda_forge
|
|
||||||
- _openmp_mutex=4.5=2_gnu
|
|
||||||
- biopython=1.81=py311h2582759_0
|
|
||||||
- black=23.3.0=py311h38be061_0
|
|
||||||
- bzip2=1.0.8=h7f98852_4
|
|
||||||
- ca-certificates=2022.12.7=ha878542_0
|
|
||||||
- click=8.1.3=unix_pyhd8ed1ab_2
|
|
||||||
- ld_impl_linux-64=2.40=h41732ed_0
|
|
||||||
- libblas=3.9.0=16_linux64_openblas
|
|
||||||
- libcblas=3.9.0=16_linux64_openblas
|
|
||||||
- libexpat=2.5.0=hcb278e6_1
|
|
||||||
- libffi=3.4.2=h7f98852_5
|
|
||||||
- libgcc-ng=12.2.0=h65d4601_19
|
|
||||||
- libgfortran-ng=12.2.0=h69a702a_19
|
|
||||||
- libgfortran5=12.2.0=h337968e_19
|
|
||||||
- libgomp=12.2.0=h65d4601_19
|
|
||||||
- liblapack=3.9.0=16_linux64_openblas
|
|
||||||
- libnsl=2.0.0=h7f98852_0
|
|
||||||
- libopenblas=0.3.21=pthreads_h78a6416_3
|
|
||||||
- libsqlite=3.40.0=h753d276_0
|
|
||||||
- libstdcxx-ng=12.2.0=h46fd767_19
|
|
||||||
- libuuid=2.38.1=h0b41bf4_0
|
|
||||||
- libzlib=1.2.13=h166bdaf_4
|
|
||||||
- mypy_extensions=1.0.0=pyha770c72_0
|
|
||||||
- ncurses=6.3=h27087fc_1
|
|
||||||
- numpy=1.24.2=py311h8e6699e_0
|
|
||||||
- openssl=3.1.0=h0b41bf4_0
|
|
||||||
- packaging=23.0=pyhd8ed1ab_0
|
|
||||||
- pathspec=0.11.1=pyhd8ed1ab_0
|
|
||||||
- pip=23.0.1=pyhd8ed1ab_0
|
|
||||||
- platformdirs=3.2.0=pyhd8ed1ab_0
|
|
||||||
- python=3.11.1=h2755cc3_0_cpython
|
|
||||||
- python_abi=3.11=3_cp311
|
|
||||||
- readline=8.2=h8228510_1
|
|
||||||
- setuptools=67.6.1=pyhd8ed1ab_0
|
|
||||||
- tk=8.6.12=h27826a3_0
|
|
||||||
- typing-extensions=4.5.0=hd8ed1ab_0
|
|
||||||
- typing_extensions=4.5.0=pyha770c72_0
|
|
||||||
- tzdata=2023c=h71feb2d_0
|
|
||||||
- wheel=0.40.0=pyhd8ed1ab_0
|
|
||||||
- xz=5.2.6=h166bdaf_0
|
|
||||||
prefix: /home/ydeng/msa-splitter/envs
|
|
9
environment.yml
Normal file
9
environment.yml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
name: splitmsa
|
||||||
|
channels:
|
||||||
|
- conda-forge
|
||||||
|
dependencies:
|
||||||
|
- build=0.7.0
|
||||||
|
- pytest=7.2.2
|
||||||
|
- twine
|
||||||
|
- biopython=1.81
|
||||||
|
- python=3.9
|
3
pyproject.toml
Normal file
3
pyproject.toml
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
[build-system]
|
||||||
|
build-backend = "setuptools.build_meta"
|
||||||
|
requires = ["setuptools", "wheel"]
|
@@ -1 +0,0 @@
|
|||||||
Bio==1.5.6
|
|
12
setup.cfg
Normal file
12
setup.cfg
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
[metadata]
|
||||||
|
name = splitmsa
|
||||||
|
version = 0.0.4
|
||||||
|
|
||||||
|
[options]
|
||||||
|
packages = splitmsa
|
||||||
|
install_requires =
|
||||||
|
biopython ==1.81; python_version == "3.9"
|
||||||
|
|
||||||
|
[options.entry_points]
|
||||||
|
console_scripts =
|
||||||
|
splitmsa = splitmsa.splitmsa:main
|
0
splitmsa/__init__.py
Normal file
0
splitmsa/__init__.py
Normal file
@@ -203,7 +203,7 @@ def trim(
|
|||||||
)
|
)
|
||||||
|
|
||||||
if perform_translation and not skip_translation:
|
if perform_translation and not skip_translation:
|
||||||
if '-' in nt_sequence:
|
if "-" in nt_sequence:
|
||||||
sequence_with_ambiguity = []
|
sequence_with_ambiguity = []
|
||||||
for codon_in_sequence in range(0, len(nt_sequence), 3):
|
for codon_in_sequence in range(0, len(nt_sequence), 3):
|
||||||
codon = nt_sequence[codon_in_sequence : codon_in_sequence + 3]
|
codon = nt_sequence[codon_in_sequence : codon_in_sequence + 3]
|
||||||
@@ -247,9 +247,7 @@ def output_as_csv(gene: str, problems: list[list[str]], output_path: str):
|
|||||||
writer.writerows(problems)
|
writer.writerows(problems)
|
||||||
|
|
||||||
|
|
||||||
def main(args):
|
def run(args):
|
||||||
logging.basicConfig(level=args.log_level.upper())
|
|
||||||
|
|
||||||
msa_records = list(read_msa_file(args.input))
|
msa_records = list(read_msa_file(args.input))
|
||||||
info(f"MSA records read complete. Found {len(msa_records)} records.")
|
info(f"MSA records read complete. Found {len(msa_records)} records.")
|
||||||
genes = []
|
genes = []
|
||||||
@@ -310,9 +308,9 @@ def main(args):
|
|||||||
info(f"Completed gene {gene_name} ({start} - {end})")
|
info(f"Completed gene {gene_name} ({start} - {end})")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
def main():
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
prog="msa_splitter",
|
prog="splitmsa",
|
||||||
description="""
|
description="""
|
||||||
The MSA splitter is a simple program that takes in two positions
|
The MSA splitter is a simple program that takes in two positions
|
||||||
and a MSA file and produces two separate FASTA files
|
and a MSA file and produces two separate FASTA files
|
||||||
@@ -453,4 +451,10 @@ if __name__ == "__main__":
|
|||||||
action="store_true",
|
action="store_true",
|
||||||
)
|
)
|
||||||
|
|
||||||
main(parser.parse_args())
|
args = parser.parse_args()
|
||||||
|
logging.basicConfig(level=args.log_level.upper())
|
||||||
|
run(args)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
Reference in New Issue
Block a user