예제 #1
0
    def _anonymize_pooled_gsa(
        self, file_path_output_pooled_anonymous, sequence_prefix):
        """
        Anonymize assembly of a sample.

        @param file_path_output_pooled_anonymous: file paths of assembly from all samples
        @type file_path_output_pooled_anonymous: str | unicode
        @param sequence_prefix: Prefix for anonymous sequence names
        @type sequence_prefix: str | unicode

        @return: File path of anonymized assembly and file path of a sequence name mapping
        @rtype: tuple[str|unicode, str|unicode]
        """
        fastaanonymizer = FastaAnonymizer(
            logfile=self._logfile,
            verbose=self._verbose,
            debug=self._debug,
            seed=None,
            tmp_dir=self._project_file_folder_handler.get_tmp_wd()
        )

        file_path_output_anonymous, file_path_anonymous_mapping = fastaanonymizer.shuffle_anonymize(
            path_input=file_path_output_pooled_anonymous,
            prefix=sequence_prefix,
            file_format="fasta")

        return file_path_output_anonymous, file_path_anonymous_mapping
예제 #2
0
    def _anonymize_reads(self, directory_fastq, sequence_prefix, paired_end):
        """
        Anonymize simulated reads.

        @param directory_fastq: fastq directory of a sample
        @type directory_fastq: str | unicode
        @param sequence_prefix: Prefix for anonymous sequence names
        @type sequence_prefix: str | unicode
        @param paired_end: True if reads are paired
        @type paired_end: bool

        @return: File path of anonymized reads and file path of a sequence name mapping
        @rtype: tuple[str|unicode, str|unicode]
        """
        fastaanonymizer = FastaAnonymizer(
            logfile=self._logfile,
            verbose=self._verbose,
            debug=self._debug,
            seed=None,
            tmp_dir=self._project_file_folder_handler.get_tmp_wd()
        )

        if paired_end:
            file_path_output_anonymous_reads, file_path_anonymous_mapping = fastaanonymizer.interweave_shuffle_anonymize(
                directory_fastq,
                prefix=sequence_prefix,
                file_format="fastq",
                file_extension="fq")
        else:
            file_path_output_anonymous_reads, file_path_anonymous_mapping = fastaanonymizer.shuffle_anonymize(
                directory_fastq,
                prefix=sequence_prefix,
                file_format="fastq",
                file_extension="fq")
        return file_path_output_anonymous_reads, file_path_anonymous_mapping