Question: Bamfile first step analysis
gravatar for p.panelli
10 months ago by
p.panelli10 wrote:

Hello everyone, I'm Patrizio and I'm new to R and in RNAseq.

I have a couple of small bam files that I'd like to compare. So far I've been able to reproduce examples online for the differential gene expression analysis, and to practice with biocompare working with bam files included in the package.

I want to analyze two bam files from an RNAseq but I can not find a way to convert this bam file in a package so that can be analyzed in R. How can I create a library containing my bam files?

Thank you


rna-seq • 558 views
ADD COMMENTlink modified 10 months ago by WouterDeCoster27k • written 10 months ago by p.panelli10

Hi, BAM files are obtained after quality filter of raw sequencing reads followed by alignment. Follow any RNA-seq analysis protocol/pipeline after alignment step. Example from below mentioned link to pipeline follow from Step 4 (check alignment quality),

A: Any One please provide protocol for Analysing long noncoding RNA illumina NGS da

Detailed tutorials for Step 6 (Differential expression analysis),

A: Differential gene expression using R studio

ADD REPLYlink modified 10 months ago • written 10 months ago by EagleEye5.0k

Hi EagleEye and thank you for your answer. I looked at many tutorials but what I want to know is, how can I load two bam files that I have on my desktop in R? once this is done maybe I can proceed with others steps.

for instance using this script: https ://

I can import one bam file, but in my case I have two of them which I want to use for the differential expression analysis.

can you help me with that?


ADD REPLYlink modified 10 months ago • written 10 months ago by p.panelli10


You do not have to load BAM file in R. Only Step 6 I mentioned in the above post need R, where you load simple text (matrix) file containing read counts of individual genes for your control and treatment sample.

Suggestion: I recommend you to discuss with some bioinformatician from your facility or take some course on RNA-seq analysis.

ADD REPLYlink modified 10 months ago • written 10 months ago by EagleEye5.0k

Here there is an example about how to analyze .bam files.

I was able to follow the example after the installation of the required packages. In this example, there are 8 bam files in a package named "airway". This file are imported into R with a line


I thought I could do the same with my bam files after I create a package and use the same procedure. Is it possible to do that?

I wish I could know a bioinformatician to discuss about that but at the moment I don't know anybody available. If here there is somebody that can help me I would be glad and eventually I could pay his time.

Thank you

ADD REPLYlink written 10 months ago by p.panelli10

No, no, that's not how you typically do RNA-seq analysis. The 'Airway' package is just an example dataset for a tutorial.

ADD REPLYlink written 10 months ago by WouterDeCoster27k

Please use ADD COMMENT or ADD REPLY to answer to previous reactions, as such this thread remains logically structured and easy to follow. I have now moved your post but as you can see it's not optimal. Adding an answer should only be used for providing a solution to the question asked.

ADD REPLYlink written 10 months ago by WouterDeCoster27k
gravatar for kristoffer.vittingseerup
10 months ago by
European Union
kristoffer.vittingseerup460 wrote:

I would recomend the R package Rsubread ( ) which allows you to quantify the genes in a BAM file thereby obtaining a count matrix for differential expression analysis. More specifically check the featureCounts() function.

ADD COMMENTlink written 10 months ago by kristoffer.vittingseerup460

esp featurecounts function

ADD REPLYlink written 10 months ago by cpad01124.5k
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 944 users visited in the last hour