ggirelli / fastx-barber Goto Github PK
View Code? Open in Web Editor NEWPython package to trim and extract flags from FASTA and FASTQ files.
Home Page: https://ggirelli.github.io/fastx-barber/
License: MIT License
Python package to trim and extract flags from FASTA and FASTQ files.
Home Page: https://ggirelli.github.io/fastx-barber/
License: MIT License
Describe the bug
Running e.g., time fbarber extract input.test.fastq test.trimmed.fastq.gz
will write uncompressed output to test.trimmed.fastq.gz
, as the input (input.test.fastq
) is not gzipped. The output should be correctly compressed instead or the .gz
extension should be dropped.
For all scripts.
Related to #38.
SAMtags specs: https://raw.githubusercontent.com/samtools/hts-specs/master/SAMtags.pdf
SAMv1 specs: https://raw.githubusercontent.com/samtools/hts-specs/master/SAMv1.pdf
To speed up in cases in which no perfect match is needed and the flag length is fixed, use a pattern format constituting of single-char flag names and flag lengths, e.g., "U8B8C4", indicating a "U" flag of 8, a "B" flag of 8, and a "C" flag of 4 chars, respectively, with the pattern placed at the start of the sequence.
Modes: extract, extract & trim, trim, none
An abstract class with abc.ABCMeta
as metaclass has abstract methods and is instantiated. This will result in a TypeError
as Python can't instantiate abstract class with abstract methods.
There are 3 occurrences of this issue in the repository.
See all occurrences on DeepSource → deepsource.io/gh/ggirelli/fastx-barber/issue/PYL-E0110/occurrences/
An unused variable takes up space in the code, and can lead to confusion, and it should be removed. If this variable is necessary, name the variable _
to indicate that it will be unused, or start the name with unused
or _unused
.
There are 33 occurrences of this issue in the repository.
See all occurrences on DeepSource → deepsource.io/gh/ggirelli/fastx-barber/issue/PYL-W0612/occurrences/
In fqdedup style
Is your feature request related to a problem? Please describe.
Generate summary of extracted flag values (frequency). Also make separate script that runs on fastx files with extracted flag values.
A private attribute defined in the class should be only accessible inside the class. The names of attributes which are supposed to be public should not start with _
or __
.
There is 1 occurrence of this issue in the repository.
See all occurrences on DeepSource → deepsource.io/gh/ggirelli/fastx-barber/issue/PTC-W0037/occurrences/
Do not use a mutable like list
or dictionary
as a default value to an argument. Python’s default arguments are evaluated once when the function is defined. Using a mutable default argument and mutating it will mutate that object for all future calls to the function as well.
There is 1 occurrence of this issue in the repository.
See all occurrences on DeepSource → deepsource.io/gh/ggirelli/fastx-barber/issue/PYL-W0102/occurrences/
Allow to split output based on the value of selected flags.
It is customary for instance or class methods to take self
or cls
, respectively, as their first arguments, a method that uses either of these names but is found to be a static method may have been defined incorrectly. Choose names other than self
or cls
for arguments to avoid …
There is 1 occurrence of this issue in the repository.
See all occurrences on DeepSource → deepsource.io/gh/ggirelli/fastx-barber/issue/PYL-W0211/occurrences/
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
Describe the solution you'd like
A clear and concise description of what you want to happen.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
Evaluate flag value to identify the most represented one(s) and suggest value(s) and mismatch filter.
Basically, use the flag (barcode) value frequency and the expected N number of flag values, to select the top N barcodes and suggest also a number of allowed mismatches.
Should we require also a minimum edit distance between the original sequences or expected minimum distance?
Both as a separate script, and natively with the extract
command.
I have a bunch of Bioinformatics students looking to get involved, I remember in the past people were trying stuff here but with the new rules of projects having to opt in I am not sure if fastx-barber was flagged for people to help out
Traceback (most recent call last):
File "/home/gire/.local/bin/fbarber", line 8, in <module>
sys.exit(main())
File "/home/gire/.local/pipx/venvs/fastx-barber/lib/python3.7/site-packages/fastx_barber/scripts/barber.py", line 45, in main
args.run(args)
File "/home/gire/.local/pipx/venvs/fastx-barber/lib/python3.7/site-packages/fastx_barber/scripts/extract.py", line 336, in run
f"({(n_matched-n_filtered)/n_matched*100:.2f}%)",
ZeroDivisionError: division by zero
An unused argument can lead to confusions. It should be removed. If this variable is necessary, name the variable _
or start the name with unused
or _unused
.
There are 5 occurrences of this issue in the repository.
See all occurrences on DeepSource → deepsource.io/gh/ggirelli/fastx-barber/issue/PYL-W0613/occurrences/
For all scripts.
➜ gpseq-tutorial fbarber find_seq reference/Homo_sapiens.GRCh38.dna.primary_assembly.fa.gz AAGCTT
--case-insensitive --global-name --output reference/Homo_sapiens.GRCh38.dna.primary_assembly.HindIII_sites.bed.gz
--log-file reference/Homo_sapiens.GRCh38.dna.primary_assembly.HindIII_sites.log
[06/15/21 10:51:22] INFO Log to reference/Homo_sapiens.GRCh38.dna.primary_assembly.HindIII_sites.log scriptio.py:50
INFO General find_seq.py:111
INFO Input reference/Homo_sapiens.GRCh38.dna.primary_assembly.fa.gz find_seq.py:112
INFO Needle AAGCTT find_seq.py:113
INFO Output reference/Homo_sapiens.GRCh38.dna.primary_assembly.HindIII_sites.bed.gz find_seq.py:114
INFO Prefix loc_ find_seq.py:115
INFO Global True find_seq.py:116
Traceback (most recent call last):
File "/home/gire/.local/bin/fbarber", line 8, in <module>
sys.exit(main())
File "/home/gire/.local/pipx/venvs/fastx-barber/lib/python3.8/site-packages/fastx_barber/scripts/barber.py", line 45, in main
args.run(args)
File "/home/gire/.local/pipx/venvs/fastx-barber/lib/python3.8/site-packages/fastx_barber/exception.py", line 14, in wrapper
return fun(*args, **kwargs)
File "/home/gire/.local/pipx/venvs/fastx-barber/lib/python3.8/site-packages/fastx_barber/scripts/find_seq.py", line 126, in run
for pos, location_id in search_needle(record, args.needle, location_id):
File "/home/gire/.local/pipx/venvs/fastx-barber/lib/python3.8/site-packages/fastx_barber/match.py", line 221, in search_needle
header, seq, _ = record
ValueError: not enough values to unpack (expected 3, got 2)
➜ gpseq-tutorial
# Works properly
fbarber flag extract test.fastq.gz out.fastq.gz
# No output (empty file)
fbarber flag extract test.fastq.gz fastq_hq/out.fastq.gz
It is recommended to name the first argument of a classmethod as cls
so that it's easy to differentiate them from regular instance methods.
There are 2 occurrences of this issue in the repository.
See all occurrences on DeepSource → deepsource.io/gh/ggirelli/fastx-barber/issue/PYL-C0202/occurrences/
Address the following:
./fastx_barber/scripts/extract.py:133:1: C901 'run_chunk' is too complex (7)
./fastx_barber/scripts/common.py:177:14: F541 f-string is missing placeholders
./fastx_barber/scripts/common.py:187:14: F541 f-string is missing placeholders
Writing unit tests after the code is a pain, but I guess this is what lazy asses deserve... 😢
➜ reference fbarber find_seq Homo_sapiens.GRCh38.dna.primary_assembly.fa.gz AAGCTT
--case-insensitive --global-name --output Homo_sapiens.GRCh38.dna.primary_assembly.HindIII_sites.bed.gz
--log-file Homo_sapiens.GRCh38.dna.primary_assembly.HindIII_sites.log
[06/15/21 10:17:50] INFO Log to scriptio.py:50
Homo_sapiens.GRCh38.dna.primary_assembly.HindIII_sites.log
INFO General find_seq.py:111
INFO Input find_seq.py:112
Homo_sapiens.GRCh38.dna.primary_assembly.fa.gz
INFO Needle AAGCTT find_seq.py:113
INFO Output Homo_sapiens.GRCh38.dna.primary_assembly.Hin find_seq.py:114
dIII_sites.bed.gz
INFO Prefix loc_ find_seq.py:115
INFO Global True find_seq.py:116
Traceback (most recent call last):
File "/home/gire/.local/bin/fbarber", line 8, in <module>
sys.exit(main())
File "/home/gire/.local/lib/python3.8/site-packages/fastx_barber/scripts/barber.py", line 45, in main
args.run(args)
File "/home/gire/.local/lib/python3.8/site-packages/fastx_barber/exception.py", line 14, in wrapper
return fun(*args, **kwargs)
File "/home/gire/.local/lib/python3.8/site-packages/fastx_barber/scripts/find_seq.py", line 125, in run
record[1] = record[1].upper()
TypeError: 'tuple' object does not support item assignment
The current approach of saving quality flag string portions by appending a "q" prefix to the flag name is prone to flag name conflicts. Instead, the qual
string could be saved as a third flag value by moving from key/value to key/value[/qual] format and updating the FlagReader
class accordingly.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.