I have a total of 300 million reads in my R1 and R2 raw fastq files.

How come fastQC count about 50% duplicates in each .fastq files, but after alignment with STAR (default parameters), none of the reads have the 1024 flag (PCR or optical duplicates) when doing `samtools view -c -f 1024 mydata.bam`?
Because STAR with default settings doesn't mark duplicates, you have to use `--bamRemoveDuplicatesType UniqueIdentical` to have duplicates marked (or `--bamRemoveDuplicatesType UniqueIdenticalNotMulti`).

**edit:** also, to elaborate on the point https://www.biostars.org/u/18713/ makes:

STAR (if you choose to mark duplicates with the correct parameter, which apparently you didn't) and FastQC use very different methods of detecting duplicates, so it shouldn't be surprising if the number os estimated duplicates is different. The [documentation for FastQC][1] states:

>To cut down on the memory requirements for this module only sequences which first appear in the first 100,000 sequences in each file are analysed

And also:

>Because the duplication detection requires an exact sequence match over the whole length of the sequence, any reads over 75bp in length are truncated to 50bp for the purposes of this analysis.

Whereas STAR uses mapping position:

> UniqueIdentical 
>
> mark all multimappers, and duplicate unique mappers.
>
> The coordinates, FLAG, CIGAR must be identical

  [1]: https://www.bioinformatics.babraham.ac.uk/projects/fastqc/Help/3%20Analysis%20Modules/8%20Duplicate%20Sequences.html