Commit e7acfec9a92ccbd728645d8246399c08bd254d14

Authored by Jean-Michel Garant
1 parent 13da59b8
Exists in stable-0.3 and in 1 other branch master

elongation in merge is reversed

Showing 1 changed file with 22 additions and 6 deletions   Show diff stats
merge.py
... ... @@ -133,13 +133,29 @@ def merge_g4rna(df, window=60, step=10,
133 133 }
134 134 # overlap is the length that sequential windows should share
135 135 overlap = window-step
  136 + pd.set_option('display.max_colwidth', -1)
136 137 if 'sequence' in df.columns:
137   - for ite in [1,2,3,4,5,6]:
  138 + for ite in [0,1,2,3,4]:
  139 + print -(overlap+step*ite)
138 140 df.loc[
139   - df.sequence.str[-overlap:].eq(
140   - df.sequence.str[:overlap].shift(-ite)),
141   - 'sequence'] = df.sequence.str[:] + \
142   - df.sequence.str[overlap:].shift(-ite)
  141 + df.sequence.str[:(overlap+step*ite)].eq(
  142 + df.sequence.str[step:].shift(1))
  143 + , 'sequence'] = df.sequence.str[:step].shift(1) + \
  144 + df.sequence.str[:]
  145 +
  146 +# df.sequence.str[-(overlap+step*ite):].eq(
  147 +# df.sequence.str[:(overlap+step*ite)].shift(-1))
  148 +# &
  149 +# df.sequence.str.len().shift(1) <= window)
  150 +# , 'sequence'] = df.sequence.str[:] + \
  151 +# df.sequence.str[(overlap+step*ite):].shift(-1)
  152 + # df.loc[
  153 + # df.sequence.str[-overlap:].eq(
  154 + # df.sequence.str[:overlap].shift(-6))
  155 +# , 'sequence'] = df.sequence.str[:df.sequence.str.len().shift(-6).fillna(60)]
  156 + # , 'sequence'] = df.sequence.str.len().shift(-6).fillna(0)
  157 + print df
  158 + #print pd.DataFrame(df.sequence,df.sequence.str.len())
143 159 if 'description' in df.columns:
144 160 df_grouped = df.groupby(
145 161 [df.description,df.sequence.str[-overlap:]],
... ... @@ -166,7 +182,7 @@ def arguments():
166 182 # declare argument parser
167 183 parser = argparse.ArgumentParser(formatter_class=utils.Formatter,
168 184 prog=os.path.basename(__file__),
169   - description="Merge positive windows of screen.py output and "\
  185 + description="[WORK IN PROGRESS] [DO NOT DISTRIBUTE] Merge positive windows of screen.py output and "\
170 186 "discard windows below the threshold(s)",
171 187 epilog="G4RNA screener Copyright (C) 2018 Jean-Michel Garant "\
172 188 "This program comes with ABSOLUTELY NO WARRANTY. This is free "\
... ...