Skip to content

Commit

Permalink
0.9.2
Browse files Browse the repository at this point in the history
  • Loading branch information
telatin committed Apr 7, 2021
1 parent 6b66804 commit f8663d0
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 15 deletions.
Binary file modified bin/seqfu
Binary file not shown.
5 changes: 3 additions & 2 deletions docs/1_install.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ permalink: /installation

## Install via Miniconda

The recommended installation method is via BioConda. If you have _conda_ installed ([how to install it](https://docs.conda.io/en/latest/miniconda.html)):
The **recommended** installation method is via BioConda.
If you have _conda_ installed ([how to install it](https://docs.conda.io/en/latest/miniconda.html)):

```
conda install -c conda-forge -c bioconda seqfu
Expand All @@ -18,6 +19,6 @@ More info on [installing conda](https://telatin.github.io/microbiome-bioinformat

## Pre-compiled binaries

Pre-compiled binaries are distributed with the [stable releases](https://github.com/telatin/qax/releases).
Pre-compiled binaries are distributed with the [stable releases](https://github.com/telatin/seqfu2/releases).


6 changes: 6 additions & 0 deletions docs/tools/2.12_usage_rc.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ CTGCWGCCNCCCGTAGG
GGATTAGATACCCBDGTAGTCC
```

**Note**: if a single sequence (string) is provided, the output is not in FASTA format but a plain string. This makes easier
a programmatic use like:
```bash
removePrimersScript.sh --for $FOR --rev $(seqfu rc $REV)
```

## Reverse commplement files
When supplying input files, the whole file will be complemented. If the file is in FASTQ format the
quality will be reversed as well. The program can process multiple files.
Expand Down
8 changes: 6 additions & 2 deletions src/fastx_rc.nim
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,12 @@ Options:
if not fileExists(filename):
# Process as string
stringCount += 1
echo ">", seqDefaultName, "_" , $stringCount, "\n", revcompl(filename)
continue
if len(files) == 1:
echo revcompl(filename)
continue
else:
echo ">", seqDefaultName, "_" , $stringCount, "\n", revcompl(filename)
continue
else:
echoVerbose(filename, verbose)

Expand Down
45 changes: 34 additions & 11 deletions src/fastx_view.nim
Original file line number Diff line number Diff line change
Expand Up @@ -101,27 +101,46 @@ proc qualToColor(s: string, v: seq[int], color = false): string =
else:
result &= i

proc highlight(r: string, matches: seq[seq[int]], l:int, color: proc) =
proc isOnlySpaces(s: string): bool =
for c in s:
if c != ' ':
return false
return true

proc highlightOligoMatches(r: string, matches: seq[seq[int]], oligo_length:int, color: proc): string =
var
glyphs = newSeq[string](len(r))

for i in 0 ..< len(r):
glyphs[i] = " "


if len(matches[0]) > 0:
for m in matches[0]:
let
stop = if m >= 0: l
else: l + m
stop = if m >= 0: oligo_length
else: oligo_length + m
start = if m >= 0: m
else: 0
echo ' '.repeat(start) & "".color.fgWhite.repeat(stop)
for i in start ..< start+stop:
if i < len(glyphs):
glyphs[i] = "".color.fgWhite

#echo r

if len(matches[1]) > 0:
for m in matches[1]:
let
stop = if m >= 0: l
else: l + m
stop = if m >= 0: oligo_length
else: oligo_length + m
start = if m >= 0: m
else: 0
echo ' '.repeat(start) & "".color.fgWhite.repeat(stop)

#echo "?", ' '.repeat(start) & "ᐊ".color.fgWhite.repeat(stop)
for i in start ..< start+stop:
if i < len(glyphs):
glyphs[i] = "".color.fgWhite

return glyphs.join("")

proc fastx_view(argv: var seq[string]): int =
let args = docopt("""
Usage: view [options] <inputfile> [<input_reverse>]
Expand Down Expand Up @@ -192,10 +211,14 @@ Options:

if $args["--oligo1"] != "nil":
let matches = findPrimerMatches(read.seq, $args["--oligo1"], matchThs, maxMismatches, minMatches)
highlight(read.seq, matches, len($args["--oligo1"]), bgBlue)
let forString = highlightOligoMatches(read.seq, matches, len($args["--oligo1"]), bgBlue)
if forString.isOnlySpaces == false:
echo forString
if $args["--oligo2"] != "nil":
let matches = findPrimerMatches(read.seq, $args["--oligo2"], matchThs, maxMismatches, minMatches)
highlight(read.seq, matches, len($args["--oligo2"]), bgRed)
let revString = highlightOligoMatches(read.seq, matches, len($args["--oligo2"]), bgRed)
if revString.isOnlySpaces == false:
echo revString
echo read.seq
if args["--qual-chars"]:
echo qualToColor(read.qual, thresholdValues, colorOutput)
Expand Down

0 comments on commit f8663d0

Please sign in to comment.