Git Product home page Git Product logo

yingtools2's Introduction

yingtools2 package

Ying Taur's tools for analysis, with particular focus on microbiome data

yingtools2 is an R package containing many tools and functions for working with clinical and microbiome data.

Installation

Install this package from Github:

remotes::install_github("ying14/yingtools2")

Sample Microbiome Dataset

Included is a de-identified microbiome dataset of stool samples collected from a cohort of bone marrow transplant recipients at Memorial Sloan Kettering Cancer Center. This was previously published in Clinical Infectious Diseases (2012). The dataset includes sequence data for 439 samples (from 94 patients), as well as a variety of accompanying clinical metadata.

  • cid.phy: 16S sequence data (phyloseq object, 1,838,204 seqs, 439 samples, 5,327 OTUs)
  • cid.patients: Patients (94 rows)
  • cid.hosp: Hospitalizations (314 rows)
  • cid.meds: Medications (6,473 rows)
  • cid.bsi: Bloodstream Infections (138 rows)
  • cid.cdiff: C. diff results (37 rows)

Self Help and Code Examples

Below are various use coding examples using yingtools2.

Core Basics

For those starting to learn R for data science

  • Coding Curriculum. A run-through of the most important R coding skills to learn.
  • Regular Expressions. Lists basic regular expression patterns.
  • Exercises. These questions test your R skills and range from beginner to advanced.

Microbiome data

yingtools2's People

Contributors

elittmann avatar ying14 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

yingtools2's Issues

LEfSe on changes

Hi everyone,

I'm using your packages "yingtools2" for the LEfSe function. I would like to know if there a way to perform LEfSe on changes (log ratio) ?
I explain my study :
we've data for several groups at 2 time points and we want to find impacted taxa between groups using the change from baseline (log ratio). Is it feasible ?
Is there a way to define classes to have an identical study ?

Another question is how you deal with negative or 0 values ?
I run LEfSe with the same dataset and different value in there and I didn't obtain the same number of rows in the result table

Thanks in advance !

dcast failing to read in phyloseq objects

Hi,

I am very excited to use your LEfSe wrapper! However, I am running into the same error with my own data and the example data (cid94)---both phyloseq objects:

lala=lefse2(cid.phy, class="Consistency")

Error in UseMethod("dcast", data) :
no applicable method for 'dcast' applied to an object of class "c('tbl_df', 'tbl', 'data.frame')"

I have specified the correct working directory, ran the modified function (lefse2), and am stuck at the moment. Would really appreciate your help, thank you!

Liisa

lefse function can't not run

Hi Ying,

Could you please get me know to to use phyloseq data to obtain the lefse results of CID94_lefse.png?

I run the "lefse.tbl <- lefse(cid94,class="Patient_ID",subclass="day")" as you show in the example, but it doesn't work.

Thanks a lot,
Peng

Error with taxon when running LefSe

Hi,
Thanks for the great work in this package.

I'm trying to use the LeSe Wrapper code and keep getting the same issue when making the lefse.tbl (including when I use the sample data included in the package)
The error message is:
" Error in gsub(" ", "_", taxon) : object 'taxon' not found"

Do you have any idea why this might be the case and how I could fix this issue?
Thanks in advance!

lefse run error

[1] "Wrote lefse.res"
Error in file(file, "rt") : cannot open the connection
In addition: Warning message:
In file(file, "rt") :
cannot open file 'lefse.res': No such file or directory

engraftment dates

hi ying,
i wrote code using a complex rule set to get engraftment dates for bmt patients. would be good to cross ref some time. can add this here too, if you want. but it's all python.
jonas

ifultools error during install

Hello, during installation I came across this error:

ERROR: dependency ‘ifultools’ is not available for package ‘yingtools2’
Error: Failed to install 'yingtools2' from GitHub:
  (converted from warning) installation of package ‘/tmp/RtmpK30RZj/file32ed6d922f9f/yingtools2_0.0.1.22.tar.gz’ had non-zero exit status

I checked the status of this package here https://cran.r-project.org/web/packages/ifultools/index.html . And says it has been removed, I am proceeding with a manual install of ifultools which version should I choose?

Best,

Lefse in R issue with rpy2 and rpy2.robjects

Hi, I am having trouble running the lefse.tbl function due to an error presented in R that reads as follows:

lefse.tbl <- lefse2(physeq, class="HPV_Status")
Traceback (most recent call last):
File "run_lefse.py", line 4, in
from lefse import *
File "/Users/brayanvilanova/Desktop/nsegata-lefse-9adc3a62460e/lefse.py", line 3, in
import rpy2.robjects as robjects
ImportError: No module named rpy2.robjects
[1] "Wrote lefse.res"
Error in file(file, "rt") : cannot open the connection
In addition: Warning messages:
1: select_() is deprecated.
Please use select() instead
The 'programming' vignette or the tidyeval book can help you
to program with select() : https://tidyeval.tidyverse.org
This warning is displayed once per session.
2: In file(file, "rt") :

It seems as if the rpy2 wasn't working and although I have updated, and changed the version that does not seem to help. I am running this having python==2.7.15 and rpy2-2.8.2. I would really appreciate the help.
Thank You!

send.text.message failed on a mac

I installed yingtools2 and its dependencies. The following command

send.text.message("test text", number = "2173907888")
from my mac. It returned the following error

YTError: Not sure how to handle this operating system: Darwin

I looked at the code and it looks like it currently runs on linux. And the text belt.com directions require a key. Should be fairly straightforward to fix. I'll give it a try.

lefse

Hello!
I was trying to find R packages to use LEFSE on a phyloseq object and you seem to have the answer!

However, when I try to run it I get the following error. I am using R studio on windows.

lefse(sandrine_echant_seuls_rarefy, class="Site")

[1] "Wrote lefse.res"
Error in file(file, "rt") : cannot open the connection
In addition: Warning messages:
1: Column sample joining factor and character vector, coercing into character vector
2: running command 'format_input.py lefse.txt lefse.in -c 1 -o 1000000' had status 127
3: running command 'run_lefse.py lefse.in lefse.res -a 0.05 -w 0.05 -l 2 -e 0 -y 0 -s 0' had status 127
4: In file(file, "rt") :
cannot open file 'lefse.res': No such file or directory

Thanks you!

Problem installing

Hello when installing I am facing this error any suggestions?

Downloading GitHub repo ying14/yingtools2@HEAD
Error: Failed to install 'yingtools2' from GitHub:
  lazy-load database '/Library/Frameworks/R.framework/Versions/4.1/Resources/library/callr/R/callr.rdb' is corrupt
In addition: Warning messages:
1: In rcmd_build_tools(options$cmd, c(options$path, options$args),  :
  restarting interrupted promise evaluation
2: In rcmd_build_tools(options$cmd, c(options$path, options$args),  :
  internal error -3 in R_decompress1

Cladogram?

Do you have the code to plot the cladogram?

Best,

Maria

usability / readme

Hi Ying, we met at the U01 team meeting in AA. Have examined this repo and would benefit from brief instructions about how to run a demo. Can explain why by DM. Thanks

Issue in LefseS wrapper function

Dear All,

I am having problems with the LESFE analysis from ying14/yingtools2.

I have tried with the lefse2 (modified according to https://github.com/ying14/yingtools2/wiki/Using-the-%60lefse%60-wrapper-function) but It gave me an error.

I downloaded the Lefse zip and I have the unzipped folder as working directory in R session as the tutorial propose.

My code and the otuput:
lefse.tbl <- lefse2(data, class="Parto")

Error in gsub(" ", "_", taxon) : object 'taxon' not found

Could you help me with that? Any idea?

I don't know if it would be useful a look of my taxa_table:

head(tax_table(data))

Taxonomy Table: [6 taxa by 7 taxonomic ranks]:
Kingdom Phylum Class Order Family
ASV1 "Bacteria" "Proteobacteria" "Gammaproteobacteria" "Enterobacteriales" "Enterobacteriaceae"
ASV2 "Bacteria" "Actinobacteria" "Actinobacteria" "Bifidobacteriales" "Bifidobacteriaceae"
ASV3 "Bacteria" "Firmicutes" "Bacilli" "Lactobacillales" "Streptococcaceae"
ASV4 "Bacteria" "Actinobacteria" "Actinobacteria" "Bifidobacteriales" "Bifidobacteriaceae"
ASV5 "Bacteria" "Firmicutes" "Bacilli" "Lactobacillales" "Enterococcaceae"
ASV6 "Bacteria" "Actinobacteria" "Actinobacteria" "Bifidobacteriales" "Bifidobacteriaceae"
Genus Species
ASV1 "Escherichia/Shigella" NA
ASV2 "Bifidobacterium" "longum"
ASV3 "Streptococcus" NA
ASV4 "Bifidobacterium" NA
ASV5 "Enterococcus" NA
ASV6 "Bifidobacterium" "bifidum"

Thank you!

Error in file(file, "rt") : cannot open the connection

Hello,

I am trying to run the lefse2 function and I encounter this error below,

python: can't open file 'format_input.py': [Errno 2] No such file or directory
python: can't open file 'run_lefse.py': [Errno 2] No such file or directory
[1] "Wrote lefse.res"
Error in file(file, "rt") : cannot open the connection
In addition: Warning message:
In file(file, "rt") :
cannot open file 'lefse.res': No such file or directory

I am not sure, how to address this. Could someone help me, please?
Thanks in advance
Sarsi

issue with install yingtools2

Hi,

When trying to install yingtools2, I am getting the following error:

devtools::install_github("ying14/yingtools2")
Downloading GitHub repo ying14/yingtools2@master
√ checking for file 'C:\Users\fonsb\AppData\Local\Temp\RtmpI3bcLT\remotes15871eb556f\ying14-yingtools2-526b761/DESCRIPTION' ...

  • preparing 'yingtools2':
    √ checking DESCRIPTION meta-information ...
    Warning: C:/Users/fonsb/AppData/Local/Temp/RtmpkhLDcx/Rbuild18e8120562e3/yingtools2/man/get.time.Rd:14: unexpected section header '\value'
    Warning: C:/Users/fonsb/AppData/Local/Temp/RtmpkhLDcx/Rbuild18e8120562e3/yingtools2/man/get.time.Rd:17: unexpected section header '\description'
    Warning: C:/Users/fonsb/AppData/Local/Temp/RtmpkhLDcx/Rbuild18e8120562e3/yingtools2/man/get.time.Rd:20: unexpected END_OF_INPUT '
    '
  • checking for LF line-endings in source and make files and shell scripts
  • checking for empty or unneeded directories
  • looking to see if a 'data/datalist' file should be added
  • building 'yingtools2_0.0.0.78.tar.gz'

Installing package into ‘C:/Users/fonsb/Documents/R/win-library/3.5’
(as ‘lib’ is unspecified)

  • installing source package 'yingtools2' ...
    ** R
    ** data
    *** moving datasets to lazyload DB
    ** byte-compile and prepare package for lazy loading
    ** help
    Warning: C:/Users/fonsb/AppData/Local/Temp/RtmpKcNaCg/R.INSTALL23fc6cc65c0/yingtools2/man/get.time.Rd:14: unexpected section header '\value'
    Warning: C:/Users/fonsb/AppData/Local/Temp/RtmpKcNaCg/R.INSTALL23fc6cc65c0/yingtools2/man/get.time.Rd:17: unexpected section header '\description'
    Warning: C:/Users/fonsb/AppData/Local/Temp/RtmpKcNaCg/R.INSTALL23fc6cc65c0/yingtools2/man/get.time.Rd:20: unexpected END_OF_INPUT '
    '
    Warning: C:/Users/fonsb/AppData/Local/Temp/RtmpKcNaCg/R.INSTALL23fc6cc65c0/yingtools2/man/grapes-not-in-grapes.Rd: \name should not contain !, | or @
    *** installing help indices
    converting help for package 'yingtools2'
    finding HTML links ... done
    age.years html
    all.grepl html
    as.Date2 html
    as.mrn html
    as.phylo.formula2 html
    finding level-2 HTML links ... done

Rd warning: C:/Users/fonsb/AppData/Local/Temp/RtmpKcNaCg/R.INSTALL23fc6cc65c0/yingtools2/man/as.phylo.formula2.Rd:24: missing link 'https://stat.ethz.ch/pipermail/r-sig-phylo/2013-August/003017.html'
chop.endpoint html
cid.colors html
cid94 html
cleanup.data html
cleanup.data.old html
convert.dates html
copy.as.Rcode html
copy.as.sql html
copy.to.clipboard html
createSurvivalFrame html
cummax html
cut2 html
dt html
fan.angle html
fill.in.blanks html
find.all.distinct.vars html
geom_hilight html
geom_kaplanmeier html
Rd warning: C:/Users/fonsb/AppData/Local/Temp/RtmpKcNaCg/R.INSTALL23fc6cc65c0/yingtools2/man/geom_kaplanmeier.Rd:42: missing link 'xxxxx'
geom_logrank html
Rd warning: C:/Users/fonsb/AppData/Local/Temp/RtmpKcNaCg/R.INSTALL23fc6cc65c0/yingtools2/man/geom_logrank.Rd:28: missing link 'cdiff.method'
get.otu html
get.otu.melt html
get.row html
get.samp html
get.tax html
get.time html
get.yt.palette html
get.yt.palette2 html
gg.colors html
gg.legend html
gg.stack html
grapes-allin-grapes html
grapes-grapes html
grapes-not-in-grapes html
group_by_time html
group_by_time_streaks html
is.mrn html
is.wholenumber html
lefse html
left_join_replace html
log_epsilon_trans html
log_epsilon_trans_breaks html
logistic html
logistic_trans html
logistic_trans_breaks html
make.datetime html
make.names html
make.table html
max2 html
middle.pattern html
occurs.within html
paste2 html
pca.plot html
phy.collapse html
pretty_number html
pretty_scientific html
read.blastn.file html
read.clipboard html
read.mothur.taxfile html
read.oligos html
read.tree.uparse html
read.uparse.data html
read_excel2 html
recode2 html
remove.na.cols html
remove.na.rows html
replace.grep html
replace.grep.data html
select2 html
send.text.message html
set.otu html
set.samp html
set.tax html
shades html
shell.exec html
show_linetypes html
show_shapes html
stcox html
Rd warning: C:/Users/fonsb/AppData/Local/Temp/RtmpKcNaCg/R.INSTALL23fc6cc65c0/yingtools2/man/stcox.Rd:29: missing link 'cdiff.method'
str_extract_all_quotes html
survival.frame.atrisk.table html
Rd warning: C:/Users/fonsb/AppData/Local/Temp/RtmpKcNaCg/R.INSTALL23fc6cc65c0/yingtools2/man/survival.frame.atrisk.table.Rd:27: missing link 'cdiff.method'
survival.frame.info html
Rd warning: C:/Users/fonsb/AppData/Local/Temp/RtmpKcNaCg/R.INSTALL23fc6cc65c0/yingtools2/man/survival.frame.info.Rd:26: missing link 'cdiff.method'
tab html
tax.plot html
univariate.logistic html
Rd warning: C:/Users/fonsb/AppData/Local/Temp/RtmpKcNaCg/R.INSTALL23fc6cc65c0/yingtools2/man/univariate.logistic.Rd:35: missing link 'cdiff.method'
univariate.stcox html
yingtools2 html
** building package indices
** testing if installed package can be loaded
*** arch - i386
Error: package or namespace load failed for 'yingtools2' in namespaceExport(ns, exports):
undefined exports: read.otu.table
Error: loading failed
Execution halted
*** arch - x64
Error: package or namespace load failed for 'yingtools2' in namespaceExport(ns, exports):
undefined exports: read.otu.table
Error: loading failed
Execution halted
ERROR: loading failed for 'i386', 'x64'

  • removing 'C:/Users/fonsb/Documents/R/win-library/3.5/yingtools2'
    In R CMD INSTALL
    Error in i.p(...) :
    (converted from warning) installation of package ‘C:/Users/fonsb/AppData/Local/Temp/RtmpI3bcLT/file15871b44520/yingtools2_0.0.0.78.tar.gz’ had non-zero exit status.

Any idea for a fix?

Best,

Fons

Lefse issues in R

Hello!

I am trying to use lefse in R and keep getting the following error message. It seems like lefse was installed ok- when I type system2(lefse, args = "--version") I get back
"biom, version 2.1.7"

Error message:
lefse <- py_run_file("/Users/amyzf/miniconda3/envs/lefse-env/bin/run_lefse.py", local=FALSE) #
Error in py_run_file_impl(file, local, convert) :
TabError: inconsistent use of tabs and spaces in indentation (, line 25)

Thank you!

Lefse problem setwd()

Hi,
I still have a problem with running the lefse wrapper. I followed the instructions as described here https://github.com/ying14/yingtools2/wiki/Using-the-%60lefse%60-wrapper-function
and set up my workin directory like this setwd("~/Downloads/nsegata-lefse-82605a2ae7b7-3/").
But when I try to run lefse in R, like this
lefse.tbl <- lefse(physeq,class="Diagnosis")

I still get this error message

Error in file(file, "rt") : cannot open the connection
In addition: Warning messages:
1: Column sample joining factor and character vector, coercing into character vector
2: In system(format.command) : error in running command
3: In system(lefse.command) : error in running command
4: In file(file, "rt") :
cannot open file 'lefse.res': No such file or directory

I have no idea how to solve this problem and would greatly appreciate any suggestions.
Thank you

Few questions running Lefse

Hey
I am facing 2 major issues using the lefse wrapper function:

  1. after running lefse.tbl <- lefse2(cid.phy,class="Consistency") I got this warning message:
    Column sample joining factor and character vector, coercing into character vector

this led to the second issue when trying to plot it using the code :

lefse.tbl %>%

  • filter(!is.na(lda),
    
  •        lda>4,
    
  •        direction %in% c("formed stool","liquid")) %>%
    
  • mutate(lda=ifelse(direction=="liquid",-lda,lda)) %>%
    
  • ggplot() +
    
  • geom_bar(aes(x=reorder(taxon,lda),y=lda,fill=direction),color="black",stat="identity") +
    
  • coord_flip()
    

Warning message:
In Ops.factor(lda, 4) : ‘>’ not meaningful for factors
Overall, it does not create the plot you supplied. I also changed the content of the row:
lefse.out <- read.table("lefse.res", header = FALSE, sep = "\t")
to lefse.out <- read.table("lefse.txt", header = FALSE, sep = "\t")

Can you help me understand what is going wrong?

Cannot find nsegata-lefse zip file

Hello,

I am trying to download the dependency nsegata-lefse zip file to run an lefse analysis in R, however the link provided on the page is not working to download the zip, or the link for the installation instructions for $PATH installation. Would you be able to provide this file/link please?

Thanks

send.text.message

When I run the function it gives me an error. I used my portuguese number to try.
Thanks a lot

send.text.message(message="Hello", number = "+351XXXXXXXXX")
Error in send.text.message(message = "Hello", number = "+351XXXXXXXXX") :
YTError: Not sure how to handle this operating system: Windows
Go tell Ying about this.

Lefse2 issue

Hello,

I'm a PhD student working on microbiome data. I found your LEfSe wrapper when I looked for an R way to carry out an LDA analysis. I have tried your function (the modification when you don't have $PATH access), but I received the next error message from R:

Traceback (most recent call last):
File "run_lefse.py", line 4, in
from lefse import *
File "/Users/macbookpro/Desktop/Microbiomes/nsegata-lefse-82605a2ae7b7/lefse.py", line 3, in
import rpy2.robjects as robjects
ImportError: No module named rpy2.robjects
[1] "Wrote lefse.res"
Error in file(file, "rt") : cannot open the connection
In addition: Warning messages:
1: Column sample joining factor and character vector, coercing into character vector
2: In file(file, "rt") :
cannot open file 'lefse.res': No such file or directory
Called from: file(file, "rt")

How can I solve this problem?

Thanks in advance and thank you for developing this code.
Regards,

David

Error running for multiple classes

A college of mine is Gavin this issue, I haven't face it when I ran my code with four classes. What this could be?

class: Tillage (3 values)
subclass: Tillage_subclass (3 values)
class/subclass comparisons per tax level: 3
levels: 743 taxonomic features (across 6 levels: domain|phylum|class|order|family|genus)
Performing KW and W subclass testing (743 tax features)                                                                  
[======>------------------------------------------------------------------------------------------------------------]   6%Error in `mutate()`:
! Problem while computing `subclass.info = coalesce_indicators(...)`.
i The error occurred in group 1: class.id = 1, class.list = <"Minimal Tillage", "No Tillage">, class.desc = "Minimal
  Tillage vs. No Tillage".
Caused by error in `as_mapper()`:
! object 'eval_tidy' not found
Run `rlang::last_error()` to see where the error occurred.

Problem with python + R on Mac

Hello,
I am interested in using your package for some of my analyses, but in trying to get python and R to communicate with each other (i.e. install rpy2, which I assume you have to do to use your package) I kept getting errors which seem to be related to trying to do this in newer versions of Mac OSX + newer versions of R.

I can see from one of the older issues that you use Linux, so not sure if you would have heard about this issue/would know how to fix it, but just thought I'd bring it up in case the package is still being developed. Thanks!

-Rachel

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.