-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #272 from BuysDB/DamID
DamID update
- Loading branch information
Showing
27 changed files
with
3,226 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,24 @@ | ||
name: Python application | ||
|
||
on: [push] | ||
on: [push, pull_request] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Set up Python 3.7 | ||
uses: actions/setup-python@v1 | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python 3.12 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.7 | ||
python-version: 3.12 | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
# python -m pip install --upgrade pip | ||
pip install pytest | ||
pip install . | ||
pip install -r requirements.txt | ||
- name: Lint with flake8 | ||
run: | | ||
pip install flake8 | ||
# stop the build if there are Python syntax errors or undefined names | ||
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | ||
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | ||
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | ||
- name: Test with pytest | ||
run: | | ||
pip install pytest | ||
pip install . | ||
pytest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
singlecellmultiomics/fastqProcessing/fastq_filter_by_dt.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
#!/usr/bin/env python3 | ||
import argparse | ||
import gzip | ||
from more_itertools import chunked | ||
|
||
def select_datatype_fastq_pe(r1path, r2path, r1path_out, r2path_out, dt): | ||
look_for = f'dt:{dt}' | ||
with gzip.open(r1path,'rt') as r1h,\ | ||
gzip.open(r2path,'rt') as r2h,\ | ||
gzip.open(r1path_out,'wt') as r1ho,\ | ||
gzip.open(r2path_out,'wt') as r2ho: | ||
|
||
for r1,r2 in zip(chunked(r1h,4), chunked(r2h,4)): | ||
if look_for in r1[0]: | ||
r1ho.write(''.join(r1)) | ||
r2ho.write(''.join(r2)) | ||
|
||
def select_datatype_fastq_se(r1path, r1path_out, dt): | ||
look_for = f'dt:{dt}' | ||
with gzip.open(r1path,'rt') as r1h,\ | ||
gzip.open(r1path_out,'wt') as r1ho: | ||
|
||
for r1 in chunked(r1h,4): | ||
if look_for in r1[0]: | ||
r1ho.write(''.join(r1)) | ||
|
||
|
||
|
||
def run(): | ||
argparser = argparse.ArgumentParser( | ||
formatter_class=argparse.ArgumentDefaultsHelpFormatter, | ||
description="Split fastq file based on dt: tag" | ||
) | ||
|
||
argparser.add_argument( | ||
'-r1_in', | ||
type=str,required=True | ||
) | ||
argparser.add_argument( | ||
'-r2_in', | ||
type=str,required=False | ||
) | ||
argparser.add_argument( | ||
'-r1_out',help='R1 output', | ||
type=str,required=True | ||
) | ||
argparser.add_argument( | ||
'-r2_out',help='R2 output', | ||
type=str,required=False | ||
) | ||
|
||
argparser.add_argument( | ||
'-dt', | ||
help="Datatype, for example RNA or DamID", | ||
type=str,required=True | ||
) | ||
|
||
|
||
args = argparser.parse_args() | ||
if args.r2_in is not None: | ||
select_datatype_fastq_pe(args.r1_in, | ||
args.r2_in, | ||
args.r1_out, | ||
args.r2_out, | ||
args.dt) | ||
else: | ||
select_datatype_fastq_se(args.r1_in, | ||
args.r1_out, | ||
args.dt) | ||
print('Done') | ||
|
||
if __name__ == '__main__': | ||
run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.