How to write a scientific paper

ConservationBytes.com

Several years ago, my long-time mate, colleague and co-director, Barry Brook, and I were lamenting how most of our neophyte PhD students were having a hard time putting together their first paper drafts. It’s a common problem, and most supervisors probably get their collective paper-writing wisdom across in dribs and drabs over the course of their students’ torment… errhm, PhD. And I know that every supervisor has a different style, emphasis, short-cut (or two) and focus when writing a paper, and students invariably pick at least some of these up.

But the fact that this knowledge isn’t innate, nor is it in any way taught in probably most undergraduate programmes (I include Honours in that list), means that most supervisors must bleed heavily on those first drafts presented to them by their students. Bleeding is painful for both the supervisor and student who has to clean up the mess…

View original post 1,503 more words

Advertisements

Leave a comment

Filed under Uncategorized

How much Neanderthal are you?

I recently had my genome analysed through 23andme and one of the factoids that you get out of this is the estimated percentage of you DNA that is from Neanderthal ancestry.  In my case, 2.9% on the 76th percentile compared to the 2.5% average for European and Chinese. My wife was on the average… I knew she was not as “primitive” as me. But what does this all really mean?

My-neanderthal-percent

Continue reading

Leave a comment

Filed under Personal Genomics

Yes! Even Atheists believe

I recently read an article Even atheists believe (English translation) about the thoughts of Danish artist Kristian Leth. An interesting read, but he mixed a number of related concepts together and came with – in my opinion – a rather confusing argument for religious faith. But it got me thinking about how I disagreed with him and I though I would put some of my own thoughts down.

Continue reading

Leave a comment

Filed under Ideas, Opinon

Personal genome and bacteriome sent

I am interested in the commercialisation of sequencing services for a consumer market and today I sent a saliva sample to 23andme and a fecal sample to ubiome.

image

Continue reading

Leave a comment

Filed under Personal Genomics

Slides: Introduction to Amplicon Sequencing

We held a week long graduate level course, Introduction to Community Systems Biology from the 29th October to 1 November, 2013 here in Aalborg, Denmark. The course was well attended and a lot of fun both professionally and socially.

I have uploaded the slides for my talk “Introduction to Amplicon Sequencing” to Slideshare.

Leave a comment

Filed under Bioinformatics hacking

subsetting a phyloseq object by taxa name

Originally posted by me here: https://github.com/joey711/phyloseq/issues/261#issuecomment-27942652

I get an error when running subset_taxa in a function.

Code to reproduce error:

library(phyloseq)
getRversion()
packageDescription("phyloseq")$Version

test <- function(psdata){
  keep_taxa   <- taxa_names(psdata) %in% taxa_names(psdata)[1:5]
  print(keep_taxa[1:10])   # test that keep_taxa exists
  topNtaxa    <- subset_taxa(psdata, keep_taxa)
  print("success")
}

data(GlobalPatterns)
test(GlobalPatterns)

keep_taxa <- taxa_names(GlobalPatterns) %in% taxa_names(GlobalPatterns)[1:5]

test(GlobalPatterns)

My output when I run this:

> library(phyloseq)
> getRversion()
[1] ‘3.0.2’
> packageDescription("phyloseq")$Version
[1] "1.7.3"
> test <- function(psdata){
+ keep_taxa   <- taxa_names(psdata) %in% taxa_names(psdata)[1:5]
+ print(keep_taxa[1:10]) # test that keep exists
+ topNtaxa    <- subset_taxa(psdata, keep_taxa)
+ print("success")
+ }
> data(GlobalPatterns)
> test(GlobalPatterns)
 [1]  TRUE  TRUE  TRUE  TRUE  TRUE FALSE FALSE FALSE FALSE FALSE
Error in eval(expr, envir, enclos) : object 'keep_taxa' not found
> keep_taxa <- taxa_names(GlobalPatterns) %in% taxa_names(GlobalPatterns)[1:5]
> test(GlobalPatterns)
 [1]  TRUE  TRUE  TRUE  TRUE  TRUE FALSE FALSE FALSE FALSE FALSE
[1] "success"

It seems that subset_taxa is not looking for the subset logical vector in its current env but in the parent/Global env.

In the first run of test, subset_taxa cannot find the logical vector keep_taxa.

When I define a vector keep_taxa in the parent env test runs fine.

Aaron

Joey replied:

For the test you’ve demonstrated, you want to use prune_taxa rather than subset_taxa. The subset_taxa function wraps R core subset, which has some interesting nuances about when/where it looks for things.

In your example you explicitly define a vector taxa names to keep. That is exactly what prune_taxa is for. By contrast, subset_taxa expects its second argument to be an expression that can contain variable names related to the column names of the taxonomy table in the first argument, if it has a taxonomy table. That is, subset_taxa is intended for something like:

subset_taxa(GlobalPatterns, Kingdom=="Bacteria")

and the goal of your code above would be achieved with:

prune_taxa(keep_taxa, GlobalPatterns)

Hope that helps. Let me know if I missed something from your question, keeping in mind that the flexible evaluation behavior of subset_taxa is intentional, and should be analogous to subset.

Leave a comment

Filed under Bioinformatics hacking