A method for determining aneuploidy and sex of fetus and corresponding fetal fraction from a maternal blood, plasma or serum sample comprising a mixture of DNA fragments of fetal and maternal origin, wherein the mixture of DNA fragments of fetal and maternal origin are circulating cell-free DNA molecules, said method comprising: a) performing a random sequencing on at least a portion of a plurality of the cell-free DNA molecules contained in the sample, thereby obtaining sequence information for a plurality of DNA fragments of fetal and maternal origin from a maternal sample, wherein the sequence information comprises sequence reads; b) mapping the sequence reads to the reference human genome; c) splitting the reference genome into 20kb subsequent and non-overlapping bins and distributing the mapped sequence reads to said bins according to their mapping location; d) optionally correcting number of reads for GC content bias; e) train initial distributions of selected features of DNA fragments on the set of training samples; f) construct a Bayesian network that includes the selected features of DNA fragments for four categories that combine sex and aneuploidy presence or absence in fetus, which are euploid male, aneuploid male, euploid female, aneuploid female, on the sample; g) run iterative EM algorithm on the Bayesian network; h) based on the EM output a. classify DNA fragments from the sample as maternal or fetal; b. adjust distributions of selected features of DNA fragments; i) repeat steps g) and h) until the parameters of trained distribution does not significantly change between iterations, e.g. sum of differences is below 0.000001 j) calculate the probability of the selected features of DNA fragments in the final Bayesian network; k) for each category find fetal fraction with highest posterior probability; l) select the most probable category for the sample to determine the classification of the sample as one from the said categories euploid male, aneuploid male, euploid female, aneuploid female; wherein Bayesian network for each said category which includes selected features of DNA fragment, is constructed with the set of training samples comprising set of pregnant women with euploid female fetus and set of pregnant women with euploid male fetus using the same steps as in said steps a) to i) and provides the initial distributions of the selected features of DNA fragments, where in step e) the selected features of DNA fragment are fragment length, LEN, and chromosome of origin, CHROM, and the set of training samples comprises set of pregnant women with euploid female fetus; set of pregnant women with euploid male fetus; set of adult males; and set of non-pregnant females. a) performing a random sequencing on at least a portion of a plurality of the cell-free DNA molecules contained in the sample, thereby obtaining sequence information for a plurality of DNA fragments of fetal and maternal origin from a maternal sample, wherein the sequence information comprises sequence reads; b) mapping the sequence reads to the reference human genome; c) splitting the reference genome into 20kb subsequent and non-overlapping bins and distributing the mapped sequence reads to said bins according to their mapping location; d) optionally correcting number of reads for GC content bias; e) train initial distributions of selected features of DNA fragments on the set of training samples; f) construct a Bayesian network that includes the selected features of DNA fragments for four categories that combine sex and aneuploidy presence or absence in fetus, which are euploid male, aneuploid male, euploid female, aneuploid female, on the sample; g) run iterative EM algorithm on the Bayesian network; h) based on the EM output a. classify DNA fragments from the sample as maternal or fetal; b. adjust distributions of selected features of DNA fragments; a. classify DNA fragments from the sample as maternal or fetal; b. adjust distributions of selected features of DNA fragments; i) repeat steps g) and h) until the parameters of trained distribution does not significantly change between iterations, e.g. sum of differences is below 0.000001 j) calculate the probability of the selected features of DNA fragments in the final Bayesian network; k) for each category find fetal fraction with highest posterior probability; l) select the most probable category for the sample to determine the classification of the sample as one from the said categories euploid male, aneuploid male, euploid female, aneuploid female; set of pregnant women with euploid female fetus; set of pregnant women with euploid male fetus; set of adult males; and set of non-pregnant females.