コード例 #1
0
ファイル: AMP.py プロジェクト: bioaicuhksz/AMPfinder
    def process_contig(self):
        """Process nuclotide sequence(s)."""
        file_name = os.path.basename(self.input_sequence)
        output = self.output_file
        tax_class = self.tax_class
        print("OKOKOKOKOKOK")
        orf_obj = ORF(input_file=self.input_sequence)
        orf_obj.contig_to_orf()
        contig_fsa_file = os.path.join(self.working_directory,
                                       "{}.temp.contig.fsa".format(file_name))

        try:
            if os.stat(contig_fsa_file).st_size > 0:
                if self.aligner == "diamond":
                    diamond_obj = Diamond(input_file=contig_fsa_file,
                                          output_file=output,
                                          tax_class=tax_class,
                                          num_threads=self.threads)
                    diamond_obj.run()
                else:
                    print(contig_fsa_file)
                    blast_obj = Blast(input_file=contig_fsa_file,
                                      output_file=output,
                                      tax_class=tax_class,
                                      num_threads=self.threads)
                    blast_obj.run()
            else:
                self.write_stub_output_file()
        except Exception as e:
            pass
        else:
            pass
コード例 #2
0
ファイル: main.py プロジェクト: shenoisam/coronavirus
def main():

    # Define an argument parser to pull arguments from the command line
    parser = argparse.ArgumentParser(
        description='Run a local blast query on a variety of sequences.')

    # f1 argument
    parser.add_argument('-f',
                        metavar='-f',
                        nargs='+',
                        required=True,
                        help='A list of filenames or Refseq ids ')

    # f2 argument
    parser.add_argument('-g',
                        metavar='-g',
                        nargs='+',
                        required=True,
                        type=int,
                        help='Genomes passed by taxid: 9606, 562, 2697049')

    # Output file
    parser.add_argument('-o',
                        metavar='-o',
                        nargs='+',
                        required=True,
                        help='The name of the output file')

    # e value argument
    parser.add_argument('-e',
                        nargs='?',
                        default=10,
                        type=int,
                        help='e-value threshold. Defaults to 10.')

    # Parse arguments
    args = parser.parse_args()

    # Generate the blast object with the arguments
    blast = Blast(args)

    # Get the filenames of the query sequences needed
    filenames = blast.pull_sequences()

    # Run the blast query
    blast.format_file()
    blast.run_blast(filenames)
コード例 #3
0
ファイル: AMP.py プロジェクト: bioaicuhksz/AMPfinder
 def process_protein(self):
     """Process protein sequence(s)."""
     file_name = os.path.basename(self.input_sequence)
     output = self.output_file
     tax_class = self.tax_class
     if self.aligner == "diamond":
         diamond_obj = Diamond(self.input_sequence,
                               output_file=output,
                               tax_class=tax_class,
                               num_threads=self.threads)
         diamond_obj.run()
     else:
         blast_obj = Blast(input_file=file_name,
                           output_file=output,
                           tax_class=tax_class,
                           num_threads=self.threads)
         blast_obj.run()
コード例 #4
0
FP1.close

expressions = []
FP2.readline()
for line in FP2:
    temp = line.strip().split()
    trID = temp[0]
    dShift = temp[1]
    hShock = temp[2]
    loggrowth = temp[3]
    pphase = temp[4]
    dxp = DiffExp(trID, dShift, hShock, loggrowth, pphase)
    expressions.append(dxp)
FP2.close

objblast = Blast(blast)
objmatrix = Matrix(expressions)

'''
Load the BlastHit objects that are good matches into a dictionary
'''
goodblasthits = {}
for item in objblast:
    if item.good_match():
        goodblasthits[item.TranscriptID] = item.SwissProtID

'''
create an output file
'''
FP3 = open("Output.txt", 'w')
FP3.write('{}\t{}\t{}\t{}\t{}\n'.format('','Sp_ds','Sp_hs', 'Sp_log', 'Sp_plat'))
コード例 #5
0
                    player1 = players.sprites()[0]
                    player1.money = pm
                    moneycounter = CounterDisplay(player1.money,
                                                  (20, height - 10))
                    healthbar = HealthBar(player1, (50, 50))

                if event.key == pygame.K_d or event.key == pygame.K_RIGHT:
                    player1.direction("right")
                if event.key == pygame.K_a or event.key == pygame.K_LEFT:
                    player1.direction("left")
                if event.key == pygame.K_w or event.key == pygame.K_UP:
                    player1.jump()
                if event.key == pygame.K_s or event.key == pygame.K_DOWN:
                    player1.direction("down")
                if event.key == pygame.K_SPACE:
                    Blast(player1.headingx, player1.rect.center)
            if event.type == pygame.KEYUP:
                if event.key == pygame.K_d or event.key == pygame.K_RIGHT:
                    player1.direction("stop right")
                if event.key == pygame.K_a or event.key == pygame.K_LEFT:
                    player1.direction("stop left")
                if event.key == pygame.K_w or event.key == pygame.K_UP:
                    player1.stop_jump()
                if event.key == pygame.K_s or event.key == pygame.K_DOWN:
                    player1.direction("stop down")

        playersHitBlocks = pygame.sprite.groupcollide(players, hardBlocks,
                                                      False, False)
        enemiesHitBlocks = pygame.sprite.groupcollide(enemies, hardBlocks,
                                                      False, False)
        enemiesHitEnemies = pygame.sprite.groupcollide(enemies, enemies, False,