Skip to content

Commit

Permalink
change regex search field to id instead of desc
Browse files Browse the repository at this point in the history
  • Loading branch information
angelovangel committed Feb 13, 2024
1 parent d0615c2 commit 55089eb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ readme = "README.md"
homepage = "https://github.com/angelovangel/faster"
repository = "https://github.com/angelovangel/faster"
keywords = ["fastq", "bio"]
version = "0.2.0"
version = "0.2.1"
authors = ["Angel Angelov <aangeloo@gmail.com>"]
edition = "2018"

Expand Down
14 changes: 7 additions & 7 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ fn samplefq(path: &String, n: usize) {

fn main() {
let matches = App::new("faster")
.version("0.2.0")
.version("0.2.1")
.author("Angel Angelov <aangeloo@gmail.com>")
.about("fast statistics and more for 1 fastq file")

Expand Down Expand Up @@ -105,11 +105,11 @@ fn main() {
.arg(Arg::with_name("regex_string")
.long("regex_string")
.takes_value(true)
.help("Output only reads whose description field matches a regex [string] pattern. See https://docs.rs/regex/1.4.2/regex/#functions"))
.help("Output only reads whose id field matches a regex [string] pattern. See https://docs.rs/regex/1.4.2/regex/#functions"))
.arg(Arg::with_name("regex_file")
.long("regex_file")
.takes_value(true)
.help("Output only reads whose description field matches a regex [string] pattern. The regex patterns are read from a file, one line per pattern."))
.help("Output only reads whose id field matches a regex [string] pattern. The regex patterns are read from a file, one line per pattern."))
.arg(Arg::with_name("INPUT")
.help("Path to a fastq file")
.required(true)
Expand Down Expand Up @@ -365,8 +365,8 @@ fn main() {

while !record.is_empty() {
let mut writer = fastq::Writer::new(io::stdout());
let desc = record.desc().unwrap();
if re.is_match(desc) {
let readid = record.id();
if re.is_match(readid) {
writer
.write_record(&mut record)
.expect("Error writing fastq record!");
Expand Down Expand Up @@ -394,9 +394,9 @@ fn main() {
// write record to stdout in case of match
while !record.is_empty() {
let mut writer = fastq::Writer::new(io::stdout());
let desc = record.desc().unwrap().as_bytes(); // as.bytes because RegexSet matches on bytes
let readid = record.id().as_bytes(); // as.bytes because RegexSet matches on bytes

if re_set.is_match(desc) {
if re_set.is_match(readid) {
writer
.write_record(&mut record)
.expect("Error writing fastq record!");
Expand Down

0 comments on commit 55089eb

Please sign in to comment.