-
Notifications
You must be signed in to change notification settings - Fork 1
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 #22 from ShawHahnLab/release-0.2.0
Version 0.2.0
- Loading branch information
Showing
63 changed files
with
3,138 additions
and
260 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
""" | ||
Convert between various sequence and tabular file formats. | ||
Input and output formats are by default inferred from filenames but can be | ||
given explicitly if needed. The formats are: | ||
fa: FASTA | ||
fagz: gzipped FASTA | ||
fq: FASTQ | ||
fqgz: gzipped FASTQ | ||
csv: comma-separated values | ||
csvgz: gzipped comma-separated values | ||
tsv: tab-separated values | ||
tsvgz: gzipped tab-separated values | ||
""" | ||
|
||
from .record import RecordReader, RecordWriter | ||
|
||
def convert(path_in, path_out, fmt_in=None, fmt_out=None, colmap=None, dummyqual=None, dry_run=False): | ||
with RecordReader(path_in, fmt_in, colmap, dry_run=dry_run) as reader, \ | ||
RecordWriter(path_out, fmt_out, colmap, dummyqual=dummyqual, dry_run=dry_run) as writer: | ||
for record in reader: | ||
writer.write(record) |
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,22 @@ | ||
#!/usr/bin/env bash | ||
|
||
[ -v EXAMPLES ] || EXAMPLES=$(python -c 'import igseq.util; print(igseq.util.DATA)')/examples | ||
|
||
# converting FASTA to FASTA just unwraps it | ||
igseq convert $EXAMPLES/inputs/convert/wrapped.fasta unwrapped.fasta | ||
|
||
# or, convert to CSV/TSV | ||
igseq convert $EXAMPLES/inputs/convert/wrapped.fasta unwrapped.csv | ||
|
||
# or .fastq.gz to .fasta | ||
igseq convert $EXAMPLES/inputs/convert/unwrapped.fastq.gz unwrapped2.fasta | ||
|
||
# a - can be used for stdin/stdout, but the format has to be given explicitly: | ||
igseq convert --input-format fa --output-format fa - - < $EXAMPLES/inputs/convert/wrapped.fasta > unwrapped3.fasta | ||
|
||
# other table formats can be converted to FASTA or FASTQ if the column names to | ||
# use are specified. the default would find sequence_id and sequence columns | ||
# from AIRR: | ||
igseq convert $EXAMPLES/inputs/convert/airr.tsv from_airr.fasta | ||
# or maybe we want the junctions instead: | ||
igseq convert --col-seq junction $EXAMPLES/inputs/convert/airr.tsv from_airr_junctions.fasta |
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.