Ejemplo n.º 1
0
class ProfileUI(QWidget):
    def __init__(self):
        QWidget.__init__(self, None)
        self.ui = Ui_Form()
        self.ui.setupUi(self)
        self.ui.rentHsBtn.clicked.connect(self.showHistory)
        self.user = ""
        self.profile = Profile()
        self.history = CarHistory()

    def setUser(self, user):
        self.user = user
        self.profile.loadData(self.user)

    def setInfo(self):
        self.ui.uNameLabel.setText(self.profile.uName)
        self.ui.nameLabel.setText(self.profile.name)
        self.ui.emailLabel.setText(self.profile.email)
        self.ui.contactLabel.setText(self.profile.contact)
        self.ui.cardLabel.setText(self.profile.credCard)

    def showHistory(self):
        self.history.setUser(self.user)
        self.history.loadData()
        self.history.show()
Ejemplo n.º 2
0
 def __init__(self):
     QWidget.__init__(self, None)
     self.ui = Ui_Form()
     self.ui.setupUi(self)
     self.ui.rentHsBtn.clicked.connect(self.showHistory)
     self.user = ""
     self.profile = Profile()
     self.history = CarHistory()
Ejemplo n.º 3
0
 def test_edit_address(self):
     example = Profile(name="Tester McTasty")
     example.edit_address(street="775 McNeill St.")
     self.assertEqual(example.address['street'], "775 McNeill St.")
     example.edit_address(city="Honolulu")
     self.assertEqual(example.address['city'], "Honolulu")
     example.edit_address(state="HI")
     self.assertEqual(example.address['state'], "HI")
     example.edit_address(zip="96817")
     self.assertEqual(example.address['zip'], "96817")
Ejemplo n.º 4
0
 def test_init(self):
     example = Profile(name="Tester McTasty",
                       phone_num="8087654321",
                       email="*****@*****.**")
     self.assertEqual(example.name, "Tester McTasty")
     self.assertEqual(example.phone_num, "8087654321")
     self.assertEqual(example.email, "*****@*****.**")
Ejemplo n.º 5
0
    def _get_delbot_profile(self):
        disliked_ingredients = ['brocolis', 'porc', 'canelle', 'ail', 'coriande']
        liked_ingredients = ['pâtes', 'poulet', 'lardon', 'patates douces', 'potiron',
            'carotte', 'curry', 'céréales', 'gigembre', 'poireaux', 'beurre', 'pommes de terre', 
            'gruyère', 'fromage', 'oignon', 'tomate', 'chocolat', 'raisins', 'noisettes', 'amandes']

        return Profile(
            liked_ingredients,
            disliked_ingredients, 
            'delbot')
Ejemplo n.º 6
0
    def _get_sporty_profile(self):
        disliked_ingredients = ['boeuf', 'choux', 'carotte', 'café', 'avocat', 'pâtes', 'sucre', 'beurre']
        liked_ingredients = ['poulet', 'veau', 'saumon', 'lapin', 'oeuf', 'lait', 'tomate', 
            'pain', 'pommes de terre', 'thon', 'pomme', 'betterave', 'maïs', 'mangue', 'ananas', 'pêche',
            'noisette', 'dinde']

        return Profile(
            liked_ingredients,
            disliked_ingredients, 
            'sporty')
Ejemplo n.º 7
0
 def create(self):
     print("Please enter your name: ", end="")
     self.name = input()
     self.cursor()
     print("Now, please enter your surname: ", end="")
     self.surname = input()
     self.cursor()
     print("Set your password now: ", end="")
     password = input()
     print(self.name, self.surname, ", your account has just created.")
     return Profile(self.name, self.surname, password)
Ejemplo n.º 8
0
    def _get_vegan_profile(self):
        disliked_ingredients = ['poulet', 'boeuf', 'porc', 'oeuf', 'fromage', 'chèvre']
        liked_ingredients = ['tomate', 'courgette', 'carotte', 'potimarron',
            'poivron', 'aubergine', 'poire', 'banane', 'orange', 'ananas',
            'cerise', 'tofu', 'pois chiche', 'pomme', 'lentille', 'noix', 'citron', 
            'quorn', 'avocat', 'patates douces', 'lait de coco']

        return Profile(
            liked_ingredients,
            disliked_ingredients,
            'vegan')
Ejemplo n.º 9
0
    def loadProfile(self):
        file = open("todo_DB.txt", "r")
        lines = file.readlines()
        properties = []

        for line in lines:
            char = self.readProperty(line)
            if char == "@":
                length = len(line)
                properties.append(line[1:length].strip())

        return Profile(properties[0], properties[1], properties[2])
Ejemplo n.º 10
0
    def _get_youth_profile(self):
        disliked_ingredients = ['poireaux', 'épinard', 'poisson', 'courgette', 'navet', 
            'oignon', 'poivron', 'champignon', 'radis']
        liked_ingredients = ['pommes de terre', 'chocolat', 'sucre', 'beurre', 'pâtes', 
            'rhum', 'glace', 'yaourt', 'fromage', 'noix de coco', 'porc', 'boeuf', 
            'poulet', 'confiture', 'framboise', 'fraise']
        scoring_function = lambda recipe: (prep := recipe['preparation']) < 30 * prep != -1 

        return Profile(
            liked_ingredients,
            disliked_ingredients, 
            'youth',
            scoring_function)
Ejemplo n.º 11
0
        QWidget.__init__(self, None)
        self.ui = Ui_Form()
        self.ui.setupUi(self)
        self.ui.rentHsBtn.clicked.connect(self.showHistory)
        self.user = ""
        self.profile = Profile()
        self.history = CarHistory()

    def setUser(self, user):
        self.user = user
        self.profile.loadData(self.user)

    def setInfo(self):
        self.ui.uNameLabel.setText(self.profile.uName)
        self.ui.nameLabel.setText(self.profile.name)
        self.ui.emailLabel.setText(self.profile.email)
        self.ui.contactLabel.setText(self.profile.contact)
        self.ui.cardLabel.setText(self.profile.credCard)

    def showHistory(self):
        self.history.setUser(self.user)
        self.history.loadData()
        self.history.show()


if __name__ == '__main__':
    app = QApplication(sys.argv)
    w = Profile()
    w.setAttribute(Qt.WA_StyledBackground)
    w.show()
    sys.exit(app.exec_())
Ejemplo n.º 12
0
 def on_save_clicked(self,widget):
     if self.elems["name"].get_text() in get_profiles():
         dialog = Gtk.MessageDialog(self.parent, 0, Gtk.MessageType.WARNING,
         Gtk.ButtonsType.OK_CANCEL, _("A profile already has this name"))
         dialog.format_secondary_text(
             _("Are you sure to save this profile and lose the older one ?"))
         response = dialog.run()
         if response == Gtk.ResponseType.OK:
             dialog.destroy()
         elif response == Gtk.ResponseType.CANCEL:
             dialog.destroy()
             return
                 
     p = Profile()
     if self.elems["toggleSize"].get_active():
         w = self.elems["w"].get_text()
         h = self.elems["h"].get_text()
         ratio = self.elems["ratio"].get_active()
         p.size = (w,h,ratio)
     else:
         p.size = False
     if self.elems["toggleAuthor"].get_active() is not True:
         p.author == False
     else:
         p.author = self.elems["author"].get_text()
     if self.elems["toggleLicence"].get_active() is not True:
         p.licence == False
     else:
         p.licence = self.licenceChooser.get_active_text()
     if self.elems["toggleRename"].get_active() is not True:
         p.rename == False
     else:
         p.rename = (self.elems["prefixe"].get_text(),self.elems["suffixe"].get_text())
     if self.elems["toggleDir"].get_active() is not True:
         p.dir = False
     else:
         p.dir = True
     if self.elems["toggleFont"].get_active():
         p.font = self.font
     try:
         p.save(self.elems["name"].get_text())
         dialog = Gtk.MessageDialog(self.parent, 0, Gtk.MessageType.INFO,
         Gtk.ButtonsType.OK, _("Succed to create the profile"))
         dialog.run()
         dialog.destroy()
     except:
         dialog = Gtk.MessageDialog(self.parent, 0, Gtk.MessageType.ERROR,
         Gtk.ButtonsType.CANCEL, _("An error occured"))
         dialog.format_secondary_text(
             _("Unable to save the profile"))
         dialog.run()
         dialog.destroy()
         return
     self.parent.switch_view(ManageProfileView(self.parent))
Ejemplo n.º 13
0
 def test_edit_skills(self):
     example = Profile(name="Tester McTasty")
     example.edit_skills("Python", "Numpy", "Matplotlib")
     self.assertIn("Python", example.skills)
 def profile(self):
     """
     Returns player Profile object, which can be used to perform account-level API operations
     """
     return Profile(self.api)
Ejemplo n.º 15
0
class Processing:
    profile1 = None  # dictionary for k-mer and their frequencies for file1
    profile2 = None  # dictionary for k-mer and their frequencies for file2
    struct_profile1 = None  # dictionary for k-mer and their frequencies for first structural in struct_data
    struct_profile2 = None  # dictionary for k-mer and their frequencies for second structural in struct_data
    no_sec_peak = -1  # status if and how peak position for RNA-structure visualization should be used
    custom_norm_vector = None  # custom normalization value vector for element-string 2-mer frequencies
    at_norm_vector = None  # A.thaliana normalization vector for element-string 2-mer frequencies
    setting = None  # object containing all information, which are needed for calculation
    df = None  # table which contains kmer-frequencies as coordinates (kmer: x:(file1) = fre1,y:(file2)= fre2)
    top_kmer_df = None  # table of top k-mer
    all_triplets = None  # list of all combinations of triplets
    seq_len = None  # sequence length

    # data: file input list
    # selected: two files, which are processed
    # k: k-mer length
    # peak: peak: peak-position, where sequences should be aligned
    # top: number of best values
    # feature: number of T or k-mer-Frequency for pcas
    # cmd: bool, determines if second profile should be created
    # struct_data: structural data for RNA-structure heatmap(s)
    # no_sec_peak: status (-1= no data,0= False,1= True) to use 2-mer from structural data with peak-position only
    def __init__(self, data, selected, k, peak, top, feature, cmd, struct_data, no_sec_peak):
        if selected is not None:
            self.setting = Setting(data, selected, k, peak, top, feature, struct_data)

        top_value_msg1 = "INFO: top-value is greater than amount of calculated entries for one or more files."
        top_value_msg2 = "All entries will be displayed."

        # don't run commandline mode
        if not cmd:
            status_no_struct_data = -1
            triplet_length = 3
            two_mer_length = 2

            self.profile1 = Profile(calcFrequency(k, peak, selected, status_no_struct_data)[0], selected[0])
            self.profile2 = Profile(calcFrequency(k, peak, selected, status_no_struct_data)[1], selected[1])

            len_p1 = len(self.profile1.getProfile())  # dict length
            len_p2 = len(self.profile2.getProfile())

            if (top is not None) and (top > len_p1 or top > len_p2) and ((len_p1 is not 0) and (len_p2 is not 0)):
                print(top_value_msg1)
                print(top_value_msg2)
                self.setting.setTop(None)
                top = None

            # calculates dataframe
            self.df = createDataFrame(self.profile1, self.profile2, selected)

            # calculates top-k-mer dataframe
            self.top_kmer_df = calcTopKmer(top, self.profile1, self.profile2)

            # calculates all possible triples from dna-bases
            self.all_triplets = []
            triplet_comb = list(combinations_with_replacement(['A', 'C', 'G', 'T'], r=triplet_length))

            for trip in triplet_comb:
                comb = list(set(permutations(trip)))
                self.all_triplets.extend([''.join(comb[i]) for i in range(0, len(comb))])

            # calculates profiles for structural data
            if struct_data is not None:
                self.no_sec_peak = no_sec_peak
                struct_kmer_list1, struct_alphabet1 = calcFrequency(two_mer_length, None, [str(struct_data[0])],
                                                                    no_sec_peak)
                self.struct_profile1 = StructProfile(struct_kmer_list1, str(struct_data[0]), struct_alphabet1)
                if len(struct_data) > 1:
                    struct_kmer_list2, struct_alphabet2 = calcFrequency(two_mer_length, None, [str(struct_data[1])],
                                                                        no_sec_peak)
                    self.struct_profile2 = StructProfile(struct_kmer_list2, str(struct_data[1]), struct_alphabet2)

            self.at_norm_vector = readAthalianaData()

        # run commandline-mode
        else:
            self.profile1 = Profile(calcFrequency(k, peak, selected, False)[0], selected[0])

            len_p1 = len(self.profile1.getProfile())  # dict length

            if (top is not None) and (top > len_p1) and (len_p1 is not 0):
                print(top_value_msg1)
                print(top_value_msg2)
                self.setting.setTop(None)
                top = None

            self.top_kmer_df = calcTopKmer(top, self.profile1, None)

        self.seq_len = getSeqLength(selected[0])

    def getProfileObj1(self):
        return self.profile1

    def getProfileObj2(self):
        return self.profile2

    def getStructProfile1(self):
        return self.struct_profile1

    def getStructProfile2(self):
        return self.struct_profile2

    def getSettings(self):
        return self.setting

    def getDF(self):
        return self.df

    def getTopKmer(self):
        return self.top_kmer_df

    def getAllTriplets(self):
        return self.all_triplets

    def getSeqLen(self):
        return self.seq_len

    def getNoSecPeak(self):
        return self.no_sec_peak

    def getNormVector(self):
        return self.custom_norm_vector

    def setNormVector(self, nv):
        self.custom_norm_vector = nv

    def getATnormVector(self):
        return self.at_norm_vector

    def setATnormVector(self, nv):
        self.at_norm_vector = nv
Ejemplo n.º 16
0
    def __init__(self, data, selected, k, peak, top, feature, cmd, struct_data, no_sec_peak):
        if selected is not None:
            self.setting = Setting(data, selected, k, peak, top, feature, struct_data)

        top_value_msg1 = "INFO: top-value is greater than amount of calculated entries for one or more files."
        top_value_msg2 = "All entries will be displayed."

        # don't run commandline mode
        if not cmd:
            status_no_struct_data = -1
            triplet_length = 3
            two_mer_length = 2

            self.profile1 = Profile(calcFrequency(k, peak, selected, status_no_struct_data)[0], selected[0])
            self.profile2 = Profile(calcFrequency(k, peak, selected, status_no_struct_data)[1], selected[1])

            len_p1 = len(self.profile1.getProfile())  # dict length
            len_p2 = len(self.profile2.getProfile())

            if (top is not None) and (top > len_p1 or top > len_p2) and ((len_p1 is not 0) and (len_p2 is not 0)):
                print(top_value_msg1)
                print(top_value_msg2)
                self.setting.setTop(None)
                top = None

            # calculates dataframe
            self.df = createDataFrame(self.profile1, self.profile2, selected)

            # calculates top-k-mer dataframe
            self.top_kmer_df = calcTopKmer(top, self.profile1, self.profile2)

            # calculates all possible triples from dna-bases
            self.all_triplets = []
            triplet_comb = list(combinations_with_replacement(['A', 'C', 'G', 'T'], r=triplet_length))

            for trip in triplet_comb:
                comb = list(set(permutations(trip)))
                self.all_triplets.extend([''.join(comb[i]) for i in range(0, len(comb))])

            # calculates profiles for structural data
            if struct_data is not None:
                self.no_sec_peak = no_sec_peak
                struct_kmer_list1, struct_alphabet1 = calcFrequency(two_mer_length, None, [str(struct_data[0])],
                                                                    no_sec_peak)
                self.struct_profile1 = StructProfile(struct_kmer_list1, str(struct_data[0]), struct_alphabet1)
                if len(struct_data) > 1:
                    struct_kmer_list2, struct_alphabet2 = calcFrequency(two_mer_length, None, [str(struct_data[1])],
                                                                        no_sec_peak)
                    self.struct_profile2 = StructProfile(struct_kmer_list2, str(struct_data[1]), struct_alphabet2)

            self.at_norm_vector = readAthalianaData()

        # run commandline-mode
        else:
            self.profile1 = Profile(calcFrequency(k, peak, selected, False)[0], selected[0])

            len_p1 = len(self.profile1.getProfile())  # dict length

            if (top is not None) and (top > len_p1) and (len_p1 is not 0):
                print(top_value_msg1)
                print(top_value_msg2)
                self.setting.setTop(None)
                top = None

            self.top_kmer_df = calcTopKmer(top, self.profile1, None)

        self.seq_len = getSeqLength(selected[0])