Skip to content

Commit

Permalink
Merge pull request #1 from COMBINE-lab/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
rob-p authored Jun 13, 2023
2 parents 39b48e2 + ea49820 commit 488f997
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 26 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
on:
push:
branches:
- main

name: release-please

jobs:
release-please:
if: github.repository_owner == 'COMBINE-lab'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- uses: GoogleCloudPlatform/release-please-action@v3
id: release_main
with:
release-type: rust
package-name: roers
bump-minor-pre-major: true
path: .

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
if: ${{ steps.release_main.outputs.release_created }}
with:
toolchain: stable
override: true

- uses: Swatinem/[email protected]
if: ${{ steps.release_main.outputs.release_created }}

- name: Publish roers
if: ${{ steps.release_main.outputs.release_created }}
uses: actions-rs/cargo@v1
with:
command: publish
args: --token ${{ secrets.CRATES_IO_TOKEN }}
29 changes: 27 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,31 @@
name = "roers"
version = "0.1.0"
edition = "2021"
authors = [
"Dongze He <[email protected]>",
"Rob Patro <[email protected]>",
]
description = "A tool to prepare augmented annotations for single-cell RNA-seq analysis."
license-file = "LICENSE"
readme = "README.md"
repository = "https://github.com/COMBINE-lab/roers"
homepage = "https://github.com/COMBINE-lab/roers"
include = [
"/src/lib/lib.rs",
"/src/main.rs",
"/Cargo.toml",
"/Cargo.lock",
"/README.md",
"/LICENSE",
]
keywords = [
"genomics",
"GTF-GFF",
"splici",
"scRNA-seq",
"augmented-reference",
]
categories = ["science", "data-structures"]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[[bin]]
Expand All @@ -15,11 +40,11 @@ path = "src/lib/lib.rs"
[dependencies]
anyhow = "1.0.71"
clap = { version = "4.3.3", features = ["derive", "wrap_help","cargo"] }
grangers = { git = "https://github.com/COMBINE-lab/grangers.git", branch="dev" }
grangers = { git = "https://github.com/COMBINE-lab/grangers.git", branch="dev", version = "0.1.4" }
polars = { version = "0.30", features = ["lazy","dataframe_arithmetic","sort_multiple", "checked_arithmetic","rows","dtype-struct", "dtype-categorical", "list_eval","concat_str", "strings"]}
peak_alloc = "0.2.0"
tracing = "0.1.37"
tracing-subscriber = { version = "0.3.17", features = ["env-filter"] }
noodles = { version = "0.41.0", features = ["fasta"] }
serde = {version = "1.0.163", features = ["derive"]}
serde = {version = "1.0.164", features = ["derive"]}
serde_json = "1.0.96"
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# roers
# roers

A rust library for preparing expanded transcriptome references for quantification with [`alevin-fry`](https://alevin-fry.readthedocs.io/en/latest/).
35 changes: 12 additions & 23 deletions src/lib/lib.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use anyhow::Context;
use clap::builder::{PossibleValuesParser, TypedValueParser};
use grangers::grangers::{options, Grangers};
use grangers::{options, Grangers};
use polars::lazy::dsl::concat_str;
use polars::prelude::*;
use serde_json::json;
use serde::Serialize;
use serde_json::json;
use std::collections::HashSet;
use std::ops::Add;
use std::path::PathBuf;
Expand Down Expand Up @@ -337,7 +337,7 @@ pub fn make_ref(aug_ref_opts: AugRefOpts) -> anyhow::Result<()> {
info!("Processing {} intronic records", intron_gr.df().height(),);

// no_flanking_merge decides when the order of merge and extend
// if no_flanking_merge is true, we merge first, then extend
// if no_flanking_merge is true, we merge first, then extend
if no_flanking_merge {
// Then, we merge the overlapping introns
intron_gr = intron_gr.merge(
Expand All @@ -349,12 +349,8 @@ pub fn make_ref(aug_ref_opts: AugRefOpts) -> anyhow::Result<()> {
}

// add flanking end to both side of each intron
intron_gr.extend(
flank_length,
&options::ExtendOption::Both,
false,
)?;

intron_gr.extend(flank_length, &options::ExtendOption::Both, false)?;

// if no_flanking_merge is false, we merge after extend
if !no_flanking_merge {
// Then, we merge the overlapping introns
Expand Down Expand Up @@ -471,7 +467,7 @@ pub fn make_ref(aug_ref_opts: AugRefOpts) -> anyhow::Result<()> {
// we get the range (transcript body) of each transcript
let mut tx_gr = exon_gr.transcripts(None, true)?;

// Then we append a -T to mark the sequence as transcript body
// Then we append a -T to mark the sequence as transcript body
tx_gr.df = tx_gr
.df
.lazy()
Expand Down Expand Up @@ -566,15 +562,11 @@ pub fn make_ref(aug_ref_opts: AugRefOpts) -> anyhow::Result<()> {
"gene_id" => &names,
)?;

if aug_type.is_some() {
if aug_type.is_some() {
// if we are here, we need to add a column for splice_status cuz it is an augmented reference
extra_t2g.with_column(Series::new(
"splice_status",
vec!["S"; extra_t2g.height()],
))?;

extra_t2g.with_column(Series::new("splice_status", vec!["S"; extra_t2g.height()]))?;
}

t2g_map.extend(&extra_t2g)?;

// extend gene_id_to_name for the custom spliced targets
Expand Down Expand Up @@ -619,14 +611,11 @@ pub fn make_ref(aug_ref_opts: AugRefOpts) -> anyhow::Result<()> {
"gene_id" => &names,
)?;

if aug_type.is_some() {
if aug_type.is_some() {
// if we are here, we need to add a column for splice_status cuz it is an augmented reference
extra_t2g.with_column(Series::new(
"splice_status",
vec!["U"; extra_t2g.height()],
))?;
extra_t2g.with_column(Series::new("splice_status", vec!["U"; extra_t2g.height()]))?;
}

t2g_map.extend(&extra_t2g)?;

// extend gene_id_to_name for the custom spliced targets
Expand Down

0 comments on commit 488f997

Please sign in to comment.