Example #1
0
    def __init__(self, inarg, Stype=FS.SIMILARITY, new=True):

        self.thisown = 0
        # First check if we are passing the SWIG wrapped type.
        if isinstance(inarg, FS_Smatrix):
            if new:
                self.this = FS.Smatrix_copy(inarg)
                self.thisown = 1
            else:
                self.this = inarg
                self.thisown = 1
        elif isinstance(inarg, str):
            # Load from file
            self.this = FS.Smatrix_load(inarg)
            self.thisown = 1
            # Dictionary - Biopython matrix
        elif isinstance(inarg, dict):
            self.this = FS.new_Smatrix(inarg, Stype)
            self.thisown = 1
            # Instance of ScoreMatrix
        elif isinstance(inarg, ScoreMatrix):
            self.this = FS.Smatrix_copy(inarg.this)
            self.thisown = 1
        else:
            raise TypeError, "Constructor only accepts"\
                  " a filename, a dictionary"\
                  " and an instance of ScoreMatrix."

        self.alphabet = FS.Smatrix_alphabet_get(self)
        self.mean = self._calc_mean()
Example #2
0
 def matrix_conv(self, seq=""):
     if (self.conv_type & 1) == POS:
         return ProfileMatrix(FS.Smatrix_matrix_conv(self, seq),
                              new=False)
     else:
         return ScoreMatrix(FS.Smatrix_matrix_conv(self, seq),
                            new=False)
Example #3
0
    def __init__(self, inarg, Stype=FS.SIMILARITY, new=True):
        self.thisown = 0
        if type(inarg) is types.StringType:
            if new == True:
                # Load from file 
                self.this = FS.Smatrix_load(inarg)
                self.thisown = 1
            else:
                # SWIG string
                self.this = inarg
                self.thisown = 1
            # Dictionary - Biopython matrix 
        elif isinstance(inarg, dict):
            self.this = FS.new_Smatrix(inarg, Stype)
            self.thisown = 1
            # Instance of ScoreMatrix
        elif isinstance(inarg, ScoreMatrix):
            self.this = FS.Smatrix_copy(inarg)
            self.thisown = 1
        else:
            raise TypeError, "Constructor only accepts"
        " a filename, a dictionary"
        " and an instance of ScoreMatrix." 

        self.alphabet = FS.Smatrix_alphabet_get(self)
        self.mean = self._calc_mean()
Example #4
0
    def __init__(self, inarg, Stype=FS.SIMILARITY, new=True):
        self.thisown = 0
        if isinstance(inarg, FS_Smatrix):
            if new:
                self.this = FS.Smatrix_copy(inarg)
                self.thisown = 1
            else:
                self.this = inarg
                self.thisown = 1
        elif isinstance(inarg, list):
            # List - Biopython PSSM
            self.this = FS.Smatrix_pssm(inarg)
            self.thisown = 1
        elif isinstance(inarg, ProfileMatrix):
            # Instance of ProfileMatrix
            self.this = FS.Smatrix_copy(inarg.this)
            self.thisown = 1
        else:
            raise TypeError, "Constructor only accepts"\
                  " a Biopython PSSM"\
                  " and an instance of ProfileMatrix."

        self.mean = self._calc_mean()
        self.alphabet = FS.Smatrix_alphabet_get(self)
        self._len = FS.Smatrix_len_get(self)
        self.qseq = FS.Smatrix_qseq_get(self)
Example #5
0
 def __init__(self, db_name, new=True, own=True):
     self.thisown = 0
     if new == True:
         self.this = FS.new_db(db_name)
         self.thisown = 1
     elif own == True:
         # SWIG string - thisown = 1
         self.this = db_name
         self.thisown = 1
     else:
         # SWIG string - thisown = 0
         self.this = db_name
         self.thisown = 0
Example #6
0
pd.options.display.max_colwidth = 100
pd.options.display.max_columns = 10

# ##### Examples: FS #####
# Load workout-history table to dataframe
# Note the 'u' in front, denoting a unicode string

collections = [
    u'workout-history',
    u'can-eat-options',
    u'exercises',
    u'food-items',
]

firestore = FS.FS()

# Get all exercises that have a string instead of a DocRef
wh = collections[0]
firestore.loadCollection(wh)
workoutHistory = firestore.collections[wh]
df = pd.DataFrame.from_dict(data)
filtered = df[df['Exercise'].apply(isinstance, args=(str, ))]

# # Normalize Data
# Update "Hex deadlift", "Shoulder press", "Bent over row" to title case.
filtered['Exercise']  # show data


# Define a function that checks for title case. Must have value for all use cases.
def isNotTitle(string):
Example #7
0
 def __del__(self):
     if self.thisown:
         FS.delete_Smatrix(self)
Example #8
0
 def matrix_conv(self):
     return ProfileMatrix(FS.Smatrix_matrix_conv(self, ''),
                          new=False)
Example #9
0
SIMILARITY = FS.SIMILARITY
DISTANCE = FS.DISTANCE

# Conversion values
POS = FS.POS
QUASI = FS.QUASI
MAX = FS.MAX
AVG = FS.AVG


# SWIG types - I don't know how to get them directly so I am using constructors
# to get their instances. Then, I get types from these instances. Ideally, I
# would use the new -builtin flag to SWIG and forgo all these wrapper
# files. However, this would break existing code and require extensive testing

_tmp_Smatrix = FS.new_Smatrix({('A', 'A'): 0}, FS.SIMILARITY)
FS_Smatrix = type(_tmp_Smatrix)
FS.delete_Smatrix(_tmp_Smatrix)

# Dummy matrix classes
class SubstitutionMatrix(dict):
    """
    Biopython matrix as a new class.
    """
    pass



class MatrixColumn(object):
    def __init__(self, col, this, alphabet):
        self._col = col
Example #10
0
 def get_frag(self, i, a, b):
     return FS.db_get_frag(self, i, a, b)
Example #11
0
 def get_seq(self, i):
     return FS.db_get_seq(self, i)
Example #12
0
 def range_conv(self, seq, r):
     return FS.Smatrix_range_conv(self, seq, r)
Example #13
0
 def eval_score(self, seq1, seq2):
     return FS.Smatrix_eval_score(self, seq1, seq2)
Example #14
0
 def fprint(fp=sys.stdout):
     return FS.Smatrix_fprint(self, fp)
Example #15
0
 def __str__(self):
     return FS.Smatrix___str__(self)
Example #16
0
 def __del__(self):
     if self.thisown:
         FS.delete_Smatrix(self)
Example #17
0
 def __del__(self):
     if self.thisown:
         FS.delete_db(self)
Example #18
0
 def eval_score(self, seq1):
     seq2 = 'X'*len(seq1)
     return FS.Smatrix_eval_score(self, seq1, seq2)
Example #19
0
 def get_def(self, i):
     return FS.db_get_def(self, i)
Example #20
0
 def range_conv(self, r):
     seq = 'X'*self._len
     return FS.Smatrix_range_conv(self, seq, r)
Example #21
0
			## Check if result contains all required data
			#if result[0] == 0: lastresult[0] = resultContainsAllOf( result[1], failifnot )

			if lastresult[0] != 0 and not cancelonerror: return (lastresult[0], lastresult[1], fallbacklist )
			
			config["lastOutput"] = lastresult[1]

	
		return [lastresult[0], lastresult[1], fallbacklist]



############################
# Main cycle of the program
if __name__ == "__main__":
	FS.setLogging( logFileName = config['DEFAULT_LOG'], logLevel=config['DEFAULT_LOGLEVEL'] )
	logger = logging.getLogger()

	parseArgv( config, logger )

	#conf   = FS.ConfigStorage( confAddr=config['DEFAULT_CONFIG'], actionName=config['ACTION'] )
	#conf   = FS.ConfigStorage( confAddr=config['DEFAULT_CONFIG'], actionName=config['ACTION'] )
	executor = CommandExecutor( config=config, execFunc=ExecLib.execAction )

	logger.debug("\nChecking which action is choosen:")
	#DLib.updateCurrentFile( ovaparams["VMname"], CurrentStatus )
	result = 0
	if config['ACTION'] and ( not config['LIST_ACTIONS'] and not config['DONT_EXECUTE']):
		logger.debug("\tThe ACTION \"%s\" is set, while LIST_ACTIONS is not set" % config['ACTION'])
		try:
			#executor.runAction( config=conf, action=config['ACTION'] )
Example #22
0
import FS
import time

if __name__ == "__main__":

    fil = FS.FileShareClass()
    print(fil.start_fileShare("C:/users/harsh/desktop"))
    time.sleep(20)
    fil.stopFileShare()