Are you sure you can not determine how the BAM files were generated? One of the conventions of a BAM file is that it contains the command used to generate it. The command is stored in the file header, and can be seen with:
samtools view -H yourFile.bam
One of the last lines of the header should llok something like:
@PG ID:TopHat VN:2.0.13 CL:/n/local/bin/tophat --GTF SacCer3.gtf --library-type fr-firststrand
...etc.
Occasionally some BAM files will not contain this information. You should confirm that your files do not have it.
Cufflinks should calculate FPKM values for you. But as Geek_y mentions, saying the values are "weird" is uninformative. You'll have to say exactly what you mean. You can try calculating some values by hand - you can use samtools to pull out reads covering a given gene (see samtools view), count them, and manually calculate the FPKM using the total number of mapped reads returned by samtools idxstats to see if things are making sense. You could also examine some of the read flags to see if the alignment was done using parameters you don't agree with (i.e. examine map quality, number of hits etc.).
Lastly, if you simply want to remap everything yourself, but all you have are the BAM files, you can convert them back to fastq, and map them to your liking:
bedtools bamtofastq -i input.bam -fq output.fq
First, why do you want to calculate FPKM if you are looking at gene level data? Can you post the command that you used for cufflinks? And why do you think the corresponding values are weird?
Thanks for your reply.
The command I used for cufflinks is:
I think the FPKM values I got are weird because there are some transcripts got values like 1.01111e-310. Besides, I used bedcoverage to look at the number of reads at each position, and saw some transcripts with nonzero number of reads got zero FPKM value, and some transcripts with zero number of reads got nonzero FPKM value.
My question now is: If I simply want to get the expression level of each gene, could I just calculate it myself using the definition of RPKM? Is cufflinks using some specific technique?